|
From: Seth B. <se...@ge...> - 2003-05-14 06:58:45
|
This is followup. Any braniacs out there that might be able to fix this?
The short story:
-----------------
uploading compressed binary files from within webware 8.0 corrupts the uploaded file
How do I know?
--------------
I use cgi.py in a non-webkit cgi file to upload the exact same file without problem.
The paper trail
---------------
webkit servlet calls multipart/form-data
<-- WebKit/HTTPRequest.py
<-- WebUtils/FieldStorage
<-- cgi.py
I believe what is happening is that in WebUtils/FieldStorage, "def parse_qs" uses urllib.unquote which alters the GET string and the content of the file. It doesnt appear to matter to text files. Only compressed binary files (bzip2,gzip) seem to get corrupted. def parse_qs in WebUtils/FieldStorage.py overrides cgi.py's and the original which does not use urllib. I'm also using compressed files > 3MB. Occasionally smaller .gz files will pass uncorrupted.
I'd be happy to send actual test files to anyone who thinks they can resolve this.
Thanks to <be...@we...> for the previous private response. Yes I did try to use your method without success.
my machine:
------------
[3][149][me] CMS :) uname -a
Linux localhost.localdomain 2.4.18-6mdk #1 Thu Mar 28 22:32:10 EST 2002 i686 unknown
On Sun, 30 Mar 2003 16:11:07 -0800
Seth Birkholz <se...@ge...> wrote:
> I'm getting corrupted files when I upload them. Does this sound familiar to anybody? Is this a webkit thing?
>
> When it happens:
> ================
> Not for a small file (L.tgz ~ 30KB) but not for a larger one.
> It happens when I use apache or AppServer.
> It happens whether I use Opera or Mozilla.
>
>
> The source file and the uploaded file are exactly the same size, but when I compare the two files byte by byte they are different starting at about 60KB.
>
> Very confusing. I've spent about a day searching the web for clues without success. Help! Clues?
>
>
> CODE
> ======================
> submit snippet
> ---------
> self.p('<br><input type="hidden" name="MAX_FILE_SIZE" value="1000000000">')
> self.p('<FORM ACTION="%s" method="POST" enctype="multipart/form-data">' % self.url)
>
>
> Import.py snippet (ignore spaces and tabs here)
> -----------
> inputfile = self.request().field(var)
> fin=inputfile.file
> fout=open("/tmp/out.tgz",'wb')
>
> def readBinary(fpin,fpout):
> bufsize = 8*1024 # I/O buffering size for copy to file
> fpin.seek(0)
> while 1:
> data = fpin.read(bufsize)
> if not data:
> fpin.close()
> break
> fpout.write(data)
> fpout.flush()
>
> readBinary(fin,fout)
> fout.close()
>
> my machine:
> ------------
> [3][149][me] CMS :) uname -a
> Linux localhost.localdomain 2.4.18-6mdk #1 Thu Mar 28 22:32:10 EST 2002 i686 unknown
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: ValueWeb:
> Dedicated Hosting for just $79/mo with 500 GB of bandwidth!
> No other company gives more support or power for your dedicated server
> http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
> _______________________________________________
> Webware-discuss mailing list
> Web...@li...
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
>
---
Seth Birkholz
1-510-521-3441 (home)
http://www.geniewink.com
se...@ge...
|