https://github.com/python/cpython/commit/4a5d25c26c01a04c0ddef1a0b00cb55cc835034f
commit: 4a5d25c26c01a04c0ddef1a0b00cb55cc835034f
branch: main
author: Weilin Du <[email protected]>
committer: hugovk <[email protected]>
date: 2026-04-29T11:33:51Z
summary:
gh-135528: Support more second-level domain names in http.cookiejar (#135820)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
files:
A Misc/NEWS.d/next/Library/2025-06-22-16-29-10.gh-issue-135528.Rt_QhR.rst
M Lib/http/cookiejar.py
diff --git a/Lib/http/cookiejar.py b/Lib/http/cookiejar.py
index 68cf16c93cc1c8..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") 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
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..ab3855582c77ee
--- /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 "tv", "or", "nom", "sch", and "web" to the default
list of supported country code second-level domains.
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]