MCPcopy Index your code
hub / github.com/python/cpython / return_ok_domain

Method return_ok_domain

Lib/http/cookiejar.py:1162–1187  ·  view source on GitHub ↗
(self, cookie, request)

Source from the content-addressed store, hash-verified

1160 return True
1161
1162 def return_ok_domain(self, cookie, request):
1163 req_host, erhn = eff_request_host(request)
1164 domain = cookie.domain
1165
1166 if domain and not domain.startswith("."):
1167 dotdomain = "." + domain
1168 else:
1169 dotdomain = domain
1170
1171 # strict check of non-domain cookies: Mozilla does this, MSIE5 doesn't
1172 if (cookie.version == 0 and
1173 (self.strict_ns_domain & self.DomainStrictNonDomain) and
1174 not cookie.domain_specified and domain != erhn):
1175 _debug(" cookie with unspecified domain does not string-compare "
1176 "equal to request domain")
1177 return False
1178
1179 if cookie.version > 0 and not domain_match(erhn, domain):
1180 _debug(" effective request-host name %s does not domain-match "
1181 "RFC 2965 cookie domain %s", erhn, domain)
1182 return False
1183 if cookie.version == 0 and not ("."+erhn).endswith(dotdomain):
1184 _debug(" request-host %s does not match Netscape cookie domain "
1185 "%s", req_host, domain)
1186 return False
1187 return True
1188
1189 def domain_return_ok(self, domain, request):
1190 # Liberal check of. This is here as an optimization to avoid

Callers

nothing calls this directly

Calls 5

eff_request_hostFunction · 0.85
_debugFunction · 0.85
domain_matchFunction · 0.85
startswithMethod · 0.45
endswithMethod · 0.45

Tested by

no test coverage detected