summaryrefslogtreecommitdiffstats
path: root/Lib/cookielib.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-05-07 20:44:34 (GMT)
committerGeorg Brandl <georg@python.org>2006-05-07 20:44:34 (GMT)
commite58334ae9e4a635794ff0605f125eec459b9b98f (patch)
tree39bb6ab47211a994a9f216ea1329a09c57d610d9 /Lib/cookielib.py
parent090196513467ab5e329d15579b6b64ba88106ecf (diff)
downloadcpython-e58334ae9e4a635794ff0605f125eec459b9b98f.zip
cpython-e58334ae9e4a635794ff0605f125eec459b9b98f.tar.gz
cpython-e58334ae9e4a635794ff0605f125eec459b9b98f.tar.bz2
Patch #1483395: add new TLDs to cookielib
Diffstat (limited to 'Lib/cookielib.py')
-rw-r--r--Lib/cookielib.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/cookielib.py b/Lib/cookielib.py
index f0a89a5..5732125 100644
--- a/Lib/cookielib.py
+++ b/Lib/cookielib.py
@@ -974,15 +974,18 @@ class DefaultCookiePolicy(CookiePolicy):
req_host, erhn = eff_request_host(request)
domain = cookie.domain
if self.strict_domain and (domain.count(".") >= 2):
+ # XXX This should probably be compared with the Konqueror
+ # (kcookiejar.cpp) and Mozilla implementations, but it's a
+ # losing battle.
i = domain.rfind(".")
j = domain.rfind(".", 0, i)
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") and
- len(tld) == 2):
+ 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:
# domain like .co.uk
debug(" country-code second level domain %s", domain)
return False