Title: error on parsing/handling content-disposition
Type: Stage:
Components: Library (Lib) Versions: Python 2.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: holtwick, jimjjewett, terry.reedy, zindel
Priority: normal Keywords:

Created on 2006-08-15 10:31 by holtwick, last changed 2010-08-03 18:26 by terry.reedy. This issue is now closed.

File name Uploaded Description Edit holtwick, 2006-08-15 10:31 Patch with example for zindel, 2008-07-28 15:05 patch for with the test example
Messages (4)
msg29520 - (view) Author: Dirk Holtwick (holtwick) Date: 2006-08-15 10:31
A header like this one containing a ";" and blanks in
the content disposition fails:

Content-Disposition: form-data; name="_media";
filename="Demo; 28.07.2006.jpg"

The cause is, that the function parse_header() first
splits the line by ";" and then begins to analize these
parts. The part "filename" in our example is then split
into two separate parts. 

I wrote a fix for the function parse_header(). It isn't
still complete, because escaped '"' on the end of line
are not respected, but in most cases it helps.
msg29521 - (view) Author: Jim Jewett (jimjjewett) Date: 2006-08-16 15:50
Logged In: YES 

The test is good.
The corner case is misses would also be a good test.

I'm wondering whether a better fix might be to put parsing-
around-quotes in a common library, and import it from 
there; these problems keep coming up, particularly in the 
web-related modules.

msg70351 - (view) Author: Oleksiy Golovko (zindel) Date: 2008-07-28 15:05
Here is the another patch for this issue.
msg112647 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-08-03 18:26
With 3.1.2, cgi.parse_header gives the same correct response as cgtest.parse_header, so I will assume that the same is true in 2.7 until demonstrated otherwise.
Date User Action Args
2010-08-03 18:26:23terry.reedysetstatus: open -> closed

nosy: + terry.reedy
messages: + msg112647

resolution: fixed
2008-07-28 15:05:51zindelsetfiles: +
nosy: + zindel
messages: + msg70351
title: error on parsing/handling content-disposition -> error on parsing/handling content-disposition
2006-08-15 10:31:58holtwickcreate