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 2014/08/22 08:43:11 UTC

[jira] [Resolved] (HTTPCLIENT-1548) Duplicated rewquest headers with MultipartEntityBuilder and file PUT

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

Oleg Kalnichevski resolved HTTPCLIENT-1548.
-------------------------------------------

    Resolution: Invalid

You are mis-using MultipartEntityBuilder by manually overriding the standard content type, hence extra headers in the content body on the server side. The server side handler assumes the content to be of type {{application/x-shockwave-flash}} instead of {{multipart/form-data}}. 

{code:java}
putRequest.setEntity(meb.build());
putRequest.setHeader(HttpHeaders.CONTENT_TYPE, this.getMimeForExtension(extension));
{code}

{noformat}
2014/08/21 13:34:15:975 UTC [DEBUG] wire - http-outgoing-3 >> "Content-Type: application/x-shockwave-flash[\r][\n]"
{noformat}

Oleg

> Duplicated rewquest headers with MultipartEntityBuilder and file PUT
> --------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1548
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1548
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.3.5
>         Environment: Ubuntu 13.10, Java 1.7.0_17
>            Reporter: Piotr Jasiulewicz
>
> Problem arises when wanting to upload files via put to AWS S3 servers (not tested with other servers as it is a problem on the client side). The creation usage of MultipartEntityBuilder creates duplicated request headers which the remote server interprets as part of the file corrupting them. The file has header test on the beginning and end as it is interpreted as file content.
> Wire log: https://gist.github.com/teu/765920b44a8dcc818297
> Problematic code: https://gist.github.com/teu/582999846fbf1b222125
> Working code: https://gist.github.com/teu/2f31c9e86f30aed4d920



--
This message was sent by Atlassian JIRA
(v6.2#6252)

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