[jira] Commented: (FILEUPLOAD-139) [fileupload] separator of boundary doesnt match rfc1867 examples

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] Commented: (FILEUPLOAD-139) [fileupload] separator of boundary doesnt match rfc1867 examples

Gary D. Gregory (Jira)

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

martynas commented on FILEUPLOAD-139:

Not only web browsers can submit files to server using this method. For example I made some embedded device witch is sending some generated files to Server. File upload part I done using  RFC 1867.I didn't look  at others rfc looking if there is some mistake in this one. So i have done device which is sending files to some server. If my written script is good I tested on simple php script. There was no problem. So we produced a lot of these devices (i can't change soft in them). Then I began making server on Java using this library . So occurred a problem. At moment i use some decorator witch replaces commas to semi-colons. But as I suppose it should be fixed in library because i may be not only one who is writing simple code using this rfc without checking if its conflicting with other rfc documents.

> [fileupload] separator of boundary doesnt match rfc1867 examples
> ----------------------------------------------------------------
>                 Key: FILEUPLOAD-139
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-139
>             Project: Commons FileUpload
>          Issue Type: Bug
>            Reporter: martynas
> [fileupload]
> in class :
> package org.apache.commons.fileupload;
> public abstract class FileUploadBase {
>     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;
>     }
> }
> String :  Map params = parser.parse(contentType, ';');
> doesn't match http://www.ietf.org/rfc/rfc1867.txt document
> because in all examples:
> Content-type: multipart/form-data , boundary=AaB03x
> Content-type: multipart/form-data, boundary=AaB03x
> Content-type: multipart/mixed, boundary=BbC04y
> boundary separated by comma (but not semicolon)

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