Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

urllib2 parse_http_list wrong return #38473

Closed
jimjjewett mannequin opened this issue May 9, 2003 · 3 comments
Closed

urllib2 parse_http_list wrong return #38473

jimjjewett mannequin opened this issue May 9, 2003 · 3 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@jimjjewett
Copy link
Mannequin

jimjjewett mannequin commented May 9, 2003

BPO 735248
Nosy @birkenfeld, @birkenfeld

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/birkenfeld'
closed_at = <Date 2005-08-24.22:21:15.000>
created_at = <Date 2003-05-09.14:09:12.000>
labels = ['library']
title = 'urllib2 parse_http_list wrong return'
updated_at = <Date 2005-08-24.22:21:15.000>
user = 'https://bugs.python.org/jimjjewett'

bugs.python.org fields:

activity = <Date 2005-08-24.22:21:15.000>
actor = 'georg.brandl'
assignee = 'georg.brandl'
closed = True
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2003-05-09.14:09:12.000>
creator = 'jimjjewett'
dependencies = []
files = []
hgrepos = []
issue_num = 735248
keywords = []
message_count = 3.0
messages = ['15937', '15938', '15939']
nosy_count = 4.0
nosy_names = ['georg.brandl', 'georg.brandl', 'jjlee', 'jimjjewett']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue735248'
versions = []

@jimjjewett
Copy link
Mannequin Author

jimjjewett mannequin commented May 9, 2003

parse_http_list should split a string on commas, unless
the commas are within a quoted-string. (It allows only
the "" quote, and not the single-quote, but this seems to
follow the RFC.)

If there are not quoted-strings, it repeats the first tokens
as part of subsequent tokens.

parse_http_list ('a,b') => ['a','a,b']
It should return ['a','b']

parse_http_list ('a,b,c') => ['a','a,b','a,b,c']
It should return ['a','b','c']

Patch: On (cvs version) line 882, when no quote is found
and inquote is false, reset the start position to after the
comma.

        if q == -1:
            if inquote:
                raise ValueError, "unbalanced quotes"
            else:
                list.append(s[start:i+c])
                i = i + c + 1
                start = i            #New line
                continue

@jimjjewett jimjjewett mannequin closed this as completed May 9, 2003
@jimjjewett jimjjewett mannequin assigned birkenfeld May 9, 2003
@jimjjewett jimjjewett mannequin added the stdlib Python modules in the Lib dir label May 9, 2003
@jimjjewett jimjjewett mannequin closed this as completed May 9, 2003
@jimjjewett jimjjewett mannequin assigned birkenfeld May 9, 2003
@jimjjewett jimjjewett mannequin added the stdlib Python modules in the Lib dir label May 9, 2003
@jjlee
Copy link
Mannequin

jjlee mannequin commented Nov 9, 2003

Logged In: YES
user_id=261020

This function doesn't deal with quoting of characters inside
quoted-strings, either. In particular, it doesn't deal with \", \\,
and \, (see RFC 2616, section 2.2, quoted-pair).

@birkenfeld
Copy link
Member

Logged In: YES
user_id=1188172

Fixed the algorithm in Lib/urllib2.py r1.86, 1.77.2.3
Added testcase in Lib/test/test_urllib2.py r1.22, 1.19.2.1

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

1 participant