mirror of
https://github.com/django/daphne.git
synced 2024-11-22 07:56:34 +03:00
Fixed #110: Use raw WS query string rather than reconstructing it
This commit is contained in:
parent
2bcec3fe94
commit
6318bae452
|
@ -108,6 +108,8 @@ class WebRequest(http.Request):
|
||||||
self.setResponseCode(500)
|
self.setResponseCode(500)
|
||||||
logger.warn("Could not make WebSocket protocol")
|
logger.warn("Could not make WebSocket protocol")
|
||||||
self.finish()
|
self.finish()
|
||||||
|
# Give it the raw query string
|
||||||
|
protocol._raw_query_string = self.query_string
|
||||||
# Port across transport
|
# Port across transport
|
||||||
protocol.set_main_factory(self.factory)
|
protocol.set_main_factory(self.factory)
|
||||||
transport, self.transport = self.transport, None
|
transport, self.transport = self.transport, None
|
||||||
|
|
|
@ -42,9 +42,6 @@ class WebSocketProtocol(WebSocketServerProtocol):
|
||||||
if b"_" in name:
|
if b"_" in name:
|
||||||
continue
|
continue
|
||||||
self.clean_headers.append((name.lower(), value.encode("latin1")))
|
self.clean_headers.append((name.lower(), value.encode("latin1")))
|
||||||
# Reconstruct query string
|
|
||||||
# TODO: get autobahn to provide it raw
|
|
||||||
query_string = urlencode(request.params, doseq=True).encode("ascii")
|
|
||||||
# Make sending channel
|
# Make sending channel
|
||||||
self.reply_channel = self.main_factory.make_send_channel()
|
self.reply_channel = self.main_factory.make_send_channel()
|
||||||
# Tell main factory about it
|
# Tell main factory about it
|
||||||
|
@ -72,7 +69,7 @@ class WebSocketProtocol(WebSocketServerProtocol):
|
||||||
self.request_info = {
|
self.request_info = {
|
||||||
"path": self.unquote(self.path),
|
"path": self.unquote(self.path),
|
||||||
"headers": self.clean_headers,
|
"headers": self.clean_headers,
|
||||||
"query_string": self.unquote(query_string),
|
"query_string": self._raw_query_string, # Passed by HTTP protocol
|
||||||
"client": self.client_addr,
|
"client": self.client_addr,
|
||||||
"server": self.server_addr,
|
"server": self.server_addr,
|
||||||
"reply_channel": self.reply_channel,
|
"reply_channel": self.reply_channel,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user