mirror of https://github.com/golang/go.git
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>
This commit is contained in:
parent
98cc8b4cf2
commit
2eeaaaae75
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Reference in New Issue