-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
x/net/http2: Transport.TLSConfig.ServerName is ignored #14501
Comments
Yup, I think this is because of 9f08b6c. |
As far as I can tell, this has nothing to do with crypto/tls or Go 1.6. The Go 1.6 http2 path would still verify hostnames in the same way. You're not even hitting the Go 1.6 http2 path because your Transport sets the TLSConfig explicitly. Your repro with x/net/http2.Transport is valid, so I've retitled this bug. This appears to be the difference, in func (t *Transport) newTLSConfig(host string) *tls.Config {
cfg := new(tls.Config)
if t.TLSClientConfig != nil {
*cfg = *t.TLSClientConfig
}
cfg.NextProtos = []string{NextProtoTLS} // TODO: don't override if already in list
cfg.ServerName = host
return cfg
} The But in the standard library's cfg := cloneTLSClientConfig(t.TLSClientConfig)
if cfg.ServerName == "" {
cfg.ServerName = cm.tlsHost()
} We can make that same change in x/net/http2. |
CL https://golang.org/cl/19918 mentions this issue. |
Confirm it's fixed! |
Fixes golang/go#14501 Change-Id: Ibaa7fb1fff404c62c35bb7c63f4a442e4fc0610d Reviewed-on: https://go-review.googlesource.com/19918 Reviewed-by: Andrew Gerrand <adg@golang.org>
http2.Transport
behave differently thanhttp.Transport
and it break valid use case.Before, I could use self signed certificate and use the
ServerName
TLS configuration to force to validate on a specific name.But since 1.6/http2 it don't works anymore, here is a complete example.
Running output:
The text was updated successfully, but these errors were encountered: