You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by Graham Dumpleton <gr...@dscpl.com.au> on 2006/04/06 08:22:31 UTC

FieldStorage and multiline headers in multipart/form.

With FieldStorage being discussed on main user mailing list, came across
this old post of the mailing list:

  http://www.modpython.org/pipermail/mod_python/2001-November/012256.html

What it is saying is that some HTTP clients use multi line headers in sections
of multipart/form postings and that mod_python doesn't handle this.

Looking at FieldStorage code, which I don't grok right at this minute
because of an intensive coding frenzy today on the back of not enough
sleep last night, I can't see that it has ever been modified to accomodate
such multiline headers if indeed it needs to.

Anyone who is more intimate with FieldStorage code want to have a
better look at validity of original mailing list post and whether multiline
headers are legitimate and whether there indeed could be a problem in
mod_python.

Graham

Re: FieldStorage and multiline headers in multipart/form.

Posted by Nick <ni...@dd.revealed.net>.
Mike Looijmans wrote:
> Just a thought: Can we (re)use the rfc822 mime parser that's already
> built-in in Python to do the work for us?

I believe the standard cgi module does just that.  I'm probably going to
hell for having been importing cgi and replacing parse_qs[l] with the
versions from _apache.

Nick

Re: FieldStorage and multiline headers in multipart/form.

Posted by Mike Looijmans <nl...@natlab.research.philips.com>.
Short answer: Yes, multiline headers are allowed there, and yes, 
mod_python will fail to read them properly.

Longer answer:
I checked throught the util.py code, and nope, the fix is not in there.

I browsed through the appropriate RFC documents, in particular RFC1521
http://www.faqs.org/rfcs/rfc1521.html
This clearly states that RFC822 headers are to be used, which means that 
  those multiline headers are indeed allowed. The 1521 document even 
contains samples with multiline headers.

Just a thought: Can we (re)use the rfc822 mime parser that's already 
built-in in Python to do the work for us?

--
Mike Looijmans
Philips Natlab / Topic Automation


Graham Dumpleton wrote:
> With FieldStorage being discussed on main user mailing list, came across
> this old post of the mailing list:
> 
>   http://www.modpython.org/pipermail/mod_python/2001-November/012256.html
> 
> What it is saying is that some HTTP clients use multi line headers in sections
> of multipart/form postings and that mod_python doesn't handle this.
> 
> Looking at FieldStorage code, which I don't grok right at this minute
> because of an intensive coding frenzy today on the back of not enough
> sleep last night, I can't see that it has ever been modified to accomodate
> such multiline headers if indeed it needs to.
> 
> Anyone who is more intimate with FieldStorage code want to have a
> better look at validity of original mailing list post and whether multiline
> headers are legitimate and whether there indeed could be a problem in
> mod_python.
> 
> Graham


Re: FieldStorage and multiline headers in multipart/form.

Posted by Jim Gallacher <jp...@jgassociates.ca>.
I'll take a look at the code tonight.

Jim

Graham Dumpleton wrote:
> With FieldStorage being discussed on main user mailing list, came across
> this old post of the mailing list:
> 
>   http://www.modpython.org/pipermail/mod_python/2001-November/012256.html
> 
> What it is saying is that some HTTP clients use multi line headers in sections
> of multipart/form postings and that mod_python doesn't handle this.
> 
> Looking at FieldStorage code, which I don't grok right at this minute
> because of an intensive coding frenzy today on the back of not enough
> sleep last night, I can't see that it has ever been modified to accomodate
> such multiline headers if indeed it needs to.
> 
> Anyone who is more intimate with FieldStorage code want to have a
> better look at validity of original mailing list post and whether multiline
> headers are legitimate and whether there indeed could be a problem in
> mod_python.
> 
> Graham
>