hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "B K" <gr...@hotmail.com>
Subject Cookie Problem?
Date Sat, 11 Dec 2004 14:17:51 GMT
I have an issue with HTTPClient and a particular site which I can't get to 
work with it, the basic problem is I get relocated to an error page instead 
of the page I am expecting. I have used httpwatch to check out the cookies 
and discovered there was an extra cookie which wasn't being set, so I then 
manually set this cookie and I still get the same problem. I also try to 
pass in a Date when creating the cookie(I thought this may be the problem) 
but for some reason this causes a problem. Below is the log when I can 
create the cookie but with no date. The code I use to create this cookie is

Cookie mycookie = new Cookie("www.some.com", "SOME_CulturePref", "en-AU", 
"/", null, false);

2004/12/12 00:56:48:890 EST [DEBUG] header - ->> "GET / HTTP/1.1[\r][\n]"
2004/12/12 00:56:48:906 EST [DEBUG] header - ->> "User-Agent: Jakarta 
Commons-HttpClient/3.0-beta1[\r][\n]"
2004/12/12 00:56:48:906 EST [DEBUG] header - ->> "Host: 
www.some.com[\r][\n]"
2004/12/12 00:56:48:906 EST [DEBUG] header - ->> "[\r][\n]"
2004/12/12 00:56:49:546 EST [DEBUG] header - -<< "HTTP/1.0 200 OK[\r][\n]"
2004/12/12 00:56:49:546 EST [DEBUG] header - -<< "Date: Sat, 11 Dec 2004 
13:56:45 GMT[\r][\n]"
2004/12/12 00:56:49:562 EST [DEBUG] header - -<< "Server: 
Microsoft-IIS/6.0[\r][\n]"
2004/12/12 00:56:49:562 EST [DEBUG] header - -<< "X-Powered-By: 
ASP.NET[\r][\n]"
2004/12/12 00:56:49:562 EST [DEBUG] header - -<< "X-AspNet-Version: 
1.1.4322[\r][\n]"
2004/12/12 00:56:49:562 EST [DEBUG] header - -<< "Set-Cookie: 
ASP.NET_SessionId=yngm4yiquvheoobd12ppbjed; path=/[\r][\n]"
2004/12/12 00:56:49:562 EST [DEBUG] header - -<< "Cache-Control: 
private[\r][\n]"
2004/12/12 00:56:49:562 EST [DEBUG] header - -<< "Content-Type: text/html; 
charset=utf-8[\r][\n]"
2004/12/12 00:56:49:562 EST [DEBUG] header - -<< "Content-Length: 
28976[\r][\n]"
2004/12/12 00:56:49:562 EST [DEBUG] header - -<< "X-Cache: MISS from 
DigiDefense.com[\r][\n]"
2004/12/12 00:56:49:562 EST [DEBUG] header - -<< "Connection: close[\r][\n]"

2004/12/12 00:56:50:968 EST [DEBUG] header - ->> "POST /default.aspx 
HTTP/1.1[\r][\n]"
2004/12/12 00:56:50:968 EST [DEBUG] header - ->> "User-Agent: Jakarta 
Commons-HttpClient/3.0-beta1[\r][\n]"
2004/12/12 00:56:50:968 EST [DEBUG] header - ->> "Host: 
www.some.com[\r][\n]"
2004/12/12 00:56:50:968 EST [DEBUG] header - ->> "Cookie: $Version=0; 
ASP.NET_SessionId=yngm4yiquvheoobd12ppbjed; $Path=/[\r][\n]"
2004/12/12 00:56:50:968 EST [DEBUG] header - ->> "Cookie: $Version=0; 
SOME_CulturePref=en-AU[\r][\n]"
2004/12/12 00:56:50:968 EST [DEBUG] header - ->> "Content-Length: 
63[\r][\n]"
2004/12/12 00:56:50:968 EST [DEBUG] header - ->> "Content-Type: 
application/x-www-form-urlencoded[\r][\n]"
2004/12/12 00:56:50:968 EST [DEBUG] header - ->> "[\r][\n]"
2004/12/12 00:56:52:078 EST [DEBUG] header - -<< "HTTP/1.0 302 Moved 
Temporarily[\r][\n]"
2004/12/12 00:56:52:078 EST [DEBUG] header - -<< "Date: Sat, 11 Dec 2004 
13:56:47 GMT[\r][\n]"
2004/12/12 00:56:52:078 EST [DEBUG] header - -<< "Server: 
Microsoft-IIS/6.0[\r][\n]"
2004/12/12 00:56:52:078 EST [DEBUG] header - -<< "X-Powered-By: 
ASP.NET[\r][\n]"
2004/12/12 00:56:52:078 EST [DEBUG] header - -<< "X-AspNet-Version: 
1.1.4322[\r][\n]"
2004/12/12 00:56:52:078 EST [DEBUG] header - -<< "Location: 
/errorhandling/errorpage.aspx?ErrId=-500[\r][\n]"
2004/12/12 00:56:52:078 EST [DEBUG] header - -<< "Cache-Control: 
private[\r][\n]"
2004/12/12 00:56:52:078 EST [DEBUG] header - -<< "Content-Type: text/html; 
charset=utf-8[\r][\n]"
2004/12/12 00:56:52:078 EST [DEBUG] header - -<< "Content-Length: 
157[\r][\n]"
2004/12/12 00:56:52:078 EST [DEBUG] header - -<< "X-Cache: MISS from 
DigiDefense.com[\r][\n]"
2004/12/12 00:56:52:078 EST [DEBUG] header - -<< "Connection: close[\r][\n]"
2004/12/12 00:56:52:078 EST [INFO] HttpMethodDirector - -Redirect requested 
but followRedirects is disabled

