Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

It seems that Set-Cookie having an expiration format Mon, 25 Sep 2017 13:40:02 GMT could not be parsed my apache http client

Cookies which have expiration date in the format:

Thu, 01-Jan-1970 00:00:01 GMT  (please note - the dashes which are present in the date string here) - yes, these cookies DO PARSE FINE, but when a cookie with an expiration date for example:  
Mon, 25 Sep 2017 13:40:02 GMT   (note - no dashes present in the date string) is received - fails to be parsed by the client.

For them the client display the following warning and does not parse them at all subsequently are not found at all in the list of cookies received from the page. Here the warning message that the client is displaying for the "cookie without dashes"

The warning:

IX 26, 2016 11:16:16 AM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "Set-Cookie: visid_incap_11422=lpcj4/RwRCeGBn9ortCgElXZ6FcAAAAAQUIPAAAAAAB7xml6KSoKB40cUgb90fbD; expires=Mon, 25 Sep 2017 13:40:02 GMT; path=/; Domain=.gotodrueckglueck.com". Invalid 'expires' attribute: Mon, 25 Sep 2017 13:40:02 GMT

In case it does not get clear enough: My question is: can I workaround this problem in apache http client without writing my own Set-Cookie headers parser ?

Or is it a problem at all ?

Anyone knows, please, thank you ?

like image 979
Nikolai Tokludjanov Avatar asked Dec 05 '25 03:12

Nikolai Tokludjanov


1 Answers

I was able to fix this problem by adding

.setCookieSpec(CookieSpecs.STANDARD)

to the RequestConfig object.

like image 124
Nikolai Tokludjanov Avatar answered Dec 07 '25 16:12

Nikolai Tokludjanov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!