hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <http-as...@dubioso.net>
Subject Re: Problem with MultiPart Post - Uploading image
Date Thu, 14 Dec 2006 19:11:28 GMT
Hello Marshall,

I see you've fixed the problem while I was typing this mail.
but since I've typed it already, I'm gonna send it anyway... :-)


> I can catch what the browser and httpclient send through TCPMon tool (see
> the below).  You can see there are quite different in both header and body
> sections.  Question is what I should do to make my code to send exactly the
> same as the browser does?

not all of the differences are significant.
Here are a few suggestions:

1. enforce sending of a single Cookie header:
http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/params/HttpMethodParams.html#SINGLE_COOKIE_HEADER

2. set the User-Agent header to a standard browser value:
http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HttpMethod.html#setRequestHeader(java.lang.String,%20java.lang.String)

3. add the Referer header (same method as for 2)

4. add the Accept-Charset header (same method as for 2)


If none of these help, search the mailing list archive for previous
discussions of the MultipartRequestEntity. The differences in the
body _should_not_ be significant, but you never know what a server
makes out of it. I'm a bit surprised about the charset= in the
image/jpeg part, but that's only an oddity and not really a problem.

(Edit: here I was obviously wrong :-)

hope that helps,
  Roland


---------------------------------------------------------------------
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