Lines Matching refs:domain
459 known_attrs = ("expires", "domain", "path", "secure",
498 """Return True if text is a host domain name."""
513 """Return True if domain A domain-matches domain B, according to RFC 2965.
515 A and B may be host domain names or IP addresses.
521 be case-insensitive.) Host A's name domain-matches host B's if
527 x.y.com domain-matches .Y.com but not Y.com.)
529 Note that domain-match is not a commutative operation: a.b.c.com
530 domain-matches .c.com, but not the reverse.
534 # definition of the domain-match algorithm is the direct string-compare.
552 """Return True if text is a sort-of-like a host domain name.
564 A and B may be host domain names or IP addresses.
662 - H is the host domain name of a host; and,
696 host U does not domain-match the reach R of the request-host O in the
727 domain, domain_specified, domain_initial_dot,
749 self.domain = domain.lower()
751 # Sigh. We need to know whether the domain given in the
753 # (as clarified in draft errata). Needed for the returned $Domain
783 limit = self.domain + p + self.path
794 "domain", "domain_specified", "domain_initial_dot",
827 def domain_return_ok(self, domain, request):
828 """Return false if cookies should not be returned, given cookie domain.
888 def is_blocked(self, domain):
890 if user_domain_match(domain, blocked_domain):
903 def is_not_allowed(self, domain):
907 if user_domain_match(domain, allowed_domain):
922 for n in "version", "verifiability", "name", "path", "domain", "port":
978 if self.is_blocked(cookie.domain):
979 _debug(" domain %s is in user block-list", cookie.domain)
981 if self.is_not_allowed(cookie.domain):
982 _debug(" domain %s is not in user allow-list", cookie.domain)
986 domain = cookie.domain
987 if self.strict_domain and (domain.count(".") >= 2):
991 i = domain.rfind(".")
992 j = domain.rfind(".", 0, i)
993 if j == 0: # domain like .foo.bar
994 tld = domain[i+1:]
995 sld = domain[j+1:i]
1000 # domain like .co.uk
1001 _debug(" country-code second level domain %s", domain)
1003 if domain.startswith("."):
1004 undotted_domain = domain[1:]
1006 undotted_domain = domain
1008 if not embedded_dots and domain != ".local":
1009 _debug(" non-local domain %s contains no embedded dot",
1010 domain)
1013 if (not erhn.endswith(domain) and
1015 not ("."+erhn).endswith(domain))):
1018 erhn, domain)
1022 if not domain_match(erhn, domain):
1023 _debug(" effective request-host %s does not domain-match "
1024 "%s", erhn, domain)
1028 host_prefix = req_host[:-len(domain)]
1031 _debug(" host prefix %s for domain %s contains a dot",
1032 host_prefix, domain)
1064 # Path has already been checked by .path_return_ok(), and domain
1068 for n in "version", "verifiability", "secure", "expires", "port", "domain":
1124 domain = cookie.domain
1126 # strict check of non-domain cookies: Mozilla does this, MSIE5 doesn't
1129 not cookie.domain_specified and domain != erhn):
1130 _debug(" cookie with unspecified domain does not string-compare "
1131 "equal to request domain")
1134 if cookie.version > 0 and not domain_match(erhn, domain):
1135 _debug(" effective request-host name %s does not domain-match "
1136 "RFC 2965 cookie domain %s", erhn, domain)
1138 if cookie.version == 0 and not ("."+erhn).endswith(domain):
1139 _debug(" request-host %s does not match Netscape cookie domain "
1140 "%s", req_host, domain)
1144 def domain_return_ok(self, domain, request):
1152 if not (req_host.endswith(domain) or erhn.endswith(domain)):
1153 #_debug(" request domain %s does not match cookie domain %s",
1154 # req_host, domain)
1157 if self.is_blocked(domain):
1158 _debug(" domain %s is in user block-list", domain)
1160 if self.is_not_allowed(domain):
1161 _debug(" domain %s is not in user allow-list", domain)
1228 def _cookies_for_domain(self, domain, request):
1230 if not self._policy.domain_return_ok(domain, request):
1232 _debug("Checking %s for cookies to return", domain)
1233 cookies_by_path = self._cookies[domain]
1249 for domain in self._cookies.keys():
1250 cookies.extend(self._cookies_for_domain(domain, request))
1298 if cookie.domain.startswith("."):
1299 domain = cookie.domain
1301 domain.startswith(".")):
1302 domain = domain[1:]
1303 attrs.append('$Domain="%s"' % domain)
1354 domain, path and port) and rest is a dictionary containing the rest of
1363 "domain", "path", "port",
1395 if k == "domain":
1397 _debug(" missing value for domain attribute")
1447 domain = standard.get("domain", Absent)
1481 # set default domain
1482 domain_specified = domain is not Absent
1486 domain_initial_dot = bool(domain.startswith("."))
1487 if domain is Absent:
1489 domain = erhn
1490 elif not domain.startswith("."):
1491 domain = "."+domain
1515 self.clear(domain, path, name)
1518 _debug("Expiring cookie, domain='%s', path='%s', name='%s'",
1519 domain, path, name)
1525 domain, domain_specified, domain_initial_dot,
1597 lookup[(cookie.domain, cookie.path, cookie.name)] = None
1600 key = ns_cookie.domain, ns_cookie.path, ns_cookie.name
1627 if cookie.domain not in c: c[cookie.domain] = {}
1628 c2 = c[cookie.domain]
1649 def clear(self, domain=None, path=None, name=None):
1653 given a single argument, only cookies belonging to that domain will be
1655 path within that domain are removed. If given three arguments, then
1656 the cookie with the specified name, path and domain is removed.
1662 if (domain is None) or (path is None):
1664 "domain and path must be given to remove a cookie by name")
1665 del self._cookies[domain][path][name]
1667 if domain is None:
1669 "domain must be given to remove cookies by path")
1670 del self._cookies[domain][path]
1671 elif domain is not None:
1672 del self._cookies[domain]
1687 self.clear(cookie.domain, cookie.path, cookie.name)
1706 self.clear(cookie.domain, cookie.path, cookie.name)