interop: fix server setup for the HTTP/0.9 server (#4658)

This commit is contained in:
Marten Seemann
2024-09-03 17:14:53 +08:00
committed by GitHub
parent 26a3525337
commit 135b8c0e75
3 changed files with 11 additions and 18 deletions

View File

@@ -15,8 +15,6 @@ import (
"github.com/quic-go/quic-go/interop/utils"
)
var tlsConf *tls.Config
func main() {
logFile, err := os.Create("/logs/log.txt")
if err != nil {
@@ -46,20 +44,22 @@ func main() {
fmt.Println(err)
os.Exit(1)
}
tlsConf = &tls.Config{
tlsConf := &tls.Config{
Certificates: []tls.Certificate{cert},
KeyLogWriter: keyLog,
NextProtos: []string{http09.NextProto},
}
switch testcase {
case "versionnegotiation", "handshake", "retry", "transfer", "resumption", "multiconnect", "zerortt":
err = runHTTP09Server(quicConf, testcase == "retry")
err = runHTTP09Server(tlsConf, quicConf, testcase == "retry")
case "chacha20":
reset := qtls.SetCipherSuite(tls.TLS_CHACHA20_POLY1305_SHA256)
defer reset()
err = runHTTP09Server(quicConf, false)
err = runHTTP09Server(tlsConf, quicConf, false)
case "http3":
err = runHTTP3Server(quicConf)
tlsConf.NextProtos = []string{http3.NextProtoH3}
err = runHTTP3Server(tlsConf, quicConf)
default:
fmt.Printf("unsupported test case: %s\n", testcase)
os.Exit(127)
@@ -71,7 +71,7 @@ func main() {
}
}
func runHTTP09Server(quicConf *quic.Config, forceRetry bool) error {
func runHTTP09Server(tlsConf *tls.Config, quicConf *quic.Config, forceRetry bool) error {
http.DefaultServeMux.Handle("/", http.FileServer(http.Dir("/www")))
server := http09.Server{}
@@ -94,7 +94,7 @@ func runHTTP09Server(quicConf *quic.Config, forceRetry bool) error {
return server.ServeListener(ln)
}
func runHTTP3Server(quicConf *quic.Config) error {
func runHTTP3Server(tlsConf *tls.Config, quicConf *quic.Config) error {
server := http3.Server{
Addr: ":443",
TLSConfig: tlsConf,