You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Eric Lentz <ia...@gmail.com> on 2009/12/22 15:17:20 UTC

Unable to parse expires attribute (for date: Wed, 19 Feb 2020 14:28:00 GMT)

I'm getting the following when hitting a page on a server using .NET (note
the invalid cookie "WARN" message):

DEBUG headers - << Set-Cookie: v1st=F12FAB888FFB840D; path=/; expires=Wed,
19 Feb 2020 14:28:00 GMT; domain=.hiddenname.com

DEBUG headers - << Date: Mon, 21 Dec 2009 14:16:29 GMT

WARN  ResponseProcessCookies - Invalid cookie header: "Set-Cookie:
v1st=F12FAB888FFB840D; path=/; expires=Wed, 19 Feb 2020 14:28:00 GMT;
domain=.hiddenname.com". Unable to parse expires attribute: Wed


Is there any way around this or is this a bug? It appears that I need this
cookie in order to be properly recognized as a signed on user.

Re: Unable to parse expires attribute (for date: Wed, 19 Feb 2020 14:28:00 GMT)

Posted by Ken Krugler <kk...@transpac.com>.
Hi Eric,

On Dec 22, 2009, at 6:17am, Eric Lentz wrote:

> I'm getting the following when hitting a page on a server using .NET  
> (note
> the invalid cookie "WARN" message):
>
> DEBUG headers - << Set-Cookie: v1st=F12FAB888FFB840D; path=/;  
> expires=Wed,
> 19 Feb 2020 14:28:00 GMT; domain=.hiddenname.com
>
> DEBUG headers - << Date: Mon, 21 Dec 2009 14:16:29 GMT
>
> WARN  ResponseProcessCookies - Invalid cookie header: "Set-Cookie:
> v1st=F12FAB888FFB840D; path=/; expires=Wed, 19 Feb 2020 14:28:00 GMT;
> domain=.hiddenname.com". Unable to parse expires attribute: Wed
>
>
> Is there any way around this or is this a bug? It appears that I  
> need this
> cookie in order to be properly recognized as a signed on user.


See https://issues.apache.org/jira/browse/HTTPCLIENT-896 for more  
details on a similar (same?) issue.

Oleg responded to this with:

> The cookie in question violates the format of 'expires' attribute
> expected by the Netscape policy. One can configure the policy to be  
> more
> lenient about the format of 'expires' attribute by using a special  
> HTTP
> parameter. For details see HTTPCLIENT-896.
>
> It is not really a regression. I think the Netscape cookie policy was
> made stricter at some point of time post 4.0-beta1

So to make the policy more lenient, I believe you could do something  
like:
BasicHttpParams params = new BasicHttpParams();
params.setParameter(CookieSpecPNames.DATE_PATTERNS,
         Arrays.asList("EEE, dd MMM-yyyy-HH:mm:ss z", "EEE, dd MMM  
yyyy HH:mm:ss z"));

-- Ken

--------------------------------------------
Ken Krugler
+1 530-210-6378
http://bixolabs.com
e l a s t i c   w e b   m i n i n g