Hi all,
I'm seeing errors in my logs relating to parsing the expires date
value in a cookie:
09/08/07 10:26:46 WARN protocol.ResponseProcessCookies:137 - Invalid
cookie header: "Set-Cookie: IU=deleted; expires=Thu, 07 Aug 2008
17:26:45 GMT; path=/; domain=.yahoo.com". Unable to parse expires
attribute: Thu, 07 Aug 2008 17:26:45 GMT
I looked through the HtttpClient source, and it seems like if I've set
up my cookie policy properly, the above date would be parsed properly.
Here's now I'm setting up the cookie policy:
=================================================================
HttpParams params = new BasicHttpParams();
...
CookieSpecParamBean cookieParams = new CookieSpecParamBean(params);
cookieParams.setSingleHeader(true);
...
ClientConnectionManager cm = new ThreadSafeClientConnManager(params,
schemeRegistry);
DefaultHttpClient httpClient = new DefaultHttpClient(cm, params);
...
params = httpClient.getParams();
HttpClientParams.setCookiePolicy(params, CookiePolicy.BEST_MATCH);
=================================================================
But the above code was assembled from a few different snippets online,
IIRC. So maybe this isn't correct.
For example, in the "Choosing Cookie Policy" section of the tutorial
docs, it uses the setParameter() API to set the policy:
httpclient.getParams().setParameter(ClientPNames.COOKIE_POLICY,
CookiePolicy.RFC_2965);
I assume the two are equivalent, but any input would be appreciated.
Thanks,
-- Ken
--------------------------------------------
<http://ken-blog.krugler.org>
+1 530-265-2225
--------------------------
Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-210-6378