mirror of
https://github.com/django/daphne.git
synced 2024-11-22 16:06:34 +03:00
Fixed issue where some headers would come through with only 1 character
This commit is contained in:
parent
ba2bbffd20
commit
6885e19fd7
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user