You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Nigel Rantor <wi...@wiggly.org> on 2004/09/23 14:05:40 UTC

HTTP Client File Upload Question

Hi all,

I'm being bitten by a weird bug and I have a feeling it's because I'm 
not sure about content-transfer encodings vs charsets.

I'm using httpclient 2 to upload to a perl CGI.

Uploading from a browser works fine.

Uploading from my program works fine for text files.

Uploading from my program fails for binary files. The resulting file is 
corrupted, it seems as if the two high bits of every byte have been 
zeroed, so a byte val of FF gets transferred as 3F.

Does this make any sense to anyone?

TIA,

   N

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


Re: HTTP Client File Upload Question

Posted by Nigel Rantor <wi...@wiggly.org>.
Oleg Kalnichevski wrote:
> Nigel,
> 
> Try setting Parts' transfer-encoding and charset to null and see if that
> makes any difference.
> 
> http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/methods/multipart/PartBase.html#setTransferEncoding(java.lang.String)

Thanks for the suggestion Oleg.

It doesn't seem to help, I can see that it isn't adding those headers to 
the form data now (looking at the logs in lumbermill as it runs) but it 
still comes over garbled.

Currently my next step will be to try and encode it somehow before 
sending, but if it is indeed stripping the two high bits then even a 
7bit encoding is going to get mangled.

I am really at a loss, I really need to get this working in the next 
couple of days so any suggestions, wild whacky or otherwise all equally 
appreciated guys.

Cheers,

   Nige

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


Re: HTTP Client File Upload Question

Posted by Oleg Kalnichevski <ol...@bluewin.ch>.
Nigel,

Try setting Parts' transfer-encoding and charset to null and see if that
makes any difference.

http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/methods/multipart/PartBase.html#setTransferEncoding(java.lang.String)

Oleg


On Thu, 2004-09-23 at 14:05, Nigel Rantor wrote:
> Hi all,
> 
> I'm being bitten by a weird bug and I have a feeling it's because I'm 
> not sure about content-transfer encodings vs charsets.
> 
> I'm using httpclient 2 to upload to a perl CGI.
> 
> Uploading from a browser works fine.
> 
> Uploading from my program works fine for text files.
> 
> Uploading from my program fails for binary files. The resulting file is 
> corrupted, it seems as if the two high bits of every byte have been 
> zeroed, so a byte val of FF gets transferred as 3F.
> 
> Does this make any sense to anyone?
> 
> TIA,
> 
>    N
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 


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


Re: HTTP Client File Upload Question

Posted by Nigel Rantor <wi...@wiggly.org>.
Hello again,

I found the problem, elsewhere, so I formally apologise for wasting time 
and impugning the reputation the httpclient code.

:-)

   N


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