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

fix: incorrect handling of negative cookie.maxAge #1900 #1902

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

ksw2000
Copy link
Contributor

@ksw2000 ksw2000 commented Nov 14, 2024

This PR fixes issue #1900

According to RFC6265, a max-age value of 0 or less is valid and is interpreted as forcing the cookie to expire immediately.

In the Go net/http package, they set Max-Age to 0 when the cookie.MaxAge < 0.

Before the fix

net/http fasthttp
maxAge = 0 unset unset
maxAge > 0 Max-Age=maxAge Max-Age=maxAge
maxAge < 0 Max-Age=0 unset

After the fix

net/http fasthttp
maxAge = 0 unset unset
maxAge > 0 Max-Age=maxAge Max-Age=maxAge
maxAge < 0 Max-Age=0 Max-Age=0

@ksw2000 ksw2000 marked this pull request as ready for review November 14, 2024 12:44
@erikdubbelboer erikdubbelboer merged commit ed2d390 into valyala:master Nov 15, 2024
15 checks passed
@erikdubbelboer
Copy link
Collaborator

Thanks! Didn't see this before I replied to the issue : 🙈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants