hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Set Content-length in mulitpart headers
Date Wed, 09 Feb 2005 21:21:48 GMT
Oliver,

You are confusing 'Transfer-Encoding' of the HTTP content and that of a
MIME part within a multipart/form-data encoded content. 

It's been a while since I looked at the spec but if my memory does not
fail me, Content-length was not required for a MIME part.

Oleg

On Tue, 2005-02-08 at 23:01 +0100, Ham MI-EN Oliver Rennert wrote:
> Hello httpclient users
> 
> I am posting files to a server with a MultipartRequestEntity.
> 
> The result looks like this:
> --FZU0uEJyLTvOZGiw2Wsmm5Bl7a330uHLv5YKIKt
> Content-Disposition: form-data; name="prefix"
> Content-Type: application/x-www-form-urlencoded; charset=US-ASCII
> 
> AppVersion=1.0&AcceptUPSLicenseAgreement=Yes&ResponseType=application/x-ups-pld&
> VersionNumber=V4R1&UserId=USER&Password=PASSWORD
> --FZU0uEJyLTvOZGiw2Wsmm5Bl7a330uHLv5YKIKt
> Content-Disposition: form-data; name="testpld0200.txt";
> filename="testpld0200.txt"
> Content-Type: application/x-ups-binary; charset=ISO-8859-1
> 
> 020094                                  2005012700000590210000800
> 000000001*AA590210
> --FZU0uEJyLTvOZGiw2Wsmm5Bl7a330uHLv5YKIKt--
> 
> 
> But I also need the client to create a Content-length header for every part.
> I browsed already through the source code and noticed that the Content-length
> will only be created if the TransferEncoding is null and the content is not
> chunked.
> 
> For this reason I included the following into my code:
>   post.setContentChunked(false);
>   stringPart.setTransferEncoding(null);
>   filePart.setTransferEncoding(null);
> 
> 
> Who knows how to add the ContentLength Header?
> 
> 
> Kind Regards,
> Oliver Rennert
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message