I then create the cookie as follows with a date

Date d = Calendar.getInstance().getTime();
Cookie mycookie = new Cookie("www.some.com", "SOME_CulturePref", "en-AU", 
"/", d, false);

Below is the log for some reason the cookie doesn't get created

2004/12/12 01:05:16:921 EST [DEBUG] header - ->> "GET / HTTP/1.1[\r][\n]"
2004/12/12 01:05:16:937 EST [DEBUG] header - ->> "User-Agent: Jakarta 
Commons-HttpClient/3.0-beta1[\r][\n]"
2004/12/12 01:05:16:937 EST [DEBUG] header - ->> "Host: 
www.some.com[\r][\n]"
2004/12/12 01:05:16:937 EST [DEBUG] header - ->> "[\r][\n]"
2004/12/12 01:05:17:453 EST [DEBUG] header - -<< "HTTP/1.0 200 OK[\r][\n]"
2004/12/12 01:05:17:453 EST [DEBUG] header - -<< "Date: Sat, 11 Dec 2004 
14:05:13 GMT[\r][\n]"
2004/12/12 01:05:17:453 EST [DEBUG] header - -<< "Server: 
Microsoft-IIS/6.0[\r][\n]"
2004/12/12 01:05:17:453 EST [DEBUG] header - -<< "X-Powered-By: 
ASP.NET[\r][\n]"
2004/12/12 01:05:17:453 EST [DEBUG] header - -<< "X-AspNet-Version: 
1.1.4322[\r][\n]"
2004/12/12 01:05:17:453 EST [DEBUG] header - -<< "Set-Cookie: 
ASP.NET_SessionId=pbgmhc55awpattzxznv3xind; path=/[\r][\n]"
2004/12/12 01:05:17:453 EST [DEBUG] header - -<< "Cache-Control: 
private[\r][\n]"
2004/12/12 01:05:17:453 EST [DEBUG] header - -<< "Content-Type: text/html; 
charset=utf-8[\r][\n]"
2004/12/12 01:05:17:453 EST [DEBUG] header - -<< "Content-Length: 
28976[\r][\n]"
2004/12/12 01:05:17:468 EST [DEBUG] header - -<< "X-Cache: MISS from 
DigiDefense.com[\r][\n]"
2004/12/12 01:05:17:468 EST [DEBUG] header - -<< "Connection: close[\r][\n]"

2004/12/12 01:05:18:828 EST [DEBUG] header - ->> "POST /default.aspx 
HTTP/1.1[\r][\n]"
2004/12/12 01:05:18:843 EST [DEBUG] header - ->> "User-Agent: Jakarta 
Commons-HttpClient/3.0-beta1[\r][\n]"
2004/12/12 01:05:18:843 EST [DEBUG] header - ->> "Host: 
www.some.com[\r][\n]"
2004/12/12 01:05:18:843 EST [DEBUG] header - ->> "Cookie: $Version=0; 
ASP.NET_SessionId=pbgmhc55awpattzxznv3xind; $Path=/[\r][\n]"
2004/12/12 01:05:18:843 EST [DEBUG] header - ->> "Content-Length: 
63[\r][\n]"
2004/12/12 01:05:18:843 EST [DEBUG] header - ->> "Content-Type: 
application/x-www-form-urlencoded[\r][\n]"
2004/12/12 01:05:18:843 EST [DEBUG] header - ->> "[\r][\n]"
2004/12/12 01:05:19:921 EST [DEBUG] header - -<< "HTTP/1.0 302 Moved 
Temporarily[\r][\n]"
2004/12/12 01:05:19:921 EST [DEBUG] header - -<< "Date: Sat, 11 Dec 2004 
14:05:15 GMT[\r][\n]"
2004/12/12 01:05:19:921 EST [DEBUG] header - -<< "Server: 
Microsoft-IIS/6.0[\r][\n]"
2004/12/12 01:05:19:921 EST [DEBUG] header - -<< "X-Powered-By: 
ASP.NET[\r][\n]"
2004/12/12 01:05:19:921 EST [DEBUG] header - -<< "X-AspNet-Version: 
1.1.4322[\r][\n]"
2004/12/12 01:05:19:921 EST [DEBUG] header - -<< "Location: 
/errorhandling/errorpage.aspx?ErrId=-500[\r][\n]"
2004/12/12 01:05:19:921 EST [DEBUG] header - -<< "Cache-Control: 
private[\r][\n]"
2004/12/12 01:05:19:921 EST [DEBUG] header - -<< "Content-Type: text/html; 
charset=utf-8[\r][\n]"
2004/12/12 01:05:19:921 EST [DEBUG] header - -<< "Content-Length: 
157[\r][\n]"
2004/12/12 01:05:19:921 EST [DEBUG] header - -<< "X-Cache: MISS from 
DigiDefense.com[\r][\n]"
2004/12/12 01:05:19:921 EST [DEBUG] header - -<< "Connection: close[\r][\n]"
2004/12/12 01:05:19:937 EST [INFO] HttpMethodDirector - -Redirect requested 
but followRedirects is disabled
Any help greatly appreciated haven't run into these sorts of problems before 
with HttpClient.



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


Mime
View raw message