469,917 Members | 1,848 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

cgi.py?

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

Jul 19 '05 #1
1 1145

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,

--
Skip Montanaro
sk**@pobox.com
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by William C. White | last post: by
2 posts views Thread by Albert Ahtenberg | last post: by
3 posts views Thread by James | last post: by
reply views Thread by Ollivier Robert | last post: by
1 post views Thread by Richard Galli | last post: by
4 posts views Thread by Albert Ahtenberg | last post: by
1 post views Thread by inderjit S Gabrie | last post: by
2 posts views Thread by Jack | last post: by
3 posts views Thread by Sandwick | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.