[Python-bugs-list] [ python-Bugs-735248 ] urllib2 parse_http_list wrong return

SourceForge.net noreply@sourceforge.net
Fri, 09 May 2003 09:47:54 -0700


Bugs item #735248, was opened at 2003-05-09 14:09
Message generated for change (Settings changed) made by jhylton
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=735248&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jim Jewett (jimjjewett)
>Assigned to: Jeremy Hylton (jhylton)
Summary: urllib2 parse_http_list wrong return

Initial Comment:
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



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=735248&group_id=5470