From 33c0ea6c721a3f9f623a4e8b26165d79a0025f35 Mon Sep 17 00:00:00 2001 From: Glyph Date: Fri, 28 Jan 2022 22:42:46 -0800 Subject: [PATCH 1/2] small simplification to `eff_request_host` in cookiejar.py `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 --- Lib/http/cookiejar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/http/cookiejar.py b/Lib/http/cookiejar.py index eaa76c26b9c591..3a7b3ad7405154 100644 --- a/Lib/http/cookiejar.py +++ b/Lib/http/cookiejar.py @@ -641,7 +641,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 From a431fb6eeab8795025030f33cb72eb3263d5aace Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Sat, 24 Dec 2022 16:39:56 -0600 Subject: [PATCH 2/2] news --- .../next/Library/2022-12-24-16-39-53.gh-issue-100519.G_dZLP.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2022-12-24-16-39-53.gh-issue-100519.G_dZLP.rst diff --git a/Misc/NEWS.d/next/Library/2022-12-24-16-39-53.gh-issue-100519.G_dZLP.rst b/Misc/NEWS.d/next/Library/2022-12-24-16-39-53.gh-issue-100519.G_dZLP.rst new file mode 100644 index 00000000000000..6b889b61c2744d --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-12-24-16-39-53.gh-issue-100519.G_dZLP.rst @@ -0,0 +1,2 @@ +Small simplification of :func:`http.cookiejar.eff_request_host` that +improves readability and better matches the RFC wording. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy