You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "linea@libero.it" <li...@libero.it> on 2003/09/23 15:51:32 UTC

setCookiePolicy(COMPATIBILITY)

Hi, I am trying to send a head request to the url
http://www.sitepoint.com/books/
setting the policy to COMPATIBILITY level.
The server asks for a redirection, and expects a Cookie request-header of the form:
Cookie: SID=3cf29ad1964f877b7763aedc9dc62ae6; cookie_test=1
while httpclient sends it in the form:
Cookie: SID=9e1d0a9cfca8af30e80e2c5ba9c98607
Cookie: cookie_test=1

This ends up in a narrowly infinite loop..

Setting the policy to NETSCAPE_DRAFT the request is handled correctly..

Is this the expected behaviour? I expected COMPATIBILITY to be the most 
permissive one..

thanks

Here is my log:

340    DEBUG [Thread-1] httpclient.wire - >> "HEAD /books/ HTTP/1.1[\r][\n]"
359    DEBUG [Thread-1] httpclient.wire - >> "User-Agent: Mozilla/5.0 (X11; U; 
Linux i686; it-IT; r
v:1.3) Gecko/20030312[\r][\n]"
361    DEBUG [Thread-1] httpclient.wire - >> "Host: www.sitepoint.com[\r][\n]"
363    DEBUG [Thread-1] httpclient.wire - >> "[\r][\n]"
519    DEBUG [Thread-1] httpclient.wire - << "HTTP/1.1 302 Found[\r][\n]"
521    DEBUG [Thread-1] params.DefaultHttpParams - Set parameter 
http.protocol.version = HTTP/1.1
521    DEBUG [Thread-1] httpclient.HttpMethodBase - enter 
HttpMethodBase.readResponseHeaders(HttpSt
ate,HttpConnection)
532    DEBUG [Thread-1] httpclient.wire - << "Date: Tue, 23 Sep 2003 13:41:05 
GMT[\r][\n]"
533    DEBUG [Thread-1] httpclient.wire - << "Server: Apache/1.3.27 (Unix) 
PHP/4.3.2[\r][\n]"
533    DEBUG [Thread-1] httpclient.wire - << "X-Powered-By: PHP/4.3.2[\r][\n]"
534    DEBUG [Thread-1] httpclient.wire - << "X-Accelerated-By: 
PHPA/1.3.3r2[\r][\n]"
534    DEBUG [Thread-1] httpclient.wire - << "Set-Cookie: 
SID=9e1d0a9cfca8af30e80e2c5ba9c98607; exp
ires=Wed, 22-Sep-04 13:41:05 GMT; path=/[\r][\n]"
550    DEBUG [Thread-1] httpclient.wire - << "Expires: Thu, 19 Nov 1981 08:52:00 
GMT[\r][\n]"
550    DEBUG [Thread-1] httpclient.wire - << "Cache-Control: no-store, no-cache, 
must-revalidate, p
ost-check=0, pre-check=0[\r][\n]"
551    DEBUG [Thread-1] httpclient.wire - << "Pragma: no-cache[\r][\n]"
551    DEBUG [Thread-1] httpclient.wire - << "Set-Cookie: ctest=deleted; 
expires=Mon, 23-Sep-02 13:
41:04 GMT; path=/[\r][\n]"
552    DEBUG [Thread-1] httpclient.wire - << "Set-Cookie: session_id=deleted; 
expires=Mon, 23-Sep-0
2 13:41:04 GMT; path=/[\r][\n]"
552    DEBUG [Thread-1] httpclient.wire - << "Set-Cookie: session_id=deleted; 
expires=Mon, 23-Sep-0
2 13:41:04 GMT; path=/[\r][\n]"
552    DEBUG [Thread-1] httpclient.wire - << "Set-Cookie: cookie_test=1; 
expires=Fri, 17-Sep-04 13:
41:05 GMT; path=/[\r][\n]"
559    DEBUG [Thread-1] httpclient.wire - << "Location: 
http://www.sitepoint.com/books/?cookie_test
=1[\r][\n]"
559    DEBUG [Thread-1] httpclient.wire - << "Content-Type: text/html[\r][\n]"
1202   DEBUG [Thread-1] httpclient.wire - >> "HEAD /books/?cookie_test=1 
HTTP/1.1[\r][\n]"
1209   DEBUG [Thread-1] httpclient.wire - >> "User-Agent: Mozilla/5.0 (X11; U; 
Linux i686; it-IT; r
v:1.3) Gecko/20030312[\r][\n]"
1211   DEBUG [Thread-1] httpclient.wire - >> "Host: www.sitepoint.com[\r][\n]"
1213   DEBUG [Thread-1] httpclient.wire - >> "Cookie: 
SID=9e1d0a9cfca8af30e80e2c5ba9c98607[\r][\n]"
1214   DEBUG [Thread-1] httpclient.wire - >> "Cookie: cookie_test=1[\r][\n]"
1214   DEBUG [Thread-1] httpclient.wire - >> "[\r][\n]"
1373   DEBUG [Thread-1] httpclient.wire - << "HTTP/1.1 302 Found[\r][\n]"
1373   DEBUG [Thread-1] params.DefaultHttpParams - Set parameter 
http.protocol.version = HTTP/1.1
1374   DEBUG [Thread-1] httpclient.HttpMethodBase - enter 
HttpMethodBase.readResponseHeaders(HttpSt
ate,HttpConnection)
1379   DEBUG [Thread-1] httpclient.wire - << "Date: Tue, 23 Sep 2003 13:41:05 
GMT[\r][\n]"
1379   DEBUG [Thread-1] httpclient.wire - << "Server: Apache/1.3.27 (Unix) 
PHP/4.3.2[\r][\n]"
1379   DEBUG [Thread-1] httpclient.wire - << "X-Powered-By: PHP/4.3.2[\r][\n]"
1380   DEBUG [Thread-1] httpclient.wire - << "X-Accelerated-By: 
PHPA/1.3.3r2[\r][\n]"
1380   DEBUG [Thread-1] httpclient.wire - << "Expires: Thu, 19 Nov 1981 08:52:00 
GMT[\r][\n]"
1381   DEBUG [Thread-1] httpclient.wire - << "Cache-Control: no-store, no-cache, 
must-revalidate, p
ost-check=0, pre-check=0[\r][\n]"
1381   DEBUG [Thread-1] httpclient.wire - << "Pragma: no-cache[\r][\n]"
1384   DEBUG [Thread-1] httpclient.wire - << "Location: 
http://www.sitepoint.com/books/?[\r][\n]"
1384   DEBUG [Thread-1] httpclient.wire - << "Content-Type: text/html[\r][\n]"


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