[ 
https://issues.apache.org/jira/browse/FILEUPLOAD-211?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17351917#comment-17351917
 ] 

Arturo Bernal commented on FILEUPLOAD-211:
------------------------------------------

HI [~robsmart]

Would you be able to provide a unit test?

Thanks,

Arturo

> [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 was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to