urlencode now handles parse_qs encoding correctly.

The autobahn websocket protocol.py line 2487 uses parse_qs(query) which always returns a list as a return value.
For example:
urllib.parse.parse_qs('room=test') returns {'room': ['test']}. 
In order to parse it correctly later, doseq for urlencode must be set to True.
This commit is contained in:
erikash 2016-02-28 16:36:19 +02:00
parent 7b83471e6c
commit 238e75cbd3

View File

@ -33,7 +33,7 @@ class WebSocketProtocol(WebSocketServerProtocol):
clean_headers[name.lower()] = value.encode("latin1")
# Reconstruct query string
# TODO: get autobahn to provide it raw
query_string = urlencode(request.params).encode("ascii")
query_string = urlencode(request.params, doseq=True).encode("ascii")
# Make sending channel
self.reply_channel = self.channel_layer.new_channel("!websocket.send.?")
# Tell main factory about it