Skip to content

Commit 62195c7

Browse files
authored
Merge pull request #116 from SenseUnit/h2c_server
Enable h2c server support
2 parents 6293187 + 870c4d7 commit 62195c7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Simple, scriptable, secure forward proxy.
2323
* Optional local in-memory inner cache
2424
* Optional AEAD encryption layer for cache
2525
* Per-user bandwidth limits
26-
* HTTP/2 support
26+
* HTTP/2 support, both server and client, including h2c support
2727
* Optional DNS cache
2828
* Resilient to DPI (including active probing, see `hidden_domain` option for authentication providers)
2929
* Connecting via upstream HTTP(S)/SOCKS5 proxies (proxy chaining)

main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,11 +486,17 @@ func run() int {
486486
ReadHeaderTimeout: args.reqHeaderTimeout,
487487
WriteTimeout: 0,
488488
IdleTimeout: 0,
489+
Protocols: new(http.Protocols),
489490
}
490491

491492
// listener setup
492493
if args.disableHTTP2 {
493494
server.TLSNextProto = make(map[string]func(*http.Server, *tls.Conn, http.Handler))
495+
server.Protocols.SetHTTP1(true)
496+
} else {
497+
server.Protocols.SetHTTP1(true)
498+
server.Protocols.SetHTTP2(true)
499+
server.Protocols.SetUnencryptedHTTP2(true)
494500
}
495501

496502
mainLogger.Info("Starting proxy server...")

0 commit comments

Comments
 (0)