Skip to content

cgi: parse_qs and parse_qsl misbehave on empty strings #45355

Closed

Description

@dljessup
mannequin
BPO 1014
Nosy @gvanrossum, @nirs, @orsenthil

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/gvanrossum'
closed_at = <Date 2007-09-17.21:15:48.854>
created_at = <Date 2007-08-24.20:54:35.094>
labels = ['extension-modules', 'type-bug']
title = 'cgi:  parse_qs and parse_qsl misbehave on empty strings'
updated_at = <Date 2007-09-17.21:15:48.852>
user = 'https://bugs.python.org/dljessup'

bugs.python.org fields:

activity = <Date 2007-09-17.21:15:48.852>
actor = 'gvanrossum'
assignee = 'gvanrossum'
closed = True
closed_date = <Date 2007-09-17.21:15:48.854>
closer = 'gvanrossum'
components = ['Extension Modules']
creation = <Date 2007-08-24.20:54:35.094>
creator = 'dljessup'
dependencies = []
files = []
hgrepos = []
issue_num = 1014
keywords = []
message_count = 6.0
messages = ['55274', '55309', '55727', '55728', '55977', '55983']
nosy_count = 4.0
nosy_names = ['gvanrossum', 'nirs', 'orsenthil', 'dljessup']
pr_nums = []
priority = 'normal'
resolution = 'wont fix'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue1014'
versions = ['Python 2.4']

Activity

  1. dljessup commented on Aug 24, 2007

    dljessupmannequin
    MannequinAuthor

    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_qs
        for name, value in parse_qsl(qs, keep_blank_values, strict_parsing):
      File "/usr/lib/python2.4/cgi.py", line 217, in parse_qsl
        raise ValueError, "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.

  2. orsenthil commented on Aug 26, 2007

    @orsenthil
    Member

    Can query strings be empty? I am unable to find an instance.

  3. nirs commented on Sep 7, 2007

    nirsmannequin
    Mannequin
  4. nirs commented on Sep 7, 2007

    nirsmannequin
    Mannequin

    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.

  5. orsenthil commented on Sep 17, 2007

    @orsenthil
    Member

    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

  6. gvanrossum commented on Sep 17, 2007

    @gvanrossum
    Member

    I don't see what the problem is. You requested strict_parsing=True, and
    this is what strict parsing does.

  7. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

extension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions