I’m planning to make a http plugin for caddy that implements the SSTP protocol, which runs over HTTPS. As the handshake is http, it can be put on the same server, as a http plugin, rather than a standalone server.
However, the net/http package doesn’t parse the handshake properly, and drops it with a 400 (Bad Request) status. As far as I know, this is because the SSTP handshake sends a Content-Length (as per the SSTP specification) of 18446744073709551615. This creates an error within net/http as it is greater than an int64, so it can’t read it.
Is it possible to modify the HTTP request before net/http parses it (but after tls decryption occurs), so that it can be changed to something that is parseable by net/http?
After it is parsed, I presume that a Hijacker can be used to then parse this within the plugin as SSTP. I’ve already written a mostly working (but dependant on pppd, which I intend to implement in pure Go) server, which doesn’t use net/http.