]> git.proxmox.com Git - debcargo-conf.git/commitdiff
cookie-store - patch for publicsuffix 1
authorPeter Michael Green <plugwash@debian.org>
Sat, 18 Jun 2022 22:22:55 +0000 (22:22 +0000)
committerPeter Michael Green <plugwash@debian.org>
Sat, 18 Jun 2022 22:26:32 +0000 (22:26 +0000)
src/cookie-store/debian/changelog
src/cookie-store/debian/patches/publicsuffix-1.patch [new file with mode: 0644]
src/cookie-store/debian/patches/series [new file with mode: 0644]

index a0ab984dfc59270c1a1141a22a76fb1cbd08c862..d4588a7439828d980fd2c2dd400d040091cec645 100644 (file)
@@ -1,6 +1,8 @@
 rust-cookie-store (0.16.1-1) UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; urgency=medium
 
   * Package cookie_store 0.16.1 from crates.io using debcargo 2.5.0
+  * Add patch to continue using publicsuffix 1, publicsuffix 2 requires
+    a new package.
 
   [ Ximin Luo ]
   * Team upload.
diff --git a/src/cookie-store/debian/patches/publicsuffix-1.patch b/src/cookie-store/debian/patches/publicsuffix-1.patch
new file mode 100644 (file)
index 0000000..51f20eb
--- /dev/null
@@ -0,0 +1,56 @@
+This patch is based on a revert of upstream commit 
+f0da3a7d3af00d2fbc4486e50e5a2c8936e561a8 adapted by Peter Michael Green
+for use in the Debian package.
+
+Index: cookie-store/src/cookie_domain.rs
+===================================================================
+--- cookie-store.orig/src/cookie_domain.rs
++++ cookie-store/src/cookie_domain.rs
+@@ -2,7 +2,7 @@ use std;
+ use cookie::Cookie as RawCookie;
+ use idna;
+-use publicsuffix::{List, Psl, Suffix};
++use publicsuffix;
+ use serde::{Deserialize, Serialize};
+ use std::convert::TryFrom;
+ use url::{Host, Url};
+@@ -95,14 +95,16 @@ impl CookieDomain {
+     /// Tests if the domain-attribute is a public suffix as indicated by the provided
+     /// `publicsuffix::List`.
+-    pub fn is_public_suffix(&self, psl: &List) -> bool {
+-        if let Some(domain) = self.as_cow().as_ref().map(|d| d.as_bytes()) {
+-            psl.suffix(domain)
+-                // Only consider suffixes explicitly listed in the public suffix list
+-                // to avoid issues like https://github.com/curl/curl/issues/658
+-                .filter(Suffix::is_known)
+-                .filter(|suffix| suffix == &domain)
+-                .is_some()
++    pub fn is_public_suffix(&self, psl: &publicsuffix::List) -> bool {
++        if let Some(domain) = self.as_cow() {
++            // NB: a failure to parse the domain for publicsuffix usage probably indicates
++            // an over-all malformed Domain attribute. However, for the purposes of this test
++            // it suffices to indicate that the domain-attribute is not a public suffix, so we
++            // discard any such error via `.ok()`
++            psl.parse_domain(&domain)
++                .ok()
++                .and_then(|d| d.suffix().map(|d| d == domain))
++                .unwrap_or(false)
+         } else {
+             false
+         }
+Index: cookie-store/Cargo.toml
+===================================================================
+--- cookie-store.orig/Cargo.toml
++++ cookie-store/Cargo.toml
+@@ -52,7 +52,8 @@ optional = true
+ version = "0.4.14"
+ [dependencies.publicsuffix]
+-version = "2.1.1"
++version = "1.5"
++default-features = false
+ [dependencies.serde]
+ version = "1.0.136"
diff --git a/src/cookie-store/debian/patches/series b/src/cookie-store/debian/patches/series
new file mode 100644 (file)
index 0000000..8ab8da0
--- /dev/null
@@ -0,0 +1 @@
+publicsuffix-1.patch