You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cgi: parse_qs and parse_qsl misbehave on empty strings #45355
In Python 2.4.4, cgi.parse_qs(qs='', strict_parsing=True) errors out:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/cgi.py", line 183, in parse_qsfor name, value in parse_qsl(qs, keep_blank_values, strict_parsing):
File "/usr/lib/python2.4/cgi.py", line 217, in parse_qslraiseValueError, "bad query field: %r"% (name_value,)
ValueError: bad query field: ''
To the best of my knowledge, this is bad behavior, since a large
percentage of URLs actually used have empty query strings.
Addionally, if the default value is empty string, you expect it work with
empty string. If a non empty value is needed, it would use None as the
default.
Activity
dljessup commentedon Aug 24, 2007
In Python 2.4.4, cgi.parse_qs(qs='', strict_parsing=True) errors out:
To the best of my knowledge, this is bad behavior, since a large
percentage of URLs actually used have empty query strings.
orsenthil commentedon Aug 26, 2007
Can query strings be empty? I am unable to find an instance.
nirs commentedon Sep 7, 2007
Here is one: http://example.com/foo?
nirs commentedon Sep 7, 2007
Addionally, if the default value is empty string, you expect it work with
empty string. If a non empty value is needed, it would use None as the
default.
orsenthil commentedon Sep 17, 2007
Hi Sean,
This is a very minor issue (IMO) with Python 2.4. Why did you assign it
to gvanrossum?
Makes me wonder at your assignments.
Thanks,
Senthil
gvanrossum commentedon Sep 17, 2007
I don't see what the problem is. You requested strict_parsing=True, and
this is what strict parsing does.