summaryrefslogtreecommitdiffstats
path: root/Lib/http
diff options
context:
space:
mode:
authorNick <keddad@yandex.ru>2022-04-19 20:08:06 (GMT)
committerGitHub <noreply@github.com>2022-04-19 20:08:06 (GMT)
commitb6d5e3c3c92374598b327918c8e66e748a1a92a0 (patch)
treeb6aad2396ae37dcb84a82533dfb6378df05bd88d /Lib/http
parent74e319239b0a2a5ef8bc27670f4f533ee701d57f (diff)
downloadcpython-b6d5e3c3c92374598b327918c8e66e748a1a92a0.zip
cpython-b6d5e3c3c92374598b327918c8e66e748a1a92a0.tar.gz
cpython-b6d5e3c3c92374598b327918c8e66e748a1a92a0.tar.bz2
bpo-46075: Store localhost cookies in CookieJar (#30108)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Lib/http')
-rw-r--r--Lib/http/cookiejar.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/http/cookiejar.py b/Lib/http/cookiejar.py
index ee433c0..136a1f16 100644
--- a/Lib/http/cookiejar.py
+++ b/Lib/http/cookiejar.py
@@ -1043,12 +1043,13 @@ class DefaultCookiePolicy(CookiePolicy):
else:
undotted_domain = domain
embedded_dots = (undotted_domain.find(".") >= 0)
- if not embedded_dots and domain != ".local":
+ if not embedded_dots and not erhn.endswith(".local"):
_debug(" non-local domain %s contains no embedded dot",
domain)
return False
if cookie.version == 0:
- if (not erhn.endswith(domain) and
+ if (not (erhn.endswith(domain) or
+ erhn.endswith(f"{undotted_domain}.local")) and
(not erhn.startswith(".") and
not ("."+erhn).endswith(domain))):
_debug(" effective request-host %s (even with added "