cgi.py?

D

david.tolpin

Hi,

I've looked into cgi.py from 2.4's distribution, and its contents
puzzle me. In parse_header, the first line splits on ';':

plist = map(lambda x: x.strip(), line.split(';'))

but header parameters may contain semicolon in quoted strings:

Content-Type: image/jpeg; filename="home:lib;images;face.jpg"

and headers like this one will be parsed incorrectly. A few subsequent
lines unquote a quoted value, but the only place where quoted-string
production is defined is RFC 3875, and there is no quote escaping in
the production (nor in any other draft or related RFC). So, even if the
former is fixed, the latter will still prevent headers like

Content-Type: text/plain; filename="c:\files\"; title="My Files"

from being parsed correctly. What am I missing?

David
 
S

Skip Montanaro

david> I've looked into cgi.py from 2.4's distribution, and its contents
david> puzzle me. In parse_header, the first line splits on ';':

david> plist = map(lambda x: x.strip(), line.split(';'))

david> but header parameters may contain semicolon in quoted strings:

david> Content-Type: image/jpeg; filename="home:lib;images;face.jpg"

...

david> What am I missing?

Probably nothing. Can you maybe submit a patch?

Thx,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,282
Latest member
RoseannaBa

Latest Threads

Top