[Python-checkins] r45934 - python/trunk/Lib/cookielib.py

georg.brandl python-checkins at python.org
Sun May 7 22:44:35 CEST 2006


Author: georg.brandl
Date: Sun May  7 22:44:34 2006
New Revision: 45934

Modified:
   python/trunk/Lib/cookielib.py
Log:
Patch #1483395: add new TLDs to cookielib



Modified: python/trunk/Lib/cookielib.py
==============================================================================
--- python/trunk/Lib/cookielib.py	(original)
+++ python/trunk/Lib/cookielib.py	Sun May  7 22:44:34 2006
@@ -974,15 +974,18 @@
             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


More information about the Python-checkins mailing list