From 751f38ba4a09c38bbfaa262dac4e82b27a162869 Mon Sep 17 00:00:00 2001 From: Philip Howard Date: Mon, 8 Aug 2022 13:41:21 +0100 Subject: [PATCH] server.py:_parse_query_string: split only on first "=" Since form data is not URL encoded it may contain raw "=" characters. Limit the key/value pair split only to the *first* occurrence of "=". Signed-off-by: Philip Howard --- phew/server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phew/server.py b/phew/server.py index 1bd09fa..720ac50 100644 --- a/phew/server.py +++ b/phew/server.py @@ -31,7 +31,7 @@ def urldecode(text): def _parse_query_string(query_string): result = {} for parameter in query_string.split("&"): - key, value = parameter.split("=") + key, value = parameter.split("=", 1) key = urldecode(key) value = urldecode(value) result[key] = value @@ -352,4 +352,4 @@ def run(host = "0.0.0.0", port = 80): loop = uasyncio.get_event_loop() loop.create_task(uasyncio.start_server(_handle_request, host, port)) - loop.run_forever() \ No newline at end of file + loop.run_forever()