From 17f407278f13d5b99ca2aebf2102392f5a8fd617 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Thu, 20 Oct 2022 11:04:56 +0300 Subject: [PATCH] Fixes subprotocol selection (aling with rfc6455) --- server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.go b/server.go index 3e3826b..ff7d03a 100644 --- a/server.go +++ b/server.go @@ -101,8 +101,8 @@ func checkSameOrigin(r *http.Request) bool { func (u *Upgrader) selectSubprotocol(r *http.Request, responseHeader http.Header) string { if u.Subprotocols != nil { clientProtocols := Subprotocols(r) - for _, serverProtocol := range u.Subprotocols { - for _, clientProtocol := range clientProtocols { + for _, clientProtocol := range clientProtocols { + for _, serverProtocol := range u.Subprotocols { if clientProtocol == serverProtocol { return clientProtocol }