You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2003/11/05 23:04:30 UTC
DO NOT REPLY [Bug 21269] -
FileUploadBase does not handle quoted boundary specification, which is required by RFC 1521
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21269>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21269
FileUploadBase does not handle quoted boundary specification, which is required by RFC 1521
------- Additional Comments From Jan.Vervecken@pandora.be 2003-11-05 22:04 -------
We are using a User-Agent that sends request like:
--8<---------- begin ---
POST /UploadTest/upload.do HTTP/1.0
Host: w2kp-jv:8888
User-Agent: IP*Works! V5 HTTP/S Component - by /n software - www.nsoftware.com
Content-Type: multipart/form-data; boundary="boundaryoazJlhY="
Content-Length: 230
--boundaryoazJlhY=
Content-Disposition: form-data; name="file"; filename="C:\myUploadTest.txt"
Content-Type: text/plain
a first line
a second line
--boundaryoazJlhY=--
--8<---------- end ---
Note the quotes on the value for the boundary in the Content-Type field.
I have made these code changes, they work for us:
--8<---------- begin ---
Index: FileUploadBase.java
===================================================================
RCS file: /home/cvspublic/jakarta-
commons/fileupload/src/java/org/apache/commons/fileupload/FileUploadBase.java,v
retrieving revision 1.4
diff -u -r1.4 FileUploadBase.java
--- FileUploadBase.java 9 Oct 2003 21:15:47 -0000 1.4
+++ FileUploadBase.java 5 Nov 2003 22:02:38 -0000
@@ -328,8 +328,17 @@
"the request was rejected because "
+ "no multipart boundary was found");
}
- byte[] boundary = contentType.substring(
- boundaryIndex + 9).getBytes();
+ String boundaryBase = contentType.substring(boundaryIndex + 9);
+ byte[] boundary = null;
+ if (boundaryBase.startsWith("\"") && boundaryBase.endsWith("\""))
+ {
+ // removing quotes
+ boundary = boundaryBase.substring(1, (boundaryBase.length() -
1)).getBytes();
+ }
+ else
+ {
+ boundary = boundaryBase.getBytes();
+ }
InputStream input = req.getInputStream();
--8<---------- end ---
I'm not an expert on the related RFCs, but check the "WARNING TO IMPLEMENTORS"
on page 30 of http://www.ietf.org/rfc/rfc1521.txt
I hope this makes sense.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org