From: Brandon Holbrook Date: Wed, 21 Feb 2018 02:22:54 +0000 (-0600) Subject: Only invoke select_subprotocol() when the client requests it X-Git-Tag: v5.1.0b1~44^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2282%2Fhead;p=thirdparty%2Ftornado.git Only invoke select_subprotocol() when the client requests it --- diff --git a/tornado/websocket.py b/tornado/websocket.py index 53832d2b1..5d66075d7 100644 --- a/tornado/websocket.py +++ b/tornado/websocket.py @@ -662,8 +662,7 @@ class WebSocketProtocol13(WebSocketProtocol): self.request.headers.get("Sec-Websocket-Key")) def _accept_connection(self): - subprotocols = self.request.headers.get("Sec-WebSocket-Protocol", '') - subprotocols = [s.strip() for s in subprotocols.split(',')] + subprotocols = [s.strip() for s in self.request.headers.get_list("Sec-WebSocket-Protocol")] if subprotocols: selected = self.handler.select_subprotocol(subprotocols) if selected: