Lines Matching refs:domain
481 known_attrs = ("expires", "domain", "path", "secure",
536 """Return True if text is a host domain name."""
551 """Return True if domain A domain-matches domain B, according to RFC 2965.
553 A and B may be host domain names or IP addresses.
559 be case-insensitive.) Host A's name domain-matches host B's if
565 x.y.com domain-matches .Y.com but not Y.com.)
567 Note that domain-match is not a commutative operation: a.b.c.com
568 domain-matches .c.com, but not the reverse.
572 # definition of the domain-match algorithm is the direct string-compare.
590 """Return True if text is a sort-of-like a host domain name.
602 A and B may be host domain names or IP addresses.
698 - H is the host domain name of a host; and,
732 host U does not domain-match the reach R of the request-host O in the
763 domain, domain_specified, domain_initial_dot,
785 self.domain = domain.lower()
787 # Sigh. We need to know whether the domain given in the
819 limit = self.domain + p + self.path
830 "domain", "domain_specified", "domain_initial_dot",
863 def domain_return_ok(self, domain, request):
864 """Return false if cookies should not be returned, given cookie domain.
926 def is_blocked(self, domain):
928 if user_domain_match(domain, blocked_domain):
941 def is_not_allowed(self, domain):
945 if user_domain_match(domain, allowed_domain):
960 for n in "version", "verifiability", "name", "path", "domain", "port":
1016 if self.is_blocked(cookie.domain):
1017 _debug(" domain %s is in user block-list", cookie.domain)
1019 if self.is_not_allowed(cookie.domain):
1020 _debug(" domain %s is not in user allow-list", cookie.domain)
1024 domain = cookie.domain
1025 if self.strict_domain and (domain.count(".") >= 2):
1029 i = domain.rfind(".")
1030 j = domain.rfind(".", 0, i)
1031 if j == 0: # domain like .foo.bar
1032 tld = domain[i+1:]
1033 sld = domain[j+1:i]
1038 # domain like .co.uk
1039 _debug(" country-code second level domain %s", domain)
1041 if domain.startswith("."):
1042 undotted_domain = domain[1:]
1044 undotted_domain = domain
1047 _debug(" non-local domain %s contains no embedded dot",
1048 domain)
1051 if (not (erhn.endswith(domain) or
1054 not ("."+erhn).endswith(domain))):
1057 erhn, domain)
1061 if not domain_match(erhn, domain):
1062 _debug(" effective request-host %s does not domain-match "
1063 "%s", erhn, domain)
1067 host_prefix = req_host[:-len(domain)]
1070 _debug(" host prefix %s for domain %s contains a dot",
1071 host_prefix, domain)
1103 # Path has already been checked by .path_return_ok(), and domain
1107 for n in "version", "verifiability", "secure", "expires", "port", "domain":
1163 domain = cookie.domain
1165 if domain and not domain.startswith("."):
1166 dotdomain = "." + domain
1168 dotdomain = domain
1170 # strict check of non-domain cookies: Mozilla does this, MSIE5 doesn't
1173 not cookie.domain_specified and domain != erhn):
1174 _debug(" cookie with unspecified domain does not string-compare "
1175 "equal to request domain")
1178 if cookie.version > 0 and not domain_match(erhn, domain):
1179 _debug(" effective request-host name %s does not domain-match "
1180 "RFC 2965 cookie domain %s", erhn, domain)
1183 _debug(" request-host %s does not match Netscape cookie domain "
1184 "%s", req_host, domain)
1188 def domain_return_ok(self, domain, request):
1196 if domain and not domain.startswith("."):
1197 dotdomain = "." + domain
1199 dotdomain = domain
1201 #_debug(" request domain %s does not match cookie domain %s",
1202 # req_host, domain)
1205 if self.is_blocked(domain):
1206 _debug(" domain %s is in user block-list", domain)
1208 if self.is_not_allowed(domain):
1209 _debug(" domain %s is not in user allow-list", domain)
1272 def _cookies_for_domain(self, domain, request):
1274 if not self._policy.domain_return_ok(domain, request):
1276 _debug("Checking %s for cookies to return", domain)
1277 cookies_by_path = self._cookies[domain]
1293 for domain in self._cookies.keys():
1294 cookies.extend(self._cookies_for_domain(domain, request))
1342 if cookie.domain.startswith("."):
1343 domain = cookie.domain
1345 domain.startswith(".")):
1346 domain = domain[1:]
1347 attrs.append('$Domain="%s"' % domain)
1398 domain, path and port) and rest is a dictionary containing the rest of
1407 "domain", "path", "port",
1439 if k == "domain":
1441 _debug(" missing value for domain attribute")
1491 domain = standard.get("domain", Absent)
1525 # set default domain
1526 domain_specified = domain is not Absent
1530 domain_initial_dot = bool(domain.startswith("."))
1531 if domain is Absent:
1533 domain = erhn
1534 elif not domain.startswith("."):
1535 domain = "."+domain
1559 self.clear(domain, path, name)
1562 _debug("Expiring cookie, domain='%s', path='%s', name='%s'",
1563 domain, path, name)
1569 domain, domain_specified, domain_initial_dot,
1642 lookup[(cookie.domain, cookie.path, cookie.name)] = None
1645 key = ns_cookie.domain, ns_cookie.path, ns_cookie.name
1672 if cookie.domain not in c: c[cookie.domain] = {}
1673 c2 = c[cookie.domain]
1692 def clear(self, domain=None, path=None, name=None):
1696 given a single argument, only cookies belonging to that domain will be
1698 path within that domain are removed. If given three arguments, then
1699 the cookie with the specified name, path and domain is removed.
1705 if (domain is None) or (path is None):
1707 "domain and path must be given to remove a cookie by name")
1708 del self._cookies[domain][path][name]
1710 if domain is None:
1712 "domain must be given to remove cookies by path")
1713 del self._cookies[domain][path]
1714 elif domain is not None:
1715 del self._cookies[domain]
1730 self.clear(cookie.domain, cookie.path, cookie.name)
1749 self.clear(cookie.domain, cookie.path, cookie.name)
1839 ("domain", cookie.domain)]
1916 "port", "path", "domain",
1957 domain = h("domain")
1958 domain_specified = domain.startswith(".")
1961 domain, domain_specified, h("domain_dot"),
2004 domain as set in the HTTP header started with a dot (yes, I'm aware some
2044 domain, domain_specified, path, secure, expires, name, value = \
2055 initial_dot = domain.startswith(".")
2066 domain, domain_specified, initial_dot,
2099 domain = cookie.domain
2106 if domain.startswith("."): initial_dot = "TRUE"
2122 domain = HTTPONLY_PREFIX + domain
2124 "\t".join([domain, initial_dot, cookie.path,