I'm trying to write a custom proxy with HTTPS support.
It means that I need to react to HTTP CONNECT command, then open TCP/IP connection to desired server and lets browser use it.
I can open RAW socket as described here https://ktor.io/docs/servers-raw-sockets.html#server_send But I don't want then manually handle HTTP decoding.
I want to detect if it is HTTP or not and then use embedded HTTP parsing. I currently don't need to do MITM, so I don't need to decode the incoming SSL stream. But this is also possible in the future.
Something like https://github.com/ravindraranwala/NettyReverseProxy/blob/master/NettyRPDemo/src/main/java/org/wso2/netty/SecureProxyInitializer.java#L64 or Problems with building a MITM proxy with Netty that handles both HTTP and HTTPS on the same port