-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http: cookie without Expires
should be considered valid
#52989
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
Comments
The current behavior is probably explained, at least partially, by https://mrcoles.com/blog/cookies-max-age-vs-expires/. That is, by a desire to be compatible with old Microsoft Internet Explorer browsers and more modern browsers. I have no idea what the preferred trade-off is today vis-a-vis supporting ancient browsers, but any change of this nature requires careful consideration with regard to potentially breaking support for old, but not ancient, HTTP clients. |
@amitsaha Based on my understanding, as per RFC 6265 Section 4.1.2.2 and Section 5.3,
So, the patch should be at least like these, yes?
@krader1961 I believe the context here is cookie from client side (before it send), not server/browser side. |
See the proposal that adds this method: #46370. It's unfortunate that the minimal documentation is chosen. The commit message adds more context:
|
My concern is that the Also, my current context is when setting it from the server-side. |
That's unfortunate indeed. The method name, |
CC @neild |
I agree that |
Some automation will likely kick in, but i have created a PR: https://go-review.googlesource.com/c/go/+/338590/ - thanks all for the discussions and feedback. |
Change https://go.dev/cl/407654 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
For a cookie, it seems like both,
Expires
andMaxAge
must be specified? The expectation is that, onlyMaxAge
should be sufficient.// valid
// invalid
Example: https://go.dev/play/p/3PTUM6WKwWS
What did you expect to see?
I expected
Expires
field to be optional and henceValid()
should returnnil
for the second case too.What did you see instead?
Non-nil error:
Based on my understanding, this should be the fix:
I am happy to create a PR if this seems like a valid issue. Thanks.
The text was updated successfully, but these errors were encountered: