Skip to content

Commit 17ffb8e

Browse files
authored
Update cookiejar.py
1 parent e7295a8 commit 17ffb8e

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

Lib/http/cookiejar.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
r"""HTTP cookie handling for web clients.
23
34
This module has (now fairly distant) origins in Gisle Aas' Perl module
@@ -1032,10 +1033,13 @@ def set_ok_domain(self, cookie, request):
10321033
if j == 0: # domain like .foo.bar
10331034
tld = domain[i+1:]
10341035
sld = domain[j+1:i]
1035-
if sld.lower() in ("co", "ac", "com", "edu", "org", "net",
1036-
"gov", "mil", "int", "aero", "biz", "cat", "coop",
1037-
"info", "jobs", "mobi", "museum", "name", "pro",
1038-
"travel", "eu") and len(tld) == 2:
1036+
known_slds = (
1037+
"co", "ac", "com", "edu", "org", "net",
1038+
"gov", "mil", "int", "aero", "biz", "cat", "coop",
1039+
"info", "jobs", "mobi", "museum", "name", "pro",
1040+
"travel", "eu", "tv", "or", "nom", "sch", "web",
1041+
)
1042+
if sld.lower() in known_slds and len(tld) == 2:
10391043
# domain like .co.uk
10401044
_debug(" country-code second level domain %s", domain)
10411045
return False

0 commit comments

Comments
 (0)