-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http: add customization of proxy CONNECT requests #15027
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
This proposal is a little confused. It's proposing modifications to Let's discuss your actual needs on the mailing list before jumping to proposals. See https://golang.org/wiki/Questions. |
Well, I don't make sure but this seems not change of net/url. And maybe simply implementation of Transport.Proxy. package main
import (
"net/http"
"net/url"
)
func main() {
token := "blur"
http.DefaultClient.Transport.(*http.Transport).Proxy = func(r *http.Request) (*url.URL, error) {
r.Header.Add("Authorization", "Bearer " + token)
return r.URL, nil
}
} |
@mattn As I mentioned in the mailing-list, the problem is that when you do https, the CONNECT request wraps the original request, and there is no way to attach headers to the CONNECT req |
This was added to Go 1.8. See https://beta.golang.org/pkg/net/http/#Transport.ProxyConnectHeader Dup of #13290 |
Please answer these questions before submitting your issue. Thanks!
go version
)?1.6
go env
)?darwin amd64 [os x]
I tried to use Proxy with a
Bearer
authentication method.Allow other authentication method than Basic HTTP
Proxy authentication is limited to Basic-HTTP-Authentication only, with user & password:
https://github.com/golang/go/blob/master/src/net/http/transport.go#L493
url.URL
should allow custom authentication such asbearer
url.URL
should provide a method that returns the "authentication header value", and do the base64 etc.The text was updated successfully, but these errors were encountered: