Skip to content

Commit 4f2d039

Browse files
committed
Add the ability to disable HTTP/2
I have noticed that HTTP/2 tends to be unreliable in certain circumstances due to bugs in Go's HTTP/2 library. See the following upstream issues: golang/go#36026 golang/go#59690 Let's add a configuration option here, so that HTTP/2 can be disabled on an individual basis if needed.
1 parent 34e3e8d commit 4f2d039

File tree

3 files changed

+107
-86
lines changed

3 files changed

+107
-86
lines changed

pkg/http/configuration.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func NewRoundTripperFromConfiguration(configuration *pb.ClientConfiguration) (ht
2222
Timeout: 30 * time.Second,
2323
KeepAlive: 30 * time.Second,
2424
}).DialContext,
25-
ForceAttemptHTTP2: true,
25+
ForceAttemptHTTP2: !configuration.DisableHttp2,
2626
TLSClientConfig: tlsConfig,
2727
}
2828
if proxyURL := configuration.GetProxyUrl(); proxyURL != "" {

pkg/proto/configuration/http/http.pb.go

+95-85
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/proto/configuration/http/http.proto

+11
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ message ClientConfiguration {
3030
//
3131
// "Basic " + std.base64(username + ":" + password)
3232
repeated HeaderValues add_headers = 5;
33+
34+
// Use HTTP/1.1, even if the server supports HTTP/2.
35+
//
36+
// This option can be used to work around HTTP client or server bugs.
37+
// For example, the following bug in Go's HTTP/2 client may cause
38+
// requests to be sent across network connections that are known to be
39+
// unresponsive, leading to request timeouts:
40+
//
41+
// https://github.com/golang/go/issues/36026
42+
// https://github.com/golang/go/issues/59690
43+
bool disable_http2 = 6;
3344
}
3445

3546
message ServerConfiguration {

0 commit comments

Comments
 (0)