hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HTTPCLIENT-971) Multipart Post / FileUpload is missing necessary boundary header
Date Wed, 28 Jul 2010 13:36:22 GMT

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

Oleg Kalnichevski resolved HTTPCLIENT-971.
------------------------------------------

    Resolution: Invalid

And what does this tell you?

---
POST /documents/?X-Progress-ID=67c68a807c77012d43ff406186cbf281 HTTP/1.1
Host: letsannotate.com
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.6) Gecko/20100628 Ubuntu/10.04
(lucid) Firefox/2.0.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-at,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://letsannotate.com/documents/new
Cookie: <snip>
Content-Type: multipart/form-data; boundary=---------------------------6242690908831492081020707676
Content-Length: 38372

-----------------------------6242690908831492081020707676
Content-Disposition: form-data; name="authenticity_token"

Iuk91iuBo38g31ncl0iEgZk7Rltv3jzZtOZFdKww/y4=
-----------------------------6242690908831492081020707676
Content-Disposition: form-data; name="document[progress_token]"

67c68a807c77012d43ff406186cbf281
-----------------------------6242690908831492081020707676
Content-Disposition: form-data; name="document[pdf_file]"; filename="testpdf1.pdf"
Content-Type: application/download

<binary stuff>
---

> Multipart Post / FileUpload is missing necessary boundary header
> ----------------------------------------------------------------
>
>                 Key: HTTPCLIENT-971
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-971
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpMime
>    Affects Versions: 4.0.1, 4.1 Alpha2
>         Environment: Ubuntu 10, Java 6
>         <dependency>
>             <groupId>org.apache.httpcomponents</groupId>
>             <artifactId>httpclient</artifactId>
>             <!--<version>4.0.1</version>-->
>             <version>4.1-alpha2</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.httpcomponents</groupId>
>             <artifactId>httpmime</artifactId>
>             <!--<version>4.0.1</version>-->
>             <version>4.1-alpha2</version>
>         </dependency>
> 4.0.1 and 4.1-alpha2 have this bug. 
>            Reporter: Dominik Dorn
>            Priority: Minor
>         Attachments: dump_firefox
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> When doing a multipart post, with a code like this:
> <code>
>   HttpPost post = new HttpPost("http://" + host + ":" + port + uploadUrl + token.getProgressToken());
>     HttpContext context = new BasicHttpContext();
>     CookieStore store = cred.getCookieStore();
>     context.setAttribute(ClientContext.COOKIE_STORE, store);
>     MultipartEntity entity = new MultipartEntity();
>     HttpResponse response;
>     try{
>       entity.addPart("document[pdf_file]", new FileBody(file));
>       entity.addPart("authenticity_token", new StringBody(token.getAuthenticityToken(),
Charset.forName("UTF-8")));
>       entity.addPart("document[progress_token]", new StringBody(token.getProgressToken(),
Charset.forName("UTF-8")));
>       post.setEntity(entity);
>       HttpClient client = new DefaultHttpClient();
>       response = client.execute(post, context);
> </code>
> The required initializing Header
> <code>
> Content-Type: multipart/form-data; boundary=---------------------------15590059519136285452113363602
> Content-Length: 38377
> -----------------------------15590059519136285452113363602
> Content-Disposition: form-data; name="authenticity_token"
> VkJ/mnCDmImYfEVT0zNFBvyyhihKSaUX5j7Vm7d0WUQ=
> </code>
> is missing. 
> Instead it directly starts with
> <code>
> --gDRYDFqyzjuUrRL5No6B5wHN6BT5Ts2
> Content-Disposition: form-data; name="authenticity_token"
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> rvMzKRruVZaKX7JV+4Zpg7LWdxEuhq2hSgtaCIcSzCg=
> </code>
> The target server ( a rails one ) seems not to be able to understand this multipart upload.

> I think the correct place to fix is org.apache.http.entity.mime.MultipartEntity but I'm
not sure where and how to do it.
> Please help. 

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


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


Mime
View raw message