From 39f46ce2087a1fdf552c9823802f33e16948bc22 Mon Sep 17 00:00:00 2001 From: Brandon Holbrook Date: Tue, 20 Feb 2018 20:22:54 -0600 Subject: [PATCH] Only invoke select_subprotocol() when the client requests it --- tornado/websocket.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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: -- 2.47.2