Hello Eugeny,

> For some reason if there are more than 1 Location header in response,

That is a violation of the HTTP spec. RFC 2616, section 14.30:

<quote>
The field value consists of a single absolute URI.
</quote>

It is quite common to see relative URIs instead of absolute ones,
and HttpClient tolerates that. But two URIs is new to me.

> all headers are collected into single string, for instance - 
> 
> /madeline/?GCID=C1000x047&AID=10280172&PID=1453275, /madeline

Well, that's what getRequestHeader(String) is supposed to do.
Multiple header fields with the same name are equivalent to
a single header field with the individual values concatenated
by commas. RFC 2616, section 4.2 says:

<quote>
   Multiple message-header fields with the same field-name MAY be
   present in a message if and only if the entire field-value for that
   header field is defined as a comma-separated list [i.e., #(values)].
   It MUST be possible to combine the multiple header fields into one
   "field-name: field-value" pair, without changing the semantics of the
   message, by appending each subsequent field-value to the first, each
   separated by a comma.
</quote>

If you want the header fields separately, use getRequestHeaders(String)
and you'll get an array in return.

> ---------------------------------------------------------------------------
> HTTP/1.1 302 Object moved
> Server: Microsoft-IIS/5.0

Why am I not surprised?

> Date: Tue, 11 Jul 2006 14:52:28 GMT
> X-Powered-By: ASP.NET
> P3P: policyref="http://www.allaboardtoys.com/w3c/p3p.xml";
> Pragma: no-cache
> cache-control: no-store
> Cache-Control: no-cache, must-revalidate
> Location: 
> http://www.allaboardtoys.com/madeline/?GCID=C1000x047&AID=10280172&PID=1453275
> Location: /madeline

The first one is at least absolute. In your example above,
the protocol and hostname part were missing.

> then next request
> 
> ---------------------------------------------------------------------------
> GET /madeline/?GCID=C1000x047&AID=10280172&PID=1453275, /madeline HTTP/1.1
> User-Agent: Mozilla/4.0(compatible; MSIE 6.0; Windows NT 5.1;)
> Host: www.allaboardtoys.com
> Cookie: 
> ShopperManager%2F=sts=nwc45&ShopperManager%2F=C08BA8AEFED14F27BF4EF3FF1CE0CD85
> Cookie: ASPSESSIONIDCATQCDDQ=JLAADADBKEKJBHKKFALPEMHH
>
> As you can see, instead of http://www.allaboardtoys.com/madeline HttpClient
> used
> 
> /madeline/?GCID=C1000x047&AID=10280172&PID=1453275, /madeline

Actually, it used

http://www.allaboardtoys.com/madeline/?GCID=C1000x047&AID=10280172&PID=1453275,
/madeline

RFC 2616 says that only the path should go into the request line, while
the host is sent as the value of the Host: header field.

> which is wrong.

And exactly what the server sent.

cheers,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to