<div dir="ltr"><span style="font-size:12.8000001907349px">Hello,</span><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">I would like to ask your opinion and advice on accepting HTTP / HTTPS connections on the same port.</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">I currently have a prototype that peeks at the first byte after accepting a new connection, and dispatches to the appropriate routines based on whether the first byte is 0x16 or not. This came from looking at the TLS handshake protocol (<a href="http://en.wikipedia.org/wiki/Transport_Layer_Security#Handshake_protocol" target="_blank">http://en.wikipedia.org/wiki/Transport_Layer_Security#Handshake_protocol</a>) and testing different libraries.</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">The motivation for this was to avoid the configuration nightmare of introducing a second port, both in our code, and for administrators (firewall rules, etc.).</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">1) Is it valid to assume that the 1st byte of the handshake protocol is a valid way to disambiguate the traffic?</div><div style="font-size:12.8000001907349px">2) Are there any corner cases I might be missing?</div><div style="font-size:12.8000001907349px">3) Are there any security reasons for not doing this?</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Thanks for your advice,</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Joris</div></div>