Skip to content

Commit

Permalink
server.py:_parse_query_string: split only on first "="
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Gadgetoid authored Aug 8, 2022
1 parent 29909a5 commit 751f38b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions phew/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
loop.run_forever()

0 comments on commit 751f38b

Please sign in to comment.