update cookie dep

This commit is contained in:
Nikolay Kim 2021-03-06 16:39:37 +06:00
parent 94cc4b8ce1
commit bb3816f002
7 changed files with 19 additions and 16 deletions

View file

@ -21,10 +21,10 @@ default = ["cookie-policy"]
cookie-policy = ["cookie/secure", "ntex/cookie"]
[dependencies]
ntex = "0.3.2"
ntex = "0.3.5"
futures = "0.3.13"
serde = "1.0"
serde_json = "1.0"
cookie = "0.14.2"
derive_more = "0.99.11"
cookie = { version = "0.15", features = ["private"] }
time = { version = "0.2.5", default-features = false, features = ["std"] }

View file

@ -393,10 +393,10 @@ impl<Err: ErrorRenderer> CookieIdentityInner<Err> {
let mut jar = CookieJar::new();
let key = if self.legacy_supported() { &self.key } else { &self.key_v2 };
if add_cookie {
jar.private(&key).add(cookie);
jar.private_mut(&key).add(cookie);
} else {
jar.add_original(cookie.clone());
jar.private(&key).remove(cookie);
jar.private_mut(&key).remove(cookie);
}
for cookie in jar.delta() {
let val = HeaderValue::from_str(&cookie.to_string()).map_err(HttpError::from)?;
@ -761,7 +761,7 @@ mod tests {
fn legacy_login_cookie(identity: &'static str) -> Cookie<'static> {
let mut jar = CookieJar::new();
jar.private(&Key::derive_from(&COOKIE_KEY_MASTER))
jar.private_mut(&Key::derive_from(&COOKIE_KEY_MASTER))
.add(Cookie::new(COOKIE_NAME, identity));
jar.get(COOKIE_NAME).unwrap().clone()
}
@ -774,7 +774,7 @@ mod tests {
let mut jar = CookieJar::new();
let key: Vec<u8> =
COOKIE_KEY_MASTER.iter().chain([1, 0, 0, 0].iter()).map(|e| *e).collect();
jar.private(&Key::derive_from(&key)).add(Cookie::new(
jar.private_mut(&Key::derive_from(&key)).add(Cookie::new(
COOKIE_NAME,
serde_json::to_string(&CookieValue {
identity: identity.to_string(),