http2: send "http/1.1" ALPN in TLS dial in addition to "h2"
RFC 7301 defines the ALPN protocol "http/1.1".
We weren't sending that, so at least one site (dav.box.com) was
rejecting our connection, since they didn't support the only protocol
we advertised ("h2"). Had we advertised nothing, they would've
assumed http/1.1 implicitly.
This CL also hooks up the verbose logging knob to the GODEBUG
environment variable.
Updates golang/go#13598 (fixed when this is copied into std)
Change-Id: I6ea1231d0d0f0bc767caa0458237eefd943d9d3d
Reviewed-on: https://go-review.googlesource.com/17754
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/http2/transport_test.go b/http2/transport_test.go
index 0c875ac..ef8eaa9 100644
--- a/http2/transport_test.go
+++ b/http2/transport_test.go
@@ -437,10 +437,11 @@
// Laziness, to avoid buildtags.
t.Errorf("stringification of HTTP/1 transport didn't contain \"h2\": %v", got)
}
+ wantNextProtos := []string{"h2", "http/1.1"}
if t1.TLSClientConfig == nil {
t.Errorf("nil t1.TLSClientConfig")
- } else if !reflect.DeepEqual(t1.TLSClientConfig.NextProtos, []string{"h2"}) {
- t.Errorf("TLSClientConfig.NextProtos = %q; want just 'h2'", t1.TLSClientConfig.NextProtos)
+ } else if !reflect.DeepEqual(t1.TLSClientConfig.NextProtos, wantNextProtos) {
+ t.Errorf("TLSClientConfig.NextProtos = %q; want %q", t1.TLSClientConfig.NextProtos, wantNextProtos)
}
if err := ConfigureTransport(t1); err == nil {
t.Error("unexpected success on second call to ConfigureTransport")