Skip to content

Commit 9b03043

Browse files
committed
Actually disable H2 by setting TLSNextProto to an empty map
1 parent 6ac9da0 commit 9b03043

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

htmltest/htmltest.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"path"
1212
"sync"
1313
"time"
14+
"crypto/tls"
1415
)
1516

1617
// HTMLTest struct, A html testing session, user options are passed in and
@@ -42,7 +43,12 @@ func Test(optsUser map[string]interface{}) *HTMLTest {
4243
(hT.opts.LogSort == "seq"))
4344

4445
transport := &http.Transport{
45-
TLSNextProto: nil, // Disable HTTP/2, "write on closed buffer" errors
46+
// Disable HTTP/2, this is required due to a number of edge cases where http negotiates H2, but something goes
47+
// wrong when actually using it. Downgrading to H1 when this issue is hit is not yet supported so we use the
48+
// following to disable H2 support:
49+
// > Programs that must disable HTTP/2 can do so by setting Transport.TLSNextProto ... to a non-nil, empty map.
50+
// See issue #49
51+
TLSNextProto: make(map[string]func(authority string, c *tls.Conn) http.RoundTripper),
4652
}
4753
hT.httpClient = &http.Client{
4854
// Durations are in nanoseconds

0 commit comments

Comments
 (0)