Menu

#6 IE 6.0 upload problem

open
nobody
None
5
2003-02-26
2003-02-26
Jason Pell
No

Jason:

We have been tracing a very weird bug for quite a while
and have finally
found the issue. Please see the following two postings
regarding two
separate bugs with dumb @#$$%&^@#! IE browsers.

http://bugs.php.net/bug.php?id=18792

and

http://www.servlets.com/blog/archives/000032.html
(Look at the first
comment by user alim)

Based on these two problems, may I propose the
following two changes to the
code:

In initParser(...) determine the strBoundary as:

strBoundary = null;
if (strContentTypeText!=null &&
strContentTypeText.toLowerCase().startsWith("multipart/form-data"))
{
// This is done to handle IE and netscape
proxies incorrectly
setting the boundary
// (for this bug see
http://bugs.php.net/bug.php?id=18792\)
int startNdx =
strContentTypeText.indexOf("boundary=");
if (startNdx >= 0) {
int endNdx =
strContentTypeText.indexOf(",",startNdx+9);
if (endNdx < 0)
strBoundary =
strContentTypeText.substring(startNdx+9);
else
strBoundary =
strContentTypeText.substring(startNdx+9,endNdx);
strBoundary = strBoundary.trim();
}
}

if (strBoundary == null) {
// <mtl,jpell>
debug("ContentType = " + strContentTypeText);
throw new IllegalArgumentException("Invalid
Content Type.");
}

And then at the beginning of parse(..)

// Must be boundary at top of loop, otherwise
we have finished.
// However, lovely IE 6.0 wigs out with some
strange chars in the
form fields
boolean foundFirstBoundary = false;
while ((read=readLine(in, blockOfBytes)) > 0) {
strLine = (read>0)? new
String(blockOfBytes, 0, read,
charEncoding): null;
if (strLine!=null &&
strLine.indexOf(this.strBoundary) >= 0) {
foundFirstBoundary = true;
break;
}
}
if (!foundFirstBoundary) {
throw new IOException("Invalid Form Data,
no boundary
encountered.");
}

Let me know. As always, thanks

-Luis

Discussion

  • Jason Pell

    Jason Pell - 2003-09-17

    Logged In: YES
    user_id=122222

    Hi,

    I cannot reproduce this problem. Any idea what EXACT
    version of IE caused this.

    Thanks
    Jason

     
  • Jason Pell

    Jason Pell - 2007-09-22

    Logged In: YES
    user_id=122222
    Originator: YES

    If someone can still reproduce the bug on their IE, can they use the Dump feature in the FileUploadWebApp to generate a dump to post to this report.

     

Log in to post a comment.

MongoDB Logo MongoDB