From e17e603588032a22ee3855a6f5d76d87c3735e0f Mon Sep 17 00:00:00 2001 From: Rachel Chen Date: Sun, 12 Sep 2021 21:36:21 -0700 Subject: [PATCH] cmd/server: handle empty NegotiatedProtocol with gateway --- cmd/server/main.go | 2 +- gateway/alpn.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/server/main.go b/cmd/server/main.go index 47b378c..2b13a95 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -163,7 +163,7 @@ func main() { alpnMux := gateway.NewALPNMux(logger, gMux) clientTLSListener := alpnMux.For("multiplexer") - gatewayListener := alpnMux.For("http/1.1") + gatewayListener := alpnMux.For("http/1.1", "") domain := bundle.Web.Domain if *gatewayPort != 443 { diff --git a/gateway/alpn.go b/gateway/alpn.go index b41d870..1cc8158 100644 --- a/gateway/alpn.go +++ b/gateway/alpn.go @@ -80,9 +80,11 @@ func (a *ALPN) Serve(ctx context.Context) { } } -func (a *ALPN) For(proto string) net.Listener { +func (a *ALPN) For(protos ...string) net.Listener { ch := make(chan net.Conn, 32) - a.protos.Store(proto, ch) + for _, proto := range protos { + a.protos.Store(proto, ch) + } return &protoListener{ l: a.listener, c: ch,