Home | History | Annotate | Download | only in Lib

Lines Matching refs:domain

459     known_attrs = ("expires", "domain", "path", "secure",
514 """Return True if text is a host domain name."""
529 """Return True if domain A domain-matches domain B, according to RFC 2965.
531 A and B may be host domain names or IP addresses.
537 be case-insensitive.) Host A's name domain-matches host B's if
543 x.y.com domain-matches .Y.com but not Y.com.)
545 Note that domain-match is not a commutative operation: a.b.c.com
546 domain-matches .c.com, but not the reverse.
550 # definition of the domain-match algorithm is the direct string-compare.
568 """Return True if text is a sort-of-like a host domain name.
580 A and B may be host domain names or IP addresses.
678 - H is the host domain name of a host; and,
712 host U does not domain-match the reach R of the request-host O in the
743 domain, domain_specified, domain_initial_dot,
765 self.domain = domain.lower()
767 # Sigh. We need to know whether the domain given in the
769 # (as clarified in draft errata). Needed for the returned $Domain
799 limit = self.domain + p + self.path
810 "domain", "domain_specified", "domain_initial_dot",
843 def domain_return_ok(self, domain, request):
844 """Return false if cookies should not be returned, given cookie domain.
904 def is_blocked(self, domain):
906 if user_domain_match(domain, blocked_domain):
919 def is_not_allowed(self, domain):
923 if user_domain_match(domain, allowed_domain):
938 for n in "version", "verifiability", "name", "path", "domain", "port":
994 if self.is_blocked(cookie.domain):
995 _debug(" domain %s is in user block-list", cookie.domain)
997 if self.is_not_allowed(cookie.domain):
998 _debug(" domain %s is not in user allow-list", cookie.domain)
1002 domain = cookie.domain
1003 if self.strict_domain and (domain.count(".") >= 2):
1007 i = domain.rfind(".")
1008 j = domain.rfind(".", 0, i)
1009 if j == 0: # domain like .foo.bar
1010 tld = domain[i+1:]
1011 sld = domain[j+1:i]
1016 # domain like .co.uk
1017 _debug(" country-code second level domain %s", domain)
1019 if domain.startswith("."):
1020 undotted_domain = domain[1:]
1022 undotted_domain = domain
1024 if not embedded_dots and domain != ".local":
1025 _debug(" non-local domain %s contains no embedded dot",
1026 domain)
1029 if (not erhn.endswith(domain) and
1031 not ("."+erhn).endswith(domain))):
1034 erhn, domain)
1038 if not domain_match(erhn, domain):
1039 _debug(" effective request-host %s does not domain-match "
1040 "%s", erhn, domain)
1044 host_prefix = req_host[:-len(domain)]
1047 _debug(" host prefix %s for domain %s contains a dot",
1048 host_prefix, domain)
1080 # Path has already been checked by .path_return_ok(), and domain
1084 for n in "version", "verifiability", "secure", "expires", "port", "domain":
1140 domain = cookie.domain
1142 # strict check of non-domain cookies: Mozilla does this, MSIE5 doesn't
1145 not cookie.domain_specified and domain != erhn):
1146 _debug(" cookie with unspecified domain does not string-compare "
1147 "equal to request domain")
1150 if cookie.version > 0 and not domain_match(erhn, domain):
1151 _debug(" effective request-host name %s does not domain-match "
1152 "RFC 2965 cookie domain %s", erhn, domain)
1154 if cookie.version == 0 and not ("."+erhn).endswith(domain):
1155 _debug(" request-host %s does not match Netscape cookie domain "
1156 "%s", req_host, domain)
1160 def domain_return_ok(self, domain, request):
1168 if not (req_host.endswith(domain) or erhn.endswith(domain)):
1169 #_debug(" request domain %s does not match cookie domain %s",
1170 # req_host, domain)
1173 if self.is_blocked(domain):
1174 _debug(" domain %s is in user block-list", domain)
1176 if self.is_not_allowed(domain):
1177 _debug(" domain %s is not in user allow-list", domain)
1244 def _cookies_for_domain(self, domain, request):
1246 if not self._policy.domain_return_ok(domain, request):
1248 _debug("Checking %s for cookies to return", domain)
1249 cookies_by_path = self._cookies[domain]
1265 for domain in self._cookies.keys():
1266 cookies.extend(self._cookies_for_domain(domain, request))
1314 if cookie.domain.startswith("."):
1315 domain = cookie.domain
1317 domain.startswith(".")):
1318 domain = domain[1:]
1319 attrs.append('$Domain="%s"' % domain)
1370 domain, path and port) and rest is a dictionary containing the rest of
1379 "domain", "path", "port",
1411 if k == "domain":
1413 _debug(" missing value for domain attribute")
1463 domain = standard.get("domain", Absent)
1497 # set default domain
1498 domain_specified = domain is not Absent
1502 domain_initial_dot = bool(domain.startswith("."))
1503 if domain is Absent:
1505 domain = erhn
1506 elif not domain.startswith("."):
1507 domain = "."+domain
1531 self.clear(domain, path, name)
1534 _debug("Expiring cookie, domain='%s', path='%s', name='%s'",
1535 domain, path, name)
1541 domain, domain_specified, domain_initial_dot,
1613 lookup[(cookie.domain, cookie.path, cookie.name)] = None
1616 key = ns_cookie.domain, ns_cookie.path, ns_cookie.name
1643 if cookie.domain not in c: c[cookie.domain] = {}
1644 c2 = c[cookie.domain]
1665 def clear(self, domain=None, path=None, name=None):
1669 given a single argument, only cookies belonging to that domain will be
1671 path within that domain are removed. If given three arguments, then
1672 the cookie with the specified name, path and domain is removed.
1678 if (domain is None) or (path is None):
1680 "domain and path must be given to remove a cookie by name")
1681 del self._cookies[domain][path][name]
1683 if domain is None:
1685 "domain must be given to remove cookies by path")
1686 del self._cookies[domain][path]
1687 elif domain is not None:
1688 del self._cookies[domain]
1703 self.clear(cookie.domain, cookie.path, cookie.name)
1722 self.clear(cookie.domain, cookie.path, cookie.name)