-
Notifications
You must be signed in to change notification settings - Fork 22
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
Remove cookie doesn't seem to work in sub-sub paths like '/foo/bar' #34
Comments
Hi :) Sorry for the late response. Let me know if you've solved this already. I remember there was already an issue when someone tried to remove the cookie using the extracted one. I guess it's about the path, notice it's
If I just create a new cookie the code works: private_cookies.remove(create_cookie()); But I personally always call Cookie::make_removal just in case. I don't have time right now to investigate the issue. But if you'd like to dig into it, I'd start with trying to reproduce the bug using just underlying cookie::CookieJar to be sure the bug is belong to this crate. |
No worries!:) Haven't solved it, but great discovery about the extracted one being the issue here. I did a small test with fn test() {
use cookie::{Cookie, CookieJar};
let mut jar = CookieJar::new();
let ck = Cookie::build(("name", "gnu")).path("/").build();
jar.add(ck.clone());
let gck = jar.get("name").unwrap();
println!("{:?}\n", ck);
println!("{:?}", gck);
} this will print out this:
Which compared to the |
I noticed that removing cookies didn't work for me, and after troubleshooting I think I have identified it as being related to the paths.
When you remove cookies, the remove part just sets the
max_age
andexpired
, but ignores thepath
.This seems to work if it's just
/
or/foo
, but not if there's any more paths for some reason.Here's an example that doesn't work, based on the private/signed example,
it should create and remove the cookie every other turn, but it doesn't work.
Change the path to just
/
or/foo
and it works.I am aware i specify the path when building the cookie, but that should not break it, as that makes the
remove
"unstable".The text was updated successfully, but these errors were encountered: