Conversion problem in parse_multipart

Tim Roberts timr at probo.com
Wed Oct 1 23:23:56 EDT 2003


Michele Belloli <mkbelloli at libero.it> wrote:
>
>I have a problem uploading a file to a web server.
>
>I created an html page with a multipart/form-data form and used
>cgi.parse_multipart function to obtain form data (and obviuosly
>uploaded file).
>I noticed that if I upload an excutable file, I obtain a file where
>0x0a 0x0a, are converted in 0x0a and 0x2e.
>Obviously this file is corrupted.

Are you sure?  We had something similar reported just a few weeks ago where
the bug turned out to be in the program displaying the hex results; the
binary file was just fine.

I have used cgi.py to handle large file uploads literally tens of thousands
of times, and never had one go bad.

>Analyzing the  file before cgi.parse_multipart, it's possible to
>verify that it's correct but when this function tries to extract its
>value, 0x0a 0x0a are converted in 0x0a and 02e.

How are you determining this?  That is, how are you accessing the final
data?

What operating system and what web server?
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.




More information about the Python-list mailing list