In an android application, when using DefaultHttpClient to get an URL content (executing HttpGet) I receive the following warning in logs:
W/ResponseProcessCookies(20386): Invalid cookie header: "Set-Cookie: NSC_vbue_iuuq=ffff660; expires=; domain=private.false.name; path=/; isSecure=false". Unable to parse expires attribute:
I understand the warning because the expires field does not contain a valid date format. I understand it maybe because it is a ‘session cookie’ (without being expert). Thread about similar situation in Curl context
Searching the web I found mainly the
.setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.BEST_MATCH (or other) )
option to avoid warning by parsing correctly dates that contain a comma.
However, I would like to avoid that log. (not by disabling logs)
I believe internally all is fine since “I GUESS”, cookie.setExpiryDate() is simply not called.
Do you think I need a specific configuration of my HTTP client (I’ve not set specific configurations) to avoid that warning or to support empty expires?
Thanks.
If you do not mind altering the
CookieSpecyou can supply your own, more lenient, subclass.First, create a lenient
CookieSpecthat will acceptnulland empty values for theexpiresattribute, like this:Now you need to register & choose this new
CookieSpecin your HTTP client.Something “like this” could work for you.