Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
x/net/proxy: add HTTP CONNECT support #19504
This is a proposal to add HTTP CONNECT support to x/net/proxy package.
Implement HTTP CONNECT dialer
As what’s done for socks5, we can add an implementation for HTTP CONNECT dialer, it dials to the proxy, and then does a HTTP CONNECT handshake.
Also, we can register this dialer to proxySchemes with key “http” and key “https” as default dialers. This should be done in an init() function, so that users can overwrite those with their custom dialers if they want.
A func (especially one prefixed with "Do") doesn't seem to match the style of the package.
I'd make a new type for it with a Dial method. Then the rarely-used http.Header can just be a field on the type.
You can make it take a Dialer in its constructor for now and later we can do a runtime interface check to see if it's also a ContextDialer once we add that type.
If the constructor takes a Dialer, but the Dialer doesn't implement
If we add another interface
Would you consider making an API change for this package, probably in a future release? I would think breaking the compatibility by adding