Conversion problem in parse_multipart
Michele Belloli
mkbelloli at libero.it
Sat Oct 4 05:09:21 EDT 2003
More information about the Python-list mailing list
Sat Oct 4 05:09:21 EDT 2003
- Previous message (by thread): slowdown on looping
- Next message (by thread): Conversion problem in parse_multipart
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, 01 Oct 2003 20:23:56 -0700, Tim Roberts <timr at probo.com> wrote: >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. > I read cgi.py, in particular 'parse_multipart'; and I repeated each command in a python shell. It works fine. I use the same version (2.2.3) in Python shell and web server but I obtain two different behaviuors. >>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? > I noticed a bug displaying the hex results using 'print' statement too, so I created a binary file (using 'wb' flags) and write down results. Then, I read it using an hex-editor. Reading file, I tought 'write' method could modify result like 'print' statement do. So I used a simple conditional statement. if result =='\x2e': file.write(.....) Both test in cgi.parse_mulitpart shows the problem. >What operating system and what web server? W2K and python web server using SimpleHTTPServer classes Thanks
- Previous message (by thread): slowdown on looping
- Next message (by thread): Conversion problem in parse_multipart
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list