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

Method domain_return_ok

Lib/http/cookiejar.py:1189–1213  ·  view source on GitHub ↗
(self, domain, request)

Source from the content-addressed store, hash-verified

1187 return True
1188
1189 def domain_return_ok(self, domain, request):
1190 # Liberal check of. This is here as an optimization to avoid
1191 # having to load lots of MSIE cookie files unless necessary.
1192 req_host, erhn = eff_request_host(request)
1193 if not req_host.startswith("."):
1194 req_host = "."+req_host
1195 if not erhn.startswith("."):
1196 erhn = "."+erhn
1197 if domain and not domain.startswith("."):
1198 dotdomain = "." + domain
1199 else:
1200 dotdomain = domain
1201 if not (req_host.endswith(dotdomain) or erhn.endswith(dotdomain)):
1202 #_debug(" request domain %s does not match cookie domain %s",
1203 # req_host, domain)
1204 return False
1205
1206 if self.is_blocked(domain):
1207 _debug(" domain %s is in user block-list", domain)
1208 return False
1209 if self.is_not_allowed(domain):
1210 _debug(" domain %s is not in user allow-list", domain)
1211 return False
1212
1213 return True
1214
1215 def path_return_ok(self, path, request):
1216 _debug("- checking cookie path=%s", path)

Callers 1

test_domain_return_okMethod · 0.95

Calls 6

is_blockedMethod · 0.95
is_not_allowedMethod · 0.95
eff_request_hostFunction · 0.85
_debugFunction · 0.85
startswithMethod · 0.45
endswithMethod · 0.45

Tested by 1

test_domain_return_okMethod · 0.76