Skip to content

Commit

Permalink
cmd/server: handle empty NegotiatedProtocol with gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
zllovesuki committed Sep 13, 2021
1 parent aa09d60 commit e17e603
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions gateway/alpn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e17e603

Please sign in to comment.