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.

Unsupported provider

classification
Title: urllib2 parse_http_list wrong return
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, georg.brandl, jimjjewett, jjlee
Priority: normal Keywords:

Created on 2003-05-09 14:09 by jimjjewett, last changed 2022-04-10 16:08 by admin. This issue is now closed.

Messages (3)
msg15937 - (view) Author: Jim Jewett (jimjjewett) Date: 2003-05-09 14:09
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

msg15938 - (view) Author: John J Lee (jjlee) Date: 2003-11-09 23:53
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). 
msg15939 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-08-24 22:21
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
History
Date User Action Args
2022-04-10 16:08:40adminsetgithub: 38473
2003-05-09 14:09:12jimjjewettcreate