-
Notifications
You must be signed in to change notification settings - Fork 18k
x/net/proxy: add HTTP CONNECT support #19504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
In that case, the function should take a |
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 |
Change https://golang.org/cl/94535 mentions this issue: |
Change https://golang.org/cl/111135 mentions this issue: |
Change https://golang.org/cl/111136 mentions this issue: |
Change https://golang.org/cl/134675 mentions this issue: |
Change https://golang.org/cl/134716 mentions this issue: |
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.
Add function
FromEnvironmentForScheme(scheme)
Like
FromEnvironment()
, this function returns a dialer.The existing function
FromEnvironment()
checks the environment variable “all_proxy”, while in the case of HTTP CONNECT, we would want to use “http_proxy” and “https_proxy”.The new function
FromEnvironmentForScheme()
checks https_proxy, http_proxy and all_proxy based on the scheme.Add
DialContext()
functionAs requested in #17759.
Adding
DialContext()
toDialer
interface will be a breaking change though. What's proposed in #17759 seems like a good solution.The text was updated successfully, but these errors were encountered: