diff options
author | Glyph <code@glyph.im> | 2022-12-25 00:14:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-25 00:14:51 (GMT) |
commit | b9aa14a484f653cb6a3a242776df9ac5fe161bfc (patch) | |
tree | 1f5f6da37fa38767e98112b050858afd566f2ef9 /Lib/http | |
parent | 046cbc2080360b0b0bbe6ea7554045a6bbbd94bd (diff) | |
download | cpython-b9aa14a484f653cb6a3a242776df9ac5fe161bfc.zip cpython-b9aa14a484f653cb6a3a242776df9ac5fe161bfc.tar.gz cpython-b9aa14a484f653cb6a3a242776df9ac5fe161bfc.tar.bz2 |
gh-100519: simplification to `eff_request_host` in cookiejar.py (#99588)
`IPV4_RE` includes a `.`, and the `.find(".") == -1` included here is already testing to make sure there's no dot, so this part of the expression is tautological. Instead use more modern `in` syntax to make it clear what the check is doing here. The simplified implementation more clearly matches the wording in RFC 2965.
Co-authored-by: hauntsaninja <hauntsaninja@gmail.com>
Diffstat (limited to 'Lib/http')
-rw-r--r-- | Lib/http/cookiejar.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/http/cookiejar.py b/Lib/http/cookiejar.py index e3df007..93b10d2 100644 --- a/Lib/http/cookiejar.py +++ b/Lib/http/cookiejar.py @@ -640,7 +640,7 @@ def eff_request_host(request): """ erhn = req_host = request_host(request) - if req_host.find(".") == -1 and not IPV4_RE.search(req_host): + if "." not in req_host: erhn = req_host + ".local" return req_host, erhn |