Skip to content
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

Proper handling of max-age and expires for cookies #10564

Merged

Conversation

straight-shoota
Copy link
Member

@straight-shoota straight-shoota commented Mar 31, 2021

Reissue of #7925. I can't add commits to the original PR, so this is a fresh and more focused start.

This patch adds max_age and creation_time properties to HTTP::Cookie which allow a more versatile handling of expiration times.

Resolves #5033
Closes #7925

Copy link
Member

@sdogruyol sdogruyol left a comment

Choose a reason for hiding this comment

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

Thank you @straight-shoota 🙏

Copy link
Member

@beta-ziliani beta-ziliani left a comment

Choose a reason for hiding this comment

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

just with a minor comment


it "sets future expiration_time with max-age" do
cookie = parse_set_cookie("bla=1; max-age=1")
(cookie.expiration_time.not_nil!).should be > Time.utc
Copy link
Member

Choose a reason for hiding this comment

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

Are these parentheses necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, I'll remove them.

@straight-shoota straight-shoota added this to the 1.2.0 milestone Aug 23, 2021
@straight-shoota straight-shoota merged commit 899eb63 into crystal-lang:master Aug 25, 2021
@straight-shoota straight-shoota deleted the patch/cookie-expiration branch August 25, 2021 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[rfc] Making HTTP::Cookie fully? comply with RFC 6265.
4 participants