From 17ffb8e6870429a825d8d37a5575494bcbd9eb4e Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Mon, 23 Jun 2025 00:22:20 +0800 Subject: [PATCH 1/5] Update cookiejar.py --- Lib/http/cookiejar.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Lib/http/cookiejar.py b/Lib/http/cookiejar.py index 68cf16c93cc1c8..0110fb984f83d8 100644 --- a/Lib/http/cookiejar.py +++ b/Lib/http/cookiejar.py @@ -1,3 +1,4 @@ + r"""HTTP cookie handling for web clients. This module has (now fairly distant) origins in Gisle Aas' Perl module @@ -1032,10 +1033,13 @@ def set_ok_domain(self, cookie, request): if j == 0: # domain like .foo.bar tld = domain[i+1:] sld = domain[j+1:i] - if sld.lower() in ("co", "ac", "com", "edu", "org", "net", - "gov", "mil", "int", "aero", "biz", "cat", "coop", - "info", "jobs", "mobi", "museum", "name", "pro", - "travel", "eu") and len(tld) == 2: + known_slds = ( + "co", "ac", "com", "edu", "org", "net", + "gov", "mil", "int", "aero", "biz", "cat", "coop", + "info", "jobs", "mobi", "museum", "name", "pro", + "travel", "eu", "tv", "or", "nom", "sch", "web", + ) + if sld.lower() in known_slds and len(tld) == 2: # domain like .co.uk _debug(" country-code second level domain %s", domain) return False From 2d7223823e9b953ac67d81389b117d2f8515bd89 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sun, 22 Jun 2025 16:29:11 +0000 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2025-06-22-16-29-10.gh-issue-135528.Rt_QhR.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2025-06-22-16-29-10.gh-issue-135528.Rt_QhR.rst diff --git a/Misc/NEWS.d/next/Library/2025-06-22-16-29-10.gh-issue-135528.Rt_QhR.rst b/Misc/NEWS.d/next/Library/2025-06-22-16-29-10.gh-issue-135528.Rt_QhR.rst new file mode 100644 index 00000000000000..a09ea9a4d07c09 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-06-22-16-29-10.gh-issue-135528.Rt_QhR.rst @@ -0,0 +1 @@ +:mod:`http.cookiejar`: add new attribute additional_country_code_slds in DefaultPolicy to support customization in country code second-level domains and add "tv", "or", "nom", "sch", and "web" to the default list of supported country code second-level domains. From 53c443273e88d80c0b8c1e911eed5cd29bb78b61 Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Mon, 23 Jun 2025 00:31:03 +0800 Subject: [PATCH 3/5] Update 2025-06-22-16-29-10.gh-issue-135528.Rt_QhR.rst --- .../next/Library/2025-06-22-16-29-10.gh-issue-135528.Rt_QhR.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2025-06-22-16-29-10.gh-issue-135528.Rt_QhR.rst b/Misc/NEWS.d/next/Library/2025-06-22-16-29-10.gh-issue-135528.Rt_QhR.rst index a09ea9a4d07c09..cafb4259c7119b 100644 --- a/Misc/NEWS.d/next/Library/2025-06-22-16-29-10.gh-issue-135528.Rt_QhR.rst +++ b/Misc/NEWS.d/next/Library/2025-06-22-16-29-10.gh-issue-135528.Rt_QhR.rst @@ -1 +1 @@ -:mod:`http.cookiejar`: add new attribute additional_country_code_slds in DefaultPolicy to support customization in country code second-level domains and add "tv", "or", "nom", "sch", and "web" to the default list of supported country code second-level domains. +:mod:`http.cookiejar`: aadd "tv", "or", "nom", "sch", and "web" to the default list of supported country code second-level domains. From 6be3c4dfd722bdeb9d02c86ef165c4a1b62a950a Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Mon, 23 Jun 2025 00:31:15 +0800 Subject: [PATCH 4/5] Update 2025-06-22-16-29-10.gh-issue-135528.Rt_QhR.rst --- .../next/Library/2025-06-22-16-29-10.gh-issue-135528.Rt_QhR.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2025-06-22-16-29-10.gh-issue-135528.Rt_QhR.rst b/Misc/NEWS.d/next/Library/2025-06-22-16-29-10.gh-issue-135528.Rt_QhR.rst index cafb4259c7119b..ab3855582c77ee 100644 --- a/Misc/NEWS.d/next/Library/2025-06-22-16-29-10.gh-issue-135528.Rt_QhR.rst +++ b/Misc/NEWS.d/next/Library/2025-06-22-16-29-10.gh-issue-135528.Rt_QhR.rst @@ -1 +1 @@ -:mod:`http.cookiejar`: aadd "tv", "or", "nom", "sch", and "web" to the default list of supported country code second-level domains. +:mod:`http.cookiejar`: add "tv", "or", "nom", "sch", and "web" to the default list of supported country code second-level domains. From 919487685dbcb19365a0f58dc2726afc143a58bb Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Mon, 23 Jun 2025 00:31:47 +0800 Subject: [PATCH 5/5] Update cookiejar.py --- Lib/http/cookiejar.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Lib/http/cookiejar.py b/Lib/http/cookiejar.py index 0110fb984f83d8..13e5b104a81ea2 100644 --- a/Lib/http/cookiejar.py +++ b/Lib/http/cookiejar.py @@ -1,4 +1,3 @@ - r"""HTTP cookie handling for web clients. This module has (now fairly distant) origins in Gisle Aas' Perl module