You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Alexander Sova (JIRA)" <ji...@apache.org> on 2007/05/24 04:10:16 UTC

[jira] Created: (FILEUPLOAD-135) InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS

InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS
-------------------------------------------------------------------------------------------------------------------

                 Key: FILEUPLOAD-135
                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-135
             Project: Commons FileUpload
          Issue Type: Bug
    Affects Versions: 1.2, 1.2.1
         Environment: Windows XP
Browser: Firefox 1.5.0.11
Protocol: HTTPS


            Reporter: Alexander Sova


I was able to reproduce this problem happens only with files shorer then boundary string generated by browser and only with Firefox using HTTPS protocol.
For some reason in this particular environment inputStream.read() in MultipartStream.ItemInputStream.makeAvailable() reads not whole HTTP response body, but only file content before boundary string. 
I've created a patch fixing this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (FILEUPLOAD-135) InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS

Posted by "Rob Slifka (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FILEUPLOAD-135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12511187 ] 

Rob Slifka commented on FILEUPLOAD-135:
---------------------------------------

Many thanks Jochen!  I see that another has verified the fix in FILEUPLOAD-138.

Any idea when we'll see 1.2.1 released?


> InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: FILEUPLOAD-135
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-135
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2, 1.2.1
>         Environment: Windows XP
> Browser: Firefox 1.5.0.11
> Protocol: HTTPS
>            Reporter: Alexander Sova
>            Assignee: Jochen Wiedmann
>             Fix For: 1.2.1
>
>         Attachments: commons-fileupload-1.1-bug-short-file-eof.patch, commons-fileupload-1.2-bug-short-file-eof.patch, FILEUPLOAD135.patch
>
>
> This problem happens only with files shorer then boundary string generated by browser and only with Firefox using HTTPS protocol.
> For some reason in this particular environment inputStream.read() in MultipartStream.ItemInputStream.makeAvailable() reads not whole HTTP response body, but only file content before boundary string. 
> I've created a patch fixing this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (FILEUPLOAD-135) InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS

Posted by "Alexander Sova (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FILEUPLOAD-135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Sova updated FILEUPLOAD-135:
--------------------------------------

    Attachment: commons-fileupload-1.2-bug-short-file-eof.patch

my previous patch has a bug. please use new one

> InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: FILEUPLOAD-135
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-135
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2, 1.2.1
>         Environment: Windows XP
> Browser: Firefox 1.5.0.11
> Protocol: HTTPS
>            Reporter: Alexander Sova
>         Attachments: commons-fileupload-1.1-bug-short-file-eof.patch, commons-fileupload-1.2-bug-short-file-eof.patch
>
>
> I was able to reproduce this problem happens only with files shorer then boundary string generated by browser and only with Firefox using HTTPS protocol.
> For some reason in this particular environment inputStream.read() in MultipartStream.ItemInputStream.makeAvailable() reads not whole HTTP response body, but only file content before boundary string. 
> I've created a patch fixing this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (FILEUPLOAD-135) InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS

Posted by "Alexander Sova (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FILEUPLOAD-135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Sova updated FILEUPLOAD-135:
--------------------------------------

    Attachment: commons-fileupload-1.1-bug-short-file-eof.patch

reading from inputStream until we get enough content to fit boundary string

> InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: FILEUPLOAD-135
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-135
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2, 1.2.1
>         Environment: Windows XP
> Browser: Firefox 1.5.0.11
> Protocol: HTTPS
>            Reporter: Alexander Sova
>         Attachments: commons-fileupload-1.1-bug-short-file-eof.patch
>
>
> I was able to reproduce this problem happens only with files shorer then boundary string generated by browser and only with Firefox using HTTPS protocol.
> For some reason in this particular environment inputStream.read() in MultipartStream.ItemInputStream.makeAvailable() reads not whole HTTP response body, but only file content before boundary string. 
> I've created a patch fixing this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (FILEUPLOAD-135) InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS

Posted by "Jochen Wiedmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FILEUPLOAD-135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499448 ] 

Jochen Wiedmann commented on FILEUPLOAD-135:
--------------------------------------------

Before applying your patch, I'd like to understand the problem. Would it be possible for you to provide a test case, which fails with 1.2 and works with your patch? Preferrably a patch against the test suite, but a sample http body should do.


> InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: FILEUPLOAD-135
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-135
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2, 1.2.1
>         Environment: Windows XP
> Browser: Firefox 1.5.0.11
> Protocol: HTTPS
>            Reporter: Alexander Sova
>         Attachments: commons-fileupload-1.1-bug-short-file-eof.patch, commons-fileupload-1.2-bug-short-file-eof.patch
>
>
> I was able to reproduce this problem happens only with files shorer then boundary string generated by browser and only with Firefox using HTTPS protocol.
> For some reason in this particular environment inputStream.read() in MultipartStream.ItemInputStream.makeAvailable() reads not whole HTTP response body, but only file content before boundary string. 
> I've created a patch fixing this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (FILEUPLOAD-135) InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS

