Commit 406752b6 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick Committed by Andrew Gerrand

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/19672Reviewed-by: default avatarIan 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/22035Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent f5cf5673
......@@ -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),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment