Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb9aa14a

Browse files
gh-100519: simplification toeff_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>
1 parent046cbc2 commitb9aa14a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

‎Lib/http/cookiejar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ def eff_request_host(request):
640640
641641
"""
642642
erhn=req_host=request_host(request)
643-
ifreq_host.find(".")==-1andnotIPV4_RE.search(req_host):
643+
if"."notinreq_host:
644644
erhn=req_host+".local"
645645
returnreq_host,erhn
646646

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Small simplification of:func:`http.cookiejar.eff_request_host` that
2+
improves readability and better matches the RFC wording.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp