softwaremill / sttp

The Scala HTTP client you always wanted!
https://sttp.softwaremill.com
Apache License 2.0
1.46k stars 309 forks source link

Error: Expires cookie directive is not a valid RFC1123 or RFC850 datetime #2265

Closed johnagyekum closed 2 months ago

johnagyekum commented 3 months ago

Hello,

We have been using this library for a while now but have recently realized that a lot of request failures due to 'Expires cookie directive not being a valid RFC1123 or RFC850' occur.

Sample failure message is shown below; Expires cookie directive is not a valid RFC1123 or RFC850 datetime: Tue, 20-Aug-24 09:47:08 GMT

A bit of research indicates that the date format aligns with RFC 2822. Can the library be updated to include support for RFC 2822? RFC 2822 appears to be a newer version of the standard and support for it definitely be a welcomed addition/update to the library

adamw commented 2 months ago

I tried parsing a cookie with the date you provided and it works just fine (scala-cli script below):

//> using dep com.softwaremill.sttp.model::core:1.7.11

@main def main =
  println(sttp.model.headers.CookieWithMeta.parse("key=value; Expires=Tue, 20-Aug-24 09:47:08 GMT;"))

can you share some more details on where you see the error, and what version of sttp you are using?

johnagyekum commented 2 months ago

Thanks for the response.

From what you shared, the issue appears to be a version issue then. Currently using sttp v3.6.0 (which seems to have core:1.4.26) .

Can't immediately use a higher sttp version due to the java requirements.

Will close the issue for now but thanks for the assistance.

adamw commented 2 months ago

You should still be able to update the com.softwaremill.sttp.model / core dependency to 1.7.11 and see if the issue still exists. It's transitive from sttp-client.