You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2013/10/23 18:27:42 UTC

[jira] [Updated] (HTTPCLIENT-1426) MultipartEntityBuilder creates malformed HttpEntity

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1426?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated HTTPCLIENT-1426:
------------------------------------------

         Priority: Trivial  (was: Major)
    Fix Version/s: 4.3.2

If you explicitly provide filename as a parameter it will be added to the Content-Disposition header.

Oleg

> MultipartEntityBuilder creates malformed HttpEntity
> ---------------------------------------------------
>
>                 Key: HTTPCLIENT-1426
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1426
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpMime
>    Affects Versions: 4.3.1
>            Reporter: Vit Hampl
>            Priority: Trivial
>             Fix For: 4.3.2
>
>
> Parts of multipart HttpEntity added with MultipartEntityBuilder.addBinaryBody(String name, File file) don't contain fields "filename" and "Content-Type", thus Commons FileUpload handles them as form fields, not files.
> The problem is probably caused by empty filename of the created FileBody.
> Example of such entity:
> --xo87KfYhq0_a-IlrudAqypCdOyMb7yi7mC
> Content-Disposition: form-data; name="docType"
> PZ001
> --xo87KfYhq0_a-IlrudAqypCdOyMb7yi7mC
> Content-Disposition: form-data; name="file0"
> <file content>
> --xo87KfYhq0_a-IlrudAqypCdOyMb7yi7mC--
> expected result:
> --xo87KfYhq0_a-IlrudAqypCdOyMb7yi7mC
> Content-Disposition: form-data; name="docType"
> PZ001
> --xo87KfYhq0_a-IlrudAqypCdOyMb7yi7mC
> Content-Disposition: form-data; name="file0"; filename="test.txt"
> Content-Type: application/octet-stream
> <file content>
> --xo87KfYhq0_a-IlrudAqypCdOyMb7yi7mC--



--
This message was sent by Atlassian JIRA
(v6.1#6144)

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