You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Fuad Efendi (JIRA)" <ji...@apache.org> on 2009/12/03 03:17:20 UTC

[jira] Created: (HTTPCLIENT-896) CLONE -Parsing expires

CLONE -Parsing expires
----------------------

                 Key: HTTPCLIENT-896
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-896
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpCookie
            Reporter: Fuad Efendi


Seeing this very often:

 Invalid cookie header: "Set-Cookie: _asid=011e7014f5e7718e02d893335aa5a16e; path=/; expires=Wed, 16 May 2018 17:13:32 GMT". Unable to parse expires attribute: Wed, 16 May 2018 17:13:32 GMT

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (HTTPCLIENT-896) CLONE -Parsing expires

Posted by "Jörgen Rydenius (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-896?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12841541#action_12841541 ] 

Jörgen Rydenius commented on HTTPCLIENT-896:
--------------------------------------------

Oleg, you are correct that the Netscape Draft specification (http://curl.haxx.se/rfc/cookie_spec.html) specifies clearly that the date format is "Wdy, DD-Mon-YYYY HH:MM:SS GMT". But on the other hand, in the examples section of the same document, the only example header that contains "Expires" is the following:

Set-Cookie: CUSTOMER=WILE_E_COYOTE; path=/; expires=Wednesday, 09-Nov-99 23:12:40 GMT

Note that the weekday is fully spelled out and that the year is written as two digits only. I would say that the specification therefore makes the 2 or 4 digit year optional. I think NetscapeDraftSpec should reflect this. An example of a product that uses the 2 digit version is jetty. When using httpclient 4 talking to a jetty server, any Set-Cookie headers for persistent cookies will be interpreted as a 4 digit year in the date and the cookie will immediately be disregarded as expired by some 2,000 years or so. Httpclient 3 on the other hand had no problem understanding the persistent cookies from jetty. I filed a bug report https://bugs.eclipse.org/bugs/show_bug.cgi?id=304698 on jetty to change their date format, but on the other hand I also think httpclient 4 is too strict about the date format when even the original specification uses two alternatives.

Workaround is easy by setting CookieSpecPNames.DATE_PATTERNS, but I really think that products like jetty and httpclient should be compatible by default. Also, since the date format used by jetty is parsable but misinterpreted and disregarded by httpclient makes it especially hard to detect the first time on encounters the problem.

> CLONE -Parsing expires
> ----------------------
>
>                 Key: HTTPCLIENT-896
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-896
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpCookie
>            Reporter: Fuad Efendi
>
> Seeing this very often:
>  Invalid cookie header: "Set-Cookie: _asid=011e7014f5e7718e02d893335aa5a16e; path=/; expires=Wed, 16 May 2018 17:13:32 GMT". Unable to parse expires attribute: Wed, 16 May 2018 17:13:32 GMT

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (HTTPCLIENT-896) CLONE -Parsing expires

Posted by "Jörgen Rydenius (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-896?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12841765#action_12841765 ] 

Jörgen Rydenius commented on HTTPCLIENT-896:
--------------------------------------------

Separate issue opened as HTTPCLIENT-923.

> CLONE -Parsing expires
> ----------------------
>
>                 Key: HTTPCLIENT-896
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-896
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpCookie
>            Reporter: Fuad Efendi
>
> Seeing this very often:
>  Invalid cookie header: "Set-Cookie: _asid=011e7014f5e7718e02d893335aa5a16e; path=/; expires=Wed, 16 May 2018 17:13:32 GMT". Unable to parse expires attribute: Wed, 16 May 2018 17:13:32 GMT

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (HTTPCLIENT-896) CLONE -Parsing expires

Posted by "Fuad Efendi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-896?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12785384#action_12785384 ] 

Fuad Efendi commented on HTTPCLIENT-896:
----------------------------------------

The only difference is comma after day of week...

> CLONE -Parsing expires
> ----------------------
>
>                 Key: HTTPCLIENT-896
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-896
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpCookie
>            Reporter: Fuad Efendi
>
> Seeing this very often:
>  Invalid cookie header: "Set-Cookie: _asid=011e7014f5e7718e02d893335aa5a16e; path=/; expires=Wed, 16 May 2018 17:13:32 GMT". Unable to parse expires attribute: Wed, 16 May 2018 17:13:32 GMT

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (HTTPCLIENT-896) CLONE -Parsing expires

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-896?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCLIENT-896.
------------------------------------------

    Resolution: Won't Fix

The format of the cookie in question is compatible with the Netscape Draft specification only. The best match cookie policy correctly identifies the cookie as Netscape but parsing of the 'expires' attribute fails because the only date format permitted by the Netscape Draft is "EEE, dd MMM-yyyy-HH:mm:ss z". In order to make HttpClient accept cookies containing nonstandard 'expires' one should set valid date formats using 'http.protocol.cookie-datepatterns' parameter. See example:

-----
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"));
BestMatchSpecFactory factory = new BestMatchSpecFactory();
CookieSpec cookiespec = factory.newInstance(params);
BasicHeader header = new BasicHeader("Set-Cookie", 
        "asid=011e7014f5e7718e02d893335aa5a16e; path=/; " +
        "expires=Wed, 16 May 2018 17:13:32 GMT");
CookieOrigin origin = new CookieOrigin("localhost", 80, "/", false);
List<Cookie> cookies = cookiespec.parse(header, origin);
System.out.println(cookies);
-----

I guess the policy was made stricter sometime post 4.0-beta1

Hope this clarifies the situation somewhat

Oleg

> CLONE -Parsing expires
> ----------------------
>
>                 Key: HTTPCLIENT-896
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-896
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpCookie
>            Reporter: Fuad Efendi
>
> Seeing this very often:
>  Invalid cookie header: "Set-Cookie: _asid=011e7014f5e7718e02d893335aa5a16e; path=/; expires=Wed, 16 May 2018 17:13:32 GMT". Unable to parse expires attribute: Wed, 16 May 2018 17:13:32 GMT

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Issue Comment Edited: (HTTPCLIENT-896) CLONE -Parsing expires

Posted by "Fuad Efendi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-896?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12785384#action_12785384 ] 

Fuad Efendi edited comment on HTTPCLIENT-896 at 12/3/09 4:37 PM:
-----------------------------------------------------------------

The only difference is comma after day of week...

Thank you very much Oleg!

So, it is configurable, nothing to fix.

      was (Author: funtick):
    The only difference is comma after day of week...
  
> CLONE -Parsing expires
> ----------------------
>
>                 Key: HTTPCLIENT-896
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-896
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpCookie
>            Reporter: Fuad Efendi
>
> Seeing this very often:
>  Invalid cookie header: "Set-Cookie: _asid=011e7014f5e7718e02d893335aa5a16e; path=/; expires=Wed, 16 May 2018 17:13:32 GMT". Unable to parse expires attribute: Wed, 16 May 2018 17:13:32 GMT

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (HTTPCLIENT-896) CLONE -Parsing expires

Posted by "Fuad Efendi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-896?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12785148#action_12785148 ] 

Fuad Efendi commented on HTTPCLIENT-896:
----------------------------------------

I still see this problem in version 4.0 (loaded by Maven from Maven repository).

And I don't see this problem with version 4.0-beta3-SNAPSHOT (loaded by Maven from Apache repository).


09/12/02 21:01:31 WARN protocol.ResponseProcessCookies: Invalid cookie header: "Set-cookie: session-id-time=1260345600l; path=/; domain=.amazon.com; expires=Wed
 Dec 09 08:00:00 2009 GMT". Unable to parse expires attribute: Wed Dec 09 08:00:00 2009 GMT
09/12/02 21:01:31 WARN protocol.ResponseProcessCookies: Invalid cookie header: "Set-cookie: session-id=192-5799048-2819311; path=/; domain=.amazon.com; expires=
Wed Dec 09 08:00:00 2009 GMT". Unable to parse expires attribute: Wed Dec 09 08:00:00 2009 GMT



> CLONE -Parsing expires
> ----------------------
>
>                 Key: HTTPCLIENT-896
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-896
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpCookie
>            Reporter: Fuad Efendi
>
> Seeing this very often:
>  Invalid cookie header: "Set-Cookie: _asid=011e7014f5e7718e02d893335aa5a16e; path=/; expires=Wed, 16 May 2018 17:13:32 GMT". Unable to parse expires attribute: Wed, 16 May 2018 17:13:32 GMT

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (HTTPCLIENT-896) CLONE -Parsing expires

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-896?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12841583#action_12841583 ] 

Oleg Kalnichevski commented on HTTPCLIENT-896:
----------------------------------------------

Jörgen,

Please open a separate issue for this change request.

Oleg

> CLONE -Parsing expires
> ----------------------
>
>                 Key: HTTPCLIENT-896
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-896
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpCookie
>            Reporter: Fuad Efendi
>
> Seeing this very often:
>  Invalid cookie header: "Set-Cookie: _asid=011e7014f5e7718e02d893335aa5a16e; path=/; expires=Wed, 16 May 2018 17:13:32 GMT". Unable to parse expires attribute: Wed, 16 May 2018 17:13:32 GMT

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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