Disable HTTP/2 by default, do not use keepalive without http/2
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
DataHoarder 2022-01-18 10:16:11 +01:00
parent f73903d216
commit 307cc934bc

View file

@ -772,6 +772,8 @@ func main() {
debugOption := flag.Bool("debug", false, "Output debug information.")
http2Option := flag.Bool("http3", false, "Enable HTTP/2")
http3Option := flag.Bool("http3", false, "Enable HTTP/3")
signatureCacheLimitOption := flag.Int("siglimit", 4096, "Maximum number of lingering valid signature cache results.")
@ -872,7 +874,6 @@ func main() {
SessionTicketsDisabled: false,
Renegotiation: tls.RenegotiateFreelyAsClient,
NextProtos: []string{
"h2",
"http/1.1",
},
GetCertificate: func(info *tls.ClientHelloInfo) (*tls.Certificate, error) {
@ -883,6 +884,15 @@ func main() {
},
}
if *http2Option {
tlsConfig.NextProtos = []string{
"h2",
"http/1.1",
}
} else {
extraHeaders["Connection"] = "Close"
}
var wg sync.WaitGroup
wg.Add(1)
@ -897,14 +907,16 @@ func main() {
},
NoDefaultServerHeader: true,
NoDefaultDate: true,
DisableKeepalive: false,
TCPKeepalive: true,
DisableKeepalive: !*http2Option,
TCPKeepalive: *http2Option,
TLSConfig: tlsConfig,
}
http2.ConfigureServer(server, http2.ServerConfig{
Debug: false,
})
if *http2Option {
http2.ConfigureServer(server, http2.ServerConfig{
Debug: false,
})
}
log.Printf("Serving TCP on %s", *listenAddress)
ln, err := net.Listen("tcp", *listenAddress)