8000 Workaround for instantiating CookieStore by algesten · Pull Request #1063 · algesten/ureq · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Workaround for instantiating CookieStore #1063

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

Merged
merged 1 commit into from
Apr 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
8000 Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unreleased

* Fix featue flag `public_suffix` for CookieStore (#1063)
* Improve doc for 10MB limit (#1061)

# 3.0.11
Expand Down
13 changes: 12 additions & 1 deletion src/cookies.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::borrow::Cow;
use std::fmt;
use std::iter;
use std::sync::{Mutex, MutexGuard};

use cookie_store::CookieStore;
Expand Down Expand Up @@ -168,10 +169,20 @@ impl<'a> CookieJar<'a> {
pub fn release(self) {}
}

// CookieStore::new() changes parameters depending on feature flag "public_suffix".
// That means if a user enables public_suffix for CookieStore through diamond dependency,
// we start having compilation errors un ureq.
//
// This workaround instantiates a CookieStore in a way that does not change with flags.
fn instantiate_cookie_store() -> CookieStore {
let i = iter::empty::<Result<cookie_store::Cookie<'static>, &str>>();
CookieStore::from_cookies(i, true).unwrap()
}

impl SharedCookieJar {
pub(crate) fn new() -> Self {
SharedCookieJar {
inner: Mutex::new(CookieStore::new()),
inner: Mutex::new(instantiate_cookie_store()),
}
}

Expand Down
0