From: Geoffrey T. <gta...@na...> - 2004-05-20 13:48:28
|
Kenneth Brown wrote: > This is driving me swiftly insane. > > I'm working on a page that uploads images. I've tried a few ways of > pulling the file data out of the request and writing it to > disk, but it > always ends up corrupted and/or truncated (I'm not sure which) > > The form sets enctype="multipart/form-data". The input in the form is > named "file". > > Here's a condensed version of the code I'm currently trying: > > uploadedFile = self.request().field("file", None).file > uploadedFile.seek(0) fileContents = uploadedFile.read() > file("/tmp/file.jpg", 'wb').write(fileContents) > > I've tried a while loop that read line by line, pulling the string out > of the FieldStorage object, nothing seems to work. > > I'm uploading from Opera 7.23, though I've tried Mozilla as well. I'm > running Webware 8.1 with the apache2 adapter. > > Any ideas? > > -Ken Brown I can't get this to fail on Windows, but I do see some suspicious-looking code in WebKit/Adapters/mod_webkit2/mod_webkit.c. This loop at line 391: do { aprlen=len; rv = apr_send(aprsock, data, &aprlen); len = len-aprlen; } while (len >0 && rv==APR_SUCCESS); seems broken because if the apr_send is unable to send the whole length of data at once, it will try to resend from the beginning of the data instead of advancing the pointer by the amount sent. This would result in a small block of repeated data which is exactly what you're seeing. Try this and see if it helps: do { aprlen=len; rv = apr_send(aprsock, data, &aprlen); len = len-aprlen; data += aprlen; } while (len >0 && rv==APR_SUCCESS); - Geoff |
From: Geoffrey T. <gta...@na...> - 2004-05-21 22:06:58
|
I will take care of it, but not until sometime next week. In the meantime if you are using Windows you are probably OK, because I was unable to provoke the problem myself despite a lot of testing. The problem will only happen if mod_webkit2 is unable to send a whole chunk of input data at once over the socket to the appserver, and that never seems to happen on Windows, perhaps because of the way sockets work in Windows. It's still definitely a bug that needs to be fixed. Also, I took a peek at the Apache 1.3.X version of mod_webkit and that appears to not suffer from this bug at all. - Geoff jose wrote: > Is there any plans to recompile the windows mod_webkit.dll in the cvs > with these changes? > > Jose > > > -----Original Message----- > From: web...@li... > [mailto:web...@li...] On > Behalf Of Oliver > Bock > Sent: Thursday, May 20, 2004 4:33 PM > To: Geoffrey Talvola > Cc: web...@li... > Subject: Re: [Webware-discuss] Image Upload Issue > > > On 20/05/2004, at 23:48, Geoffrey Talvola wrote: >> Kenneth Brown wrote: >>> This is driving me swiftly insane. >>> >>> I'm working on a page that uploads images. I've tried a few ways of >>> pulling the file data out of the request and writing it to disk, but >>> it always ends up corrupted and/or truncated (I'm not sure which) >>> ... >> >> I can't get this to fail on Windows, but I do see some >> suspicious-looking code in WebKit/Adapters/mod_webkit2/mod_webkit.c. >> >> This loop at line 391: >> >> do { >> aprlen=len; >> rv = apr_send(aprsock, data, &aprlen); >> len = len-aprlen; >> } while (len >0 && rv==APR_SUCCESS); >> >> seems broken because if the apr_send is unable to send the whole >> length of data at once, it will try to resend from the beginning of >> the data instead of advancing the pointer by the amount sent. This >> would result in a small block of repeated data which is exactly what >> you're seeing. > Try this >> and >> see if it helps: >> >> do { >> aprlen=len; >> rv = apr_send(aprsock, data, &aprlen); >> len = len-aprlen; >> data += aprlen; >> } while (len >0 && rv==APR_SUCCESS); >> >> - Geoff > > Brilliant, Geoff! This has fixed upload corruption on my system. > Hopefully it will also fix the intermittent lockups that I'm getting > too, but I won't know for a few weeks. > > I guess that you'll stick this in CVS. I'm to risk-averse to use CVS > so I'm running 0.8.1. > > > Regards, > > Oliver > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... > Oracle 10g. > > Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click > _______________________________________________ > Webware-discuss mailing list Web...@li... > https://lists.sourceforge.net/lists/listinfo/webware-discuss |
From: Oliver B. <ol...@g7...> - 2004-05-20 23:33:04
|
On 20/05/2004, at 23:48, Geoffrey Talvola wrote: > Kenneth Brown wrote: >> This is driving me swiftly insane. >> >> I'm working on a page that uploads images. I've tried a few ways of >> pulling the file data out of the request and writing it to >> disk, but it >> always ends up corrupted and/or truncated (I'm not sure which) >> ... > > I can't get this to fail on Windows, but I do see some > suspicious-looking > code in WebKit/Adapters/mod_webkit2/mod_webkit.c. > > This loop at line 391: > > do { > aprlen=len; > rv = apr_send(aprsock, data, &aprlen); > len = len-aprlen; > } while (len >0 && rv==APR_SUCCESS); > > seems broken because if the apr_send is unable to send the whole > length of > data at once, it will try to resend from the beginning of the data > instead > of advancing the pointer by the amount sent. This would result in a > small > block of repeated data which is exactly what you're seeing. Try this > and > see if it helps: > > do { > aprlen=len; > rv = apr_send(aprsock, data, &aprlen); > len = len-aprlen; > data += aprlen; > } while (len >0 && rv==APR_SUCCESS); > > - Geoff Brilliant, Geoff! This has fixed upload corruption on my system. Hopefully it will also fix the intermittent lockups that I'm getting too, but I won't know for a few weeks. I guess that you'll stick this in CVS. I'm to risk-averse to use CVS so I'm running 0.8.1. Regards, Oliver |
From: jose <jo...@cy...> - 2004-05-21 05:15:04
|
Is there any plans to recompile the windows mod_webkit.dll in the cvs with these changes? Jose -----Original Message----- From: web...@li... [mailto:web...@li...] On Behalf Of Oliver Bock Sent: Thursday, May 20, 2004 4:33 PM To: Geoffrey Talvola Cc: web...@li... Subject: Re: [Webware-discuss] Image Upload Issue On 20/05/2004, at 23:48, Geoffrey Talvola wrote: > Kenneth Brown wrote: >> This is driving me swiftly insane. >> >> I'm working on a page that uploads images. I've tried a few ways of >> pulling the file data out of the request and writing it to disk, but >> it always ends up corrupted and/or truncated (I'm not sure which) >> ... > > I can't get this to fail on Windows, but I do see some > suspicious-looking > code in WebKit/Adapters/mod_webkit2/mod_webkit.c. > > This loop at line 391: > > do { > aprlen=len; > rv = apr_send(aprsock, data, &aprlen); > len = len-aprlen; > } while (len >0 && rv==APR_SUCCESS); > > seems broken because if the apr_send is unable to send the whole > length of > data at once, it will try to resend from the beginning of the data > instead > of advancing the pointer by the amount sent. This would result in a > small > block of repeated data which is exactly what you're seeing. Try this > and > see if it helps: > > do { > aprlen=len; > rv = apr_send(aprsock, data, &aprlen); > len = len-aprlen; > data += aprlen; > } while (len >0 && rv==APR_SUCCESS); > > - Geoff Brilliant, Geoff! This has fixed upload corruption on my system. Hopefully it will also fix the intermittent lockups that I'm getting too, but I won't know for a few weeks. I guess that you'll stick this in CVS. I'm to risk-averse to use CVS so I'm running 0.8.1. Regards, Oliver ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click _______________________________________________ Webware-discuss mailing list Web...@li... https://lists.sourceforge.net/lists/listinfo/webware-discuss |