Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@henricook
Copy link

@henricook henricook commented Apr 22, 2024

I had trouble parsing a 'discard cookie' Set-Cookie header from Play Framework which specified a Max-Age=0.

Upon examination http4s ignores cookies with a Max-Age that doesn't contain the characters 1-9. RFC 6265 is murky on this point, specifying both non-zero digits in the syntax but also saying that zero or lower numbers should be parsed in the prose of section 5.2.2. I think it's safe to say that setting a Max-Age=0 is common practice when invalidating a cookie.

The http4s client shouldn't then hide it from users in Responses by failing to parse, zero values should be permitted in the parser.

Copy link
Member

@rossabaker rossabaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an erratum in the spec about this. I think we could justify tolerating negative numbers for the same reason, but this fixes the real-world bug. 👍

@henricook
Copy link
Author

Thanks! Do I need to do anything to port the fix between release versions?

@rossabaker
Copy link
Member

Nope, we'll merge it forward into main.

@rossabaker rossabaker merged commit c2b3e6e into http4s:series/0.23 Apr 25, 2024
@henricook henricook deleted the maxage0 branch April 26, 2024 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:core series/0.23 PRs targeting 0.23.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants