hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ROLWE...@de.ibm.com>
Subject Re: 400 Error
Date Tue, 04 Oct 2005 05:53:37 GMT
Hi Thom,

Thom Hehl <thom@nowhereatall.com> wrote on 04.10.2005 00:32:45:

> OK, I re-did the TCPDUMP from the application and here's the whole 
> packet being sent to the server.
> 
> 18:23:53.109375 IP HEAVYMOVER.1049 > orgmeta.xmlsweb.com.3245: P 
> 1:216(215) ack 1 win 65535
>     0x0000:  4500 00ff 0eae 4000 8006 e999 c0a8 0004  E.....@.........
>     0x0010:  0c9a 346b 0419 0cad 81ed 17f2 25b0 88f6  ..4k........%...
>     0x0020:  5018 ffff 9527 0000 4745 5420 2f6f 7267  P....'..GET./org
>     0x0030:  732e 786d 6c20 4854 5450 2f31 2e31 0d0a  s.xml.HTTP/1.1..
>     0x0040:  4163 6365 7074 3a20 2a2f 2a0d 0a41 6363  Accept:.*/*..Acc
>     0x0050:  6570 742d 456e 636f 6469 6e67 3a20 677a  ept-Encoding:.gz
>     0x0060:  6970 2c20 6465 666c 6174 650d 0a55 7365  ip,.deflate..Use
>     0x0070:  722d 4167 656e 743a 204d 6f7a 696c 6c61  r-Agent:.Mozilla
>     0x0080:  2f34 2e30 2028 636f 6d70 6174 6962 6c65  /4.0.(compatible
>     0x0090:  3b20 4d53 4945 2036 2e30 3b20 5769 6e64  ;.MSIE.6.0;.Wind
>     0x00a0:  6f77 7320 4e54 2035 2e31 3b20 5356 313b  ows.NT.5.1;.SV1;
>     0x00b0:  202e 4e45 5420 434c 5220 312e 312e 3433  ..NET.CLR.1.1.43
>     0x00c0:  3232 290d 0a48 6f73 743a 206f 7267 6d65  22)..Host:.orgme
>     0x00d0:  7461 2e78 6d6c 7377 6562 2e63 6f6d 3a33  ta.xmlsweb.com:3
>     0x00e0:  3234 350d 0a43 6f6e 6e65 6374 696f 6e3a  245..Connection:
>     0x00f0:  204b 6565 702d 416c 6976 650d 0a0d 0a    .Keep-Alive....
> 
> I am only sending...
> 
> 2005/10/03 05:28:30:687 EDT [DEBUG] header - >> "GET orgs.xml 
> HTTP/1.1[\r][\n]"
> 2005/10/03 05:28:30:687 EDT [DEBUG] HttpMethodBase - Adding Host request 

> header
> 2005/10/03 05:28:30:718 EDT [DEBUG] header - >> "User-Agent: Mozilla/4.0 

> (compatible; MSIE 6.0; Windows NT 5.0)[\r][\n]"
> 2005/10/03 05:28:30:718 EDT [DEBUG] header - >> "Host: 
> orgmeta.xmlsweb.com:3245[\r][\n]"
> 2005/10/03 05:28:30:718 EDT [DEBUG] header - >> "[\r][\n]"
> 
> Could this be the problem? How do I set these other paramters.

The problem I see is that you are requesting "orgs.xml", while the
application you traced requests "/orgs.xml". The other stuff is
standard headers used by browsers, they shouldn't matter for now.

> I have searched the docs and there doesn't appear to be one that says, 
> "Here's how to set these things and what they do." I guess most people 
> who use this have more of a background with the HTTP than I do. Anyway, 
> if there's a list that someone would share, I wouldn't bug the list as 
much.

You set HTTP headers using HttpMethod.setHeader. There is an almost
complete list of standard HTTP headers in RFC 2616, available at
http://www.ietf.org/rfc.html in text format. There is also a PDF version
floating somewhere in the internet if you prefer that.
Keep in mind that some of the HTTP headers are handled automatically by
HttpClient in order to implement the protocol. In particular, stay away
from the "Host:" header which is set from the URL you request, from the
"Content-Length:" header which is defined through the entities you send,
and be careful with "Connection:" and "Cookie:" headers.

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