Issue 42975: urllib.parse.parse_qsl(): add an option to not consider semicolon (;) as separator - Python tracker
Python Home About News Documentation Downloads Community Foundation Developer's Guide Issue Tracker Issues Search Random Issue Summaries Issues with patch Easy issues Stats User Administration User List Committer List Help Tracker Documentation Tracker Development Report Tracker Problem Issue42975 ➜ This issue tracker has been migrated to GitHub , and is currently read-only . For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on 2021-01-20 10:52 by vstinner , last changed 2022-04-11 14:59 by admin . This issue is now closed . Messages (3) msg385327 - (view) Author: STINNER Victor (vstinner) * Date: 2021-01-20 10:52 urllib.parse.parse_qsl() uses "&" *and* ";" as separators: >>> urllib.parse.parse_qsl("a=1&b=2&c=3") [('a', '1'), ('b', '2'), ('c', '3')] >>> urllib.parse.parse_qsl("a=1&b=2;c=3") [('a', '1'), ('b', '2'), ('c', '3')] But the W3C standards evolved and now suggest against considering semicolon (";") as a separator: https://www.w3.org/TR/2014/REC-html5-20141028/forms.html#url-encoded-form-data "This form data set encoding is in many ways an aberrant monstrosity, the result of many years of implementation accidents and compromises leading to a set of requirements necessary for interoperability, but in no way representing good design practices.
In particular, readers are cautioned to pay close attention to the twisted details involving repeated (and in some cases nested) conversions between character encodings and byte sequences." "To decode application/x-www-form-urlencoded payloads (...) Let strings be the result of strictly splitting the string payload on U+0026 AMPERSAND characters (&)." Maybe we should even go further in Python 3.10 and only split at "&" by default, but let the caller to opt-in for ";" separator as well. msg385328 - (view) Author: Karthikeyan Singaravelan (xtreak) * Date: 2021-01-20 10:56 See also https://bugs.python.org/issue42967 msg385331 - (view) Author: STINNER Victor (vstinner) * Date: 2021-01-20 11:06 Oh, I mark my issue as a duplicate of bpo-42967 .
History Date User Action Args 2022-04-11 14:59:40 admin set github: 87141 2021-01-20 11:06:54 vstinner set status: open -> closed superseder: [CVE-2021-23336] urllib.parse.parse_qsl(): Web cache poisoning - `; ` as a query args separator messages: + msg385331 resolution: duplicate stage: resolved 2021-01-20 10:56:11 xtreak set nosy: + xtreak messages: + msg385328 2021-01-20 10:52:29 vstinner create Supported by The Python Software Foundation , Powered by Roundup Copyright © 1990-2022, Python Software Foundation Legal Statements