From 8c47ada2de6b62a82053c484a5502688e200c14d Mon Sep 17 00:00:00 2001 From: c-bata Date: Sun, 29 Oct 2023 13:56:15 +0900 Subject: [PATCH] gh-66425: Remove the unreachable code to set `REMOTE_HOST` header (gh-111441) --- Lib/wsgiref/simple_server.py | 4 ---- .../Library/2023-10-29-03-46-27.gh-issue-66425.FWTdDo.rst | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2023-10-29-03-46-27.gh-issue-66425.FWTdDo.rst diff --git a/Lib/wsgiref/simple_server.py b/Lib/wsgiref/simple_server.py index 93d01a863ad..a0f2397fcf0 100644 --- a/Lib/wsgiref/simple_server.py +++ b/Lib/wsgiref/simple_server.py @@ -84,10 +84,6 @@ class WSGIRequestHandler(BaseHTTPRequestHandler): env['PATH_INFO'] = urllib.parse.unquote(path, 'iso-8859-1') env['QUERY_STRING'] = query - - host = self.address_string() - if host != self.client_address[0]: - env['REMOTE_HOST'] = host env['REMOTE_ADDR'] = self.client_address[0] if self.headers.get('content-type') is None: diff --git a/Misc/NEWS.d/next/Library/2023-10-29-03-46-27.gh-issue-66425.FWTdDo.rst b/Misc/NEWS.d/next/Library/2023-10-29-03-46-27.gh-issue-66425.FWTdDo.rst new file mode 100644 index 00000000000..e7ede35891f --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-10-29-03-46-27.gh-issue-66425.FWTdDo.rst @@ -0,0 +1,3 @@ +Remove the code to set the REMOTE_HOST header from wsgiref module, +as it is unreachable. This header is used for performance reasons, +which is not necessary in the wsgiref module.