Permalink
Browse files

net/http: fix bug where http2 wasn't enabled on DefaultTransport

I had accidentally disabled a headline feature at the last second. :(

Fixes #14391

Change-Id: I1992c9b801072b7538b95c55242be174075ff932
Reviewed-on: https://go-review.googlesource.com/19672
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/22035
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
  • Loading branch information...
bradfitz authored and adg committed Feb 18, 2016
1 parent f5cf567 commit 406752b640fcc56a9287b8454564cffe2f0021c1
Showing with 12 additions and 3 deletions.
  1. +7 −3 src/net/http/transport.go
  2. +5 −0 src/net/http/transport_test.go
@@ -176,9 +176,13 @@ func (t *Transport) onceSetNextProtoDefaults() {
// Issue 14275.
return
}
if t.ExpectContinueTimeout != 0 {
// Unsupported in http2, so disable http2 for now.
// Issue 13851.
if t.ExpectContinueTimeout != 0 && t != DefaultTransport {
// ExpectContinueTimeout is unsupported in http2, so
// if they explicitly asked for it (as opposed to just
// using the DefaultTransport, which sets it), then
// disable http2 for now.
//
// Issue 13851. (and changed in Issue 14391)
return
}
t2, err := http2configureTransport(t)
@@ -2888,6 +2888,11 @@ func TestTransportAutomaticHTTP2(t *testing.T) {
testTransportAutoHTTP(t, &Transport{}, true)
}
// golang.org/issue/14391: also check DefaultTransport
func TestTransportAutomaticHTTP2_DefaultTransport(t *testing.T) {
testTransportAutoHTTP(t, DefaultTransport.(*Transport), true)
}
func TestTransportAutomaticHTTP2_TLSNextProto(t *testing.T) {
testTransportAutoHTTP(t, &Transport{
TLSNextProto: make(map[string]func(string, *tls.Conn) RoundTripper),

0 comments on commit 406752b

Please sign in to comment.