Posted by "Rob Slifka (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FILEUPLOAD-135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12507943 ] 

Rob Slifka commented on FILEUPLOAD-135:
---------------------------------------

"Hello Jira" yikes :-)

Anyway, is there a way to see the progress on this issue?  I.e. if it's been submitted, scheduled, etc.?

Just to verify, it is indeed a Firefox-only issue, and not reproducible on any other browser (IE6, IE7, Opera, Safari).


> InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: FILEUPLOAD-135
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-135
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2, 1.2.1
>         Environment: Windows XP
> Browser: Firefox 1.5.0.11
> Protocol: HTTPS
>            Reporter: Alexander Sova
>         Attachments: commons-fileupload-1.1-bug-short-file-eof.patch, commons-fileupload-1.2-bug-short-file-eof.patch, FILEUPLOAD135.patch
>
>
> This problem happens only with files shorer then boundary string generated by browser and only with Firefox using HTTPS protocol.
> For some reason in this particular environment inputStream.read() in MultipartStream.ItemInputStream.makeAvailable() reads not whole HTTP response body, but only file content before boundary string. 
> I've created a patch fixing this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Resolved: (FILEUPLOAD-135) InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS

Posted by "Jochen Wiedmann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FILEUPLOAD-135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jochen Wiedmann resolved FILEUPLOAD-135.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.2.1
         Assignee: Jochen Wiedmann

Applied, thank you!


> InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: FILEUPLOAD-135
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-135
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2, 1.2.1
>         Environment: Windows XP
> Browser: Firefox 1.5.0.11
> Protocol: HTTPS
>            Reporter: Alexander Sova
>            Assignee: Jochen Wiedmann
>             Fix For: 1.2.1
>
>         Attachments: commons-fileupload-1.1-bug-short-file-eof.patch, commons-fileupload-1.2-bug-short-file-eof.patch, FILEUPLOAD135.patch
>
>
> This problem happens only with files shorer then boundary string generated by browser and only with Firefox using HTTPS protocol.
> For some reason in this particular environment inputStream.read() in MultipartStream.ItemInputStream.makeAvailable() reads not whole HTTP response body, but only file content before boundary string. 
> I've created a patch fixing this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (FILEUPLOAD-135) InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS

Posted by "Rob Slifka (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FILEUPLOAD-135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12507942 ] 

Rob Slifka commented on FILEUPLOAD-135:
---------------------------------------

Hello Jira,

I've run into this issue as well, very much looking forward to the
patch, thanks :)

Rob Slifka



> InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: FILEUPLOAD-135
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-135
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2, 1.2.1
>         Environment: Windows XP
> Browser: Firefox 1.5.0.11
> Protocol: HTTPS
>            Reporter: Alexander Sova
>         Attachments: commons-fileupload-1.1-bug-short-file-eof.patch, commons-fileupload-1.2-bug-short-file-eof.patch, FILEUPLOAD135.patch
>
>
> This problem happens only with files shorer then boundary string generated by browser and only with Firefox using HTTPS protocol.
> For some reason in this particular environment inputStream.read() in MultipartStream.ItemInputStream.makeAvailable() reads not whole HTTP response body, but only file content before boundary string. 
> I've created a patch fixing this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (FILEUPLOAD-135) InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS

Posted by "Jochen Wiedmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FILEUPLOAD-135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502147 ] 

Jochen Wiedmann commented on FILEUPLOAD-135:
--------------------------------------------

This test case doesn't help me understand the problem. The important part is the multipart document, which triggers the problem. We'd need a code sample that creates such a multipart document (compare, for example, the methid StreamingTest.newRequest; btw, note that this method creates file items which are clearly smaller than the boundary) or at least the multipart document itself, which you can catch with tools like tcpmon or Wireshark.


> InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: FILEUPLOAD-135
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-135
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2, 1.2.1
>         Environment: Windows XP
> Browser: Firefox 1.5.0.11
> Protocol: HTTPS
>            Reporter: Alexander Sova
>         Attachments: commons-fileupload-1.1-bug-short-file-eof.patch, commons-fileupload-1.2-bug-short-file-eof.patch
>
>
> This problem happens only with files shorer then boundary string generated by browser and only with Firefox using HTTPS protocol.
> For some reason in this particular environment inputStream.read() in MultipartStream.ItemInputStream.makeAvailable() reads not whole HTTP response body, but only file content before boundary string. 
> I've created a patch fixing this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (FILEUPLOAD-135) InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS

Posted by "Alexander Sova (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FILEUPLOAD-135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Sova updated FILEUPLOAD-135:
--------------------------------------

    Description: 
This problem happens only with files shorer then boundary string generated by browser and only with Firefox using HTTPS protocol.
For some reason in this particular environment inputStream.read() in MultipartStream.ItemInputStream.makeAvailable() reads not whole HTTP response body, but only file content before boundary string. 
I've created a patch fixing this issue.

  was:
I was able to reproduce this problem happens only with files shorer then boundary string generated by browser and only with Firefox using HTTPS protocol.
For some reason in this particular environment inputStream.read() in MultipartStream.ItemInputStream.makeAvailable() reads not whole HTTP response body, but only file content before boundary string. 
I've created a patch fixing this issue.


The problem is not with content of HTTP response, but with original InputStream behavior. InputStream.read() may read not whole buffer or whole content of input stream, but just part of it. If this part is shorter then boundary string (but still greater then 0) ItemInputStream.read() returns -1.

I was able to reproduce it only with small file (10 bytes) using FireFox 1.5.0.11 and HTTPS. I think I can simulate this by developing custom InputStream, but it could take some time.

Here is fragment of my code where I test the upload:

    protected byte[] getBoundary(String contentType) 
    {
        ParameterParser parser = new ParameterParser();
        parser.setLowerCaseNames(true);
        // Parameter parser can handle null input
        Map params = parser.parse(contentType, ';');
        String boundaryStr = (String) params.get("boundary");

        if (boundaryStr == null) {
            return null;
        }
        byte[] boundary;
        try {
            boundary = boundaryStr.getBytes("ISO-8859-1");
        } catch (UnsupportedEncodingException e) {
            boundary = boundaryStr.getBytes();
        }
        return boundary;
    }

    private void testFileUpload(HttpServletRequest req)
    {
        try 
        {
            byte[] boundary = getBoundary(req.getHeader("Content-Type"));
            System.out.println("Boundary: " + new String(boundary));
            MultipartStream multipartStream = new MultipartStream(req.getInputStream(), boundary);
            boolean nextPart = multipartStream.skipPreamble();
            OutputStream output = System.out;
            while(nextPart) 
            {
                //header = chunks.readHeader();
                System.out.println("!" + multipartStream.readHeaders() + "!");

                multipartStream.readBodyData(output);
                nextPart = multipartStream.readBoundary();
            }
        }
        catch(Exception e) 
        {
            e.printStackTrace();
        }
    }


> InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: FILEUPLOAD-135
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-135
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2, 1.2.1
>         Environment: Windows XP
> Browser: Firefox 1.5.0.11
> Protocol: HTTPS
>            Reporter: Alexander Sova
>         Attachments: commons-fileupload-1.1-bug-short-file-eof.patch, commons-fileupload-1.2-bug-short-file-eof.patch
>
>
> This problem happens only with files shorer then boundary string generated by browser and only with Firefox using HTTPS protocol.
> For some reason in this particular environment inputStream.read() in MultipartStream.ItemInputStream.makeAvailable() reads not whole HTTP response body, but only file content before boundary string. 
> I've created a patch fixing this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (FILEUPLOAD-135) InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS

Posted by "Alexander Sova (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FILEUPLOAD-135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Sova updated FILEUPLOAD-135:
--------------------------------------

    Attachment: FILEUPLOAD135.patch

I've added new test case to StreamingTest class. The key thing here is defining custom InputStream on top of ByteArrayInputStream which never read more then 3 bytes per call. If you change this number to something bigger then 10, the test will pass.

BTW, with  MockHttpServletRequest.MyServletInputStream.read(byte[],int,int) method defined properly testIOException() start failing. Without this change the second read() method defined in testIOException() never been called.



> InputStream created with Streaming API returns EOF on first read() for short files uploaded from FireFox over HTTPS
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: FILEUPLOAD-135
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-135
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2, 1.2.1
>         Environment: Windows XP
> Browser: Firefox 1.5.0.11
> Protocol: HTTPS
>            Reporter: Alexander Sova
>         Attachments: commons-fileupload-1.1-bug-short-file-eof.patch, commons-fileupload-1.2-bug-short-file-eof.patch, FILEUPLOAD135.patch
>
>
> This problem happens only with files shorer then boundary string generated by browser and only with Firefox using HTTPS protocol.
> For some reason in this particular environment inputStream.read() in MultipartStream.ItemInputStream.makeAvailable() reads not whole HTTP response body, but only file content before boundary string. 
> I've created a patch fixing this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org