From 6a614530e3167e663e97fbe9d95a26d1b5bf0f97 Mon Sep 17 00:00:00 2001 From: LamentXU <108666168+LamentXU123@users.noreply.github.com> Date: Sun, 15 Jun 2025 11:34:23 +0800 Subject: [PATCH 1/4] Update cookiejar.py --- Lib/http/cookiejar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/http/cookiejar.py b/Lib/http/cookiejar.py index 68cf16c93cc1c8..6dac96192377fc 100644 --- a/Lib/http/cookiejar.py +++ b/Lib/http/cookiejar.py @@ -1035,7 +1035,7 @@ def set_ok_domain(self, cookie, request): 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: + "travel", "eu", "tv", "or", "nom", "sch", "web") and len(tld) == 2: # domain like .co.uk _debug(" country-code second level domain %s", domain) return False From b5047643717cea69824dfd4bbcd441077006d7c4 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sun, 15 Jun 2025 03:38:14 +0000 Subject: [PATCH 2/4] =?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-15-03-38-13.gh-issue-135528.XssMeM.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2025-06-15-03-38-13.gh-issue-135528.XssMeM.rst diff --git a/Misc/NEWS.d/next/Library/2025-06-15-03-38-13.gh-issue-135528.XssMeM.rst b/Misc/NEWS.d/next/Library/2025-06-15-03-38-13.gh-issue-135528.XssMeM.rst new file mode 100644 index 00000000000000..34ddb5f1f9b9df --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-06-15-03-38-13.gh-issue-135528.XssMeM.rst @@ -0,0 +1 @@ +:mod:`http.cookiejar`: supporting more Country-code second-level domains From 2f14c9ecfdc7e416e3ff392eaa8736a54fda5b5b Mon Sep 17 00:00:00 2001 From: LamentXU <108666168+LamentXU123@users.noreply.github.com> Date: Sun, 15 Jun 2025 19:40:06 +0800 Subject: [PATCH 3/4] Update Misc/NEWS.d/next/Library/2025-06-15-03-38-13.gh-issue-135528.XssMeM.rst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> --- .../Library/2025-06-15-03-38-13.gh-issue-135528.XssMeM.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2025-06-15-03-38-13.gh-issue-135528.XssMeM.rst b/Misc/NEWS.d/next/Library/2025-06-15-03-38-13.gh-issue-135528.XssMeM.rst index 34ddb5f1f9b9df..5a01cfeb489a2e 100644 --- a/Misc/NEWS.d/next/Library/2025-06-15-03-38-13.gh-issue-135528.XssMeM.rst +++ b/Misc/NEWS.d/next/Library/2025-06-15-03-38-13.gh-issue-135528.XssMeM.rst @@ -1 +1,2 @@ -:mod:`http.cookiejar`: supporting more Country-code second-level domains +:mod:`http.cookiejar`: add "tv", "or", "nom", "sch", and "web" +to the list of supported country code second-level domains. From 49278e9fd7f39780530a11ce5b8a68e9c37b6c57 Mon Sep 17 00:00:00 2001 From: LamentXU <108666168+LamentXU123@users.noreply.github.com> Date: Sun, 15 Jun 2025 20:18:58 +0800 Subject: [PATCH 4/4] Update cookiejar.py --- Lib/http/cookiejar.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Lib/http/cookiejar.py b/Lib/http/cookiejar.py index 6dac96192377fc..13e5b104a81ea2 100644 --- a/Lib/http/cookiejar.py +++ b/Lib/http/cookiejar.py @@ -1032,10 +1032,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", "tv", "or", "nom", "sch", "web") 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