(I didn't intend for this post to be so long, so here's a summary: I
made upload handling cleaner and more correct, but still need to make
sure that it takes care of the upload problem).
Bob, all, thanks for plugging in to fix some of these nasty bugs.
I finally got around to spend some serious time on the uploads stuff,
and it appears I may have found at least one fix, perhaps to the
problems we haven't experienced (or maybe it solves the ones we know).
Here's how to reproduce a situation that led me to realize what could
be wrong:
Comanche preferences at: #suppressError put: false
Now, if you don't check for #dataAvailable in #getSubHeader, you'll
get an error, 'getData time out'. Why? Because MSIE tries to keep the
connection alive AND the #getSubHeader code goes until the end of the
socket stream(*), which is never reached (since we only check for
socket being connected). So how does the upload code ever stop?
(Actually, without checking for #dataAvailable, it doesn't - kind of)
There's a nasty loop that keeps reading headers of the parts, and when
it fails to read one (because there's no more data), processing stops.
(I think Stephen Pair had this one actually fixed, but since I used a
slightly different implementation of the SocketStream, plus we had
somewhat divergent multipart handling - neither was complete at the
time, because of all that, it took until now to fix(**) this).
I re-wrote MultipartFormModule (which was pretty much the same code as
UploadSwiki for PWS) to keep track of the amount of incoming data, so
that it stops when it reads in enough to cover contentLength.
Having said that, I'm not entirely sure this fixes the uploads problem
observed on Minnow (and a few other servers), this is still up for
testing.
And a bit of future plans: per Je77's request, I may be folding the
multipart form support into the HttpRequest (which makes more than
zero sense only after refactoring).
_______
(*) I still need to go through all SocketStream code, most notably,
checking for #atEnd condition.
The reason I had #dataAvailable was the long wait (for data that is
not there) in the browser after upload.
(**) The fix only ensures we read exactly as much as we're supposed to
Also, it stops using SocketStream as an entity aware of protocols.