feat(cookie): expose storage host in Jar::get_all - #1269
Conversation
|
Lines 259 to 266 in 18436d1 This appears to be a regression after refactoring. This issue was supposedly fixed before, but the code got reverted. Could we restore this piece of code implemented in 6.0.0‑rc29? |
|
I had a look at the history on this. As far as I can tell that backfill changed in #1216, which swapped I think the problem is that writing the domain onto a host-only cookie widens its scope. If I export a cookie set for example.com and import it into a fresh jar, it starts going to api.example.com too: Path looks fine already, I might be missing what you actually need here though. What should |
|
In my use case, get_all is not actually required. Some users need it, and that’s why it exists. |
|
So should I keep |
|
A new |
Jar::get_all
Jar::get_all
get_all()loses the origin host of host-only cookies. It has to leaveDomainabsent so re-importing doesn't widen the scope, and the host itself only exists as the store's map key, so a snapshot can't be put back where it came from. The existingjar_get_all_export_import_keeps_host_only_scope_and_effective_pathtest hardcodes the origin URI for that reason.get_all_scoped()returns the same cookies plusdomain()andhost_only().domain()is in URI authority form, so it can be passed straight back toadd.get_all()is now amapover it and behaves exactly as before.Three tests added.
cargo test --lib --features cookiesand both doctests pass,cargo +nightly fmt --checkand clippy are clean.I hit this adding jar import to wreq-js: domain cookies restore, host-only ones can't.