Rob Smart created FILEUPLOAD-211:
------------------------------------

             Summary: [fileupload] fails with transfer-encoding: chunked when 
multi-part file section includes chunked data
                 Key: FILEUPLOAD-211
                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-211
             Project: Commons FileUpload
          Issue Type: Bug
    Affects Versions: 1.2.2
         Environment: Tomcat 7, java 1.6, osx
            Reporter: Rob Smart
            Priority: Minor


When performing multi-part file upload using chunked data, if a multi-part 
section includes separate data chunks it is not correctly parsed and causes 
FileUpload to throw "MalformedStreamException: Stream ended unexpectedly"

Having chunked content within a multi-part boundaries is as far as I am aware 
valid.

The reason my client has chunked content within file boundaries is that an 
audio file is uploaded as it is being recorded.

Example with chunked data within file boundary

POST /UploadServlet HTTP/1.1
User-Agent: test
Host: 192.168.1.2:9080
Connection: keep-alive
Transfer-Encoding: chunked
Content-Type:multipart/form-data; 
boundary=----WebKitFormBoundarykhPSttlPFVKSMhff

99
------WebKitFormBoundarykhPSttlPFVKSMhff
Content-Disposition: form-data; name="file"; filename="testfaces.wav"
Content-Type: application/octet-stream

5
AAAAA
5
AAAAA
5
AAAAA
5
AAAAA
2a
------WebKitFormBoundarykhPSttlPFVKSMhff--
0


Exception


org.apache.commons.fileupload.MultipartStream$MalformedStreamException: Stream 
ended unexpectedly
        at 
org.apache.commons.fileupload.MultipartStream.readHeaders(MultipartStream.java:538)
        at 
org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.findNextItem(FileUploadBase.java:999)
        at 
org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:965)
        at 
org.apache.commons.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:331)
        at 
org.apache.commons.fileupload.servlet.ServletFileUpload.getItemIterator(ServletFileUpload.java:148)
        at 
com.ibm.cio.StreamedUploadServlet.doPost(StreamedUploadServlet.java:75)


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to