dakrone / clj-http

An idiomatic clojure http client wrapping the apache client. Officially supported version.
http://clojars.org/clj-http
MIT License
1.78k stars 408 forks source link

Invalid 'expires' attribute #587

Closed licht1stein closed 3 years ago

licht1stein commented 3 years ago

This was disccussed in a closed issue: https://github.com/dakrone/clj-http/issues/325 But the suggested work around doesn't solve it for me.

Error message when calling (clj-http.client/get url {:cookie-storage cs :cookie-policy :standard}):

Feb 14, 2021 5:22:48 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "Set-Cookie: visitor_id=95.164.50.126.1613316168336000; secure; path=/; expires=1644852168; domain=.upwork.com". Invalid 'expires' attribute: 1644852168
Execution error (MalformedCookieException) at org.apache.http.impl.cookie.BasicExpiresHandler/parse (BasicExpiresHandler.java:64).
Invalid 'expires' attribute: 1644852168

Strangely enough, when I try to slurp the same url from REPL I get the response. But when running with lein run I get this:

Syntax error (IOException) compiling at (C:\Users\mb\AppData\Local\Temp\form-init7270777496739998519.clj:1:105).
Server returned HTTP response code: 403 for URL:  ...

SOLVED: (clj-http.client/get url {:decode-cookies false :cookie-policy :none})

avikoren commented 3 years ago

I have the same issue:

 Unhandled org.apache.http.cookie.MalformedCookieException
   Invalid 'expires' attribute: Sat Jul 01 2023 00:00:00 GMT
licht1stein commented 3 years ago

It seems the right way to do it (if you don't care about cookies) was:

(clj-http.client/get url {:decode-cookies false :cookie-policy :none})