-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
login fails b/c of malformed cookie #4
Comments
FWIW clj-http defaults to BrowserCompatSpec for cookie policy. They added the ability to change it, and I tried various alternatives ( IgnoreSpec, BestMatchSpec, etc ) but no success handling the negative max age. I ended up hacking clj_http/cookies.clj to diddle the returned cookie to replace the max-age value with something acceptable. I'm not sure this can be fixed in reddit.clj b/c the exception/crash happens in clj-http. Although maybe we could add something to catch the MalformedCookieException in reddit.clj/core and do the hack there, I'm not sure. |
hmm, perhaps we need to parse the cookie as http header, manually. |
They hardly allow you to change the cookie policy. They let you change the validate function on BrowserCompatSpec and that's it. This error is coming out of the parse function. I might put in an issue with clj-http to allow deeper configuration of the cookie policy. It's silly to have an option for "cookie-policy" that only lets you override one function. |
So what's the workaround for this? I am getting a full error, it's not just a warning:
|
I will take a look. We can also press the issue with reddit, since afaict negative max-age violates RFC2109, though I'm not sure how responsive they are. |
WARNING: Invalid cookie header: "set-cookie: secure_session=; Domain=reddit.com; Max-Age=-1408921027; Path=/; expires=Thu, 01-Jan-1970 00:00:01 GMT; HttpOnly". Negative max-age attribute: -1408921027
Exception in thread "main" org.apache.http.cookie.MalformedCookieException: Negative max-age attribute: -1408921027, compiling:(reddit.clj:5:9)
[...]
Caused by: org.apache.http.cookie.MalformedCookieException: Negative max-age attribute: -1408921027
The text was updated successfully, but these errors were encountered: