From f7b7ad5c1066bdcc551775b73da15dca5c111623 Mon Sep 17 00:00:00 2001 From: meejah Date: Fri, 18 Dec 2020 10:47:30 -0700 Subject: [PATCH] URL must be re-encoded when doing redirect (#1439) --- autobahn/websocket/protocol.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/autobahn/websocket/protocol.py b/autobahn/websocket/protocol.py index 8202f2c60..457313c29 100755 --- a/autobahn/websocket/protocol.py +++ b/autobahn/websocket/protocol.py @@ -58,6 +58,7 @@ from autobahn.util import _maybe_tls_reason import txaio +import hyperlink __all__ = ("WebSocketProtocol", @@ -2646,7 +2647,8 @@ def processHandshake(self): # # https://localhost:9000/?redirect=https%3A%2F%2Ftwitter.com%2F&after=3 # - url = self.http_request_params['redirect'][0] + url = hyperlink.URL.from_text(self.http_request_params['redirect'][0]) + url = url.to_uri().normalize().to_text() if 'after' in self.http_request_params and len(self.http_request_params['after']) > 0: after = int(self.http_request_params['after'][0]) self.log.debug(