hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCLIENT-1640) Failed to parse cookie max-age attribute
Date Wed, 15 Apr 2015 13:54:59 GMT

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14496194#comment-14496194
] 

Oleg Kalnichevski commented on HTTPCLIENT-1640:
-----------------------------------------------

Works for me. Did you configure HttpClient or HttpRequest to use 'standard' policy instead
of 'default'? HC 4.4 still uses an old policy incompatible with RFC6265 by default:

{noformat}
[DEBUG] RequestAddCookies - CookieSpec selected: standard
[DEBUG] RequestAuthCache - Auth cache not set in the context
[DEBUG] PoolingHttpClientConnectionManager - Connection request: [route: {}->http://bit.ly:80][total
kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
[DEBUG] PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: {}->http://bit.ly:80][total
kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] MainClientExec - Opening connection {}->http://bit.ly:80
[DEBUG] DefaultHttpClientConnectionOperator - Connecting to bit.ly/69.58.188.39:80
[DEBUG] DefaultHttpClientConnectionOperator - Connection established 10.0.0.8:44769<->69.58.188.39:80
[DEBUG] MainClientExec - Executing request GET /1Oy8Eho HTTP/1.1
[DEBUG] MainClientExec - Target auth state: UNCHALLENGED
[DEBUG] MainClientExec - Proxy auth state: UNCHALLENGED
[DEBUG] headers - http-outgoing-0 >> GET /1Oy8Eho HTTP/1.1
[DEBUG] headers - http-outgoing-0 >> Host: bit.ly
[DEBUG] headers - http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] headers - http-outgoing-0 >> User-Agent: Apache-HttpClient/4.4.1 (Java/1.7.0_75)
[DEBUG] headers - http-outgoing-0 >> Accept-Encoding: gzip,deflate
[DEBUG] headers - http-outgoing-0 << HTTP/1.1 301 Moved Permanently
[DEBUG] headers - http-outgoing-0 << Server: nginx
[DEBUG] headers - http-outgoing-0 << Date: Wed, 15 Apr 2015 13:49:42 GMT
[DEBUG] headers - http-outgoing-0 << Content-Type: text/html; charset=utf-8
[DEBUG] headers - http-outgoing-0 << Content-Length: 200
[DEBUG] headers - http-outgoing-0 << Connection: keep-alive
[DEBUG] headers - http-outgoing-0 << Cache-Control: private, max-age=90
[DEBUG] headers - http-outgoing-0 << Location: http://www.theaustralian.com.au/business/latest/dropbox-microsoft-deepen-integration/story-e6frg90f-1227301360790
[DEBUG] headers - http-outgoing-0 << Mime-Version: 1.0
[DEBUG] headers - http-outgoing-0 << Set-Cookie: _bit=552e6c76-0003e-05cf8-291cf10a;domain=.bit.ly;expires=Mon
Oct 12 13:49:42 2015;path=/; HttpOnly
[DEBUG] MainClientExec - Connection can be kept alive indefinitely
[DEBUG] ResponseProcessCookies - Cookie accepted [_bit="552e6c76-0003e-05cf8-291cf10a", version:0,
domain:bit.ly, path:/, expiry:null]
[DEBUG] DefaultRedirectStrategy - Redirect requested to location 'http://www.theaustralian.com.au/business/latest/dropbox-microsoft-deepen-integration/story-e6frg90f-1227301360790'
{noformat}

Oleg

> Failed to parse cookie max-age attribute 
> -----------------------------------------
>
>                 Key: HTTPCLIENT-1640
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1640
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpCookie
>    Affects Versions: 4.4.1
>            Reporter: Ivan Shcheklein
>
> [Url to reproduce|http://bit.ly/1Oy8Eho] (need to follow redirects)
> Logs:
> {{2015:04:15 00:47:10,467 [WARN ] org.apache.http.client.protocol.ResponseProcessCookies
- Invalid cookie header: "Set-Cookie: sr=true; path=/; expires=Tue, 14 Apr 2015 21:36:16 GMT;
max-age=30;". Invalid 'expires' attribute: 30}}
> {{RFC6265CookieSpecBase}} tries to parse max-age value with {{LaxExpiresHandler}} that
expects value to be in a cookie-date format, as far I understand. Meanwhile [RFC6265 states|http://tools.ietf.org/html/rfc6265#page-20]:
> "... Append an attribute to the cookie-attribute-list with an attribute-name of Max-Age
and an attribute-value of expiry-time..."
> [It seems|http://tools.ietf.org/html/rfc6265#page-19] it should just ignore invalid expires
value anyway:
> "...If the attribute-value failed to parse as a cookie date, ignore the
>    cookie-av..."



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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


Mime
View raw message