Correctly send WebSocket headers

This commit is contained in:
Andrew Godwin 2016-02-20 22:48:17 +00:00
parent ba2bbffd20
commit f1c2a3b9f7

View File

@ -29,7 +29,7 @@ class WebSocketProtocol(WebSocketServerProtocol):
# Prevent CVE-2015-0219 # Prevent CVE-2015-0219
if "_" in name: if "_" in name:
continue continue
clean_headers[name.lower()] = value[0].encode("latin1") clean_headers[name.lower()] = value.encode("latin1")
# Reconstruct query string # Reconstruct query string
# TODO: get autobahn to provide it raw # TODO: get autobahn to provide it raw
query_string = urlencode(request.params).encode("ascii") query_string = urlencode(request.params).encode("ascii")
@ -39,7 +39,7 @@ class WebSocketProtocol(WebSocketServerProtocol):
self.main_factory.reply_protocols[self.reply_channel] = self self.main_factory.reply_protocols[self.reply_channel] = self
# Make initial request info dict from request (we only have it here) # Make initial request info dict from request (we only have it here)
self.request_info = { self.request_info = {
"path": request.path, "path": request.path.encode("ascii"),
"headers": clean_headers, "headers": clean_headers,
"query_string": query_string, "query_string": query_string,
"client": [self.transport.getPeer().host, self.transport.getPeer().port], "client": [self.transport.getPeer().host, self.transport.getPeer().port],