From f1c2a3b9f7e741828ccf837d10501a3afee27e70 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sat, 20 Feb 2016 22:48:17 +0000 Subject: [PATCH] Correctly send WebSocket headers --- daphne/ws_protocol.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daphne/ws_protocol.py b/daphne/ws_protocol.py index 8abdf44..f10508c 100755 --- a/daphne/ws_protocol.py +++ b/daphne/ws_protocol.py @@ -29,7 +29,7 @@ class WebSocketProtocol(WebSocketServerProtocol): # Prevent CVE-2015-0219 if "_" in name: continue - clean_headers[name.lower()] = value[0].encode("latin1") + clean_headers[name.lower()] = value.encode("latin1") # Reconstruct query string # TODO: get autobahn to provide it raw query_string = urlencode(request.params).encode("ascii") @@ -39,7 +39,7 @@ class WebSocketProtocol(WebSocketServerProtocol): self.main_factory.reply_protocols[self.reply_channel] = self # Make initial request info dict from request (we only have it here) self.request_info = { - "path": request.path, + "path": request.path.encode("ascii"), "headers": clean_headers, "query_string": query_string, "client": [self.transport.getPeer().host, self.transport.getPeer().port],