Fixed issue where some headers would come through with only 1 character

This commit is contained in:
James Murphy 2016-02-18 12:43:43 +11:00
parent ba2bbffd20
commit 6885e19fd7

View File

@ -4,6 +4,7 @@ import logging
import time import time
import traceback import traceback
from six.moves.urllib.parse import urlencode from six.moves.urllib.parse import urlencode
from six import string_types
from autobahn.twisted.websocket import WebSocketServerProtocol, WebSocketServerFactory from autobahn.twisted.websocket import WebSocketServerProtocol, WebSocketServerFactory
@ -29,6 +30,9 @@ class WebSocketProtocol(WebSocketServerProtocol):
# Prevent CVE-2015-0219 # Prevent CVE-2015-0219
if "_" in name: if "_" in name:
continue continue
if isinstance(value, string_types):
clean_headers[name.lower()] = value.encode("latin1")
else:
clean_headers[name.lower()] = value[0].encode("latin1") clean_headers[name.lower()] = value[0].encode("latin1")
# Reconstruct query string # Reconstruct query string
# TODO: get autobahn to provide it raw # TODO: get autobahn to provide it raw