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

Cookie not evicted when following redirects #840

Closed
pankgeorg opened this issue Jun 7, 2022 · 2 comments
Closed

Cookie not evicted when following redirects #840

pankgeorg opened this issue Jun 7, 2022 · 2 comments

Comments

@pankgeorg
Copy link

pankgeorg commented Jun 7, 2022

  • Julia 1.7.1
  • HTTP.jl 0.9.17
  • MbedTLS.jl 1.0.3

https://httpwg.org/specs/rfc6265.html#sane-set-cookie-semantics

If the user agent receives a new cookie with the same cookie-name, domain-value, and path-value as a cookie that it has already stored, the existing cookie is evicted and replaced with the new cookie. Notice that servers can delete cookies by sending the user agent a new cookie with an Expires attribute with a value in the past.

Assume a cookie is set in a cookie jar with

[200] Set-Cookie: session=alD|165|Sm4; Expires=Tue, 14 Jun 2022 18:58:28 GMT; Max-Age=604800; Domain=example.dev; Path=/; SameSite=Lax; Secure; HttpOnly

If a request is done as follows: HTTP.request(; redirect=true, cookiejar=cookiejar) and the first response is a 302 with a Set-Cookie like this

[302] Set-Cookie: session=alD|166|rO2; Expires=Tue, 14 Jun 2022 18:58:29 GMT; Max-Age=604800; Domain=example.dev; Path=/; SameSite=Lax; Secure; HttpOnly

Then the second request will be sent with a cookie that includes both cookies, without evicting the first one.

[nxt] Cookie:     session=alD|165|Sm4; session=alD|166|rO2; 
@pankgeorg pankgeorg changed the title Following 3XX redirects with multiple Set-Cookie breaks cookiejar Request goes out with multiple cookies when cookies=true, redirect=true and the 3XX responses include Set-Cookie Jun 7, 2022
@pankgeorg pankgeorg changed the title Request goes out with multiple cookies when cookies=true, redirect=true and the 3XX responses include Set-Cookie Cookie not evicted when following redirects Jun 7, 2022
@quinnj
Copy link
Member

quinnj commented Jun 7, 2022

This should be fixed on master; sorry about the slow release, but there have been a few breaking changes merged and we're getting close to a 1.0 release. If you're able to test it out on the master branch, that'd be great to ensure it is indeed fixed (you can checkout the branch by doing ] add HTTP#master).

@pankgeorg
Copy link
Author

This should be fixed on master; sorry about the slow release, but there have been a few breaking changes merged and we're getting close to a 1.0 release. If you're able to test it out on the master branch, that'd be great to ensure it is indeed fixed (you can checkout the branch by doing ] add HTTP#master).

No worries. Indeed it looks fixed on master, thanks!

@quinnj quinnj closed this as completed Jun 10, 2022
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

No branches or pull requests

2 participants