Skip to content

Commit d317cc2

Browse files
committed
gh-135056: Simplify args.header processing.
1 parent 5a30d91 commit d317cc2

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

Lib/http/server.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,10 +1055,6 @@ def _main(args=None):
10551055
except OSError as e:
10561056
parser.error(f"Failed to read TLS password file: {e}")
10571057

1058-
response_headers = []
1059-
for header, value in args.header or []:
1060-
response_headers.append((header, value))
1061-
10621058
# ensure dual-stack is not disabled; ref #38907
10631059
class DualStackServerMixin:
10641060

@@ -1072,7 +1068,7 @@ def server_bind(self):
10721068
def finish_request(self, request, client_address):
10731069
self.RequestHandlerClass(request, client_address, self,
10741070
directory=args.directory,
1075-
response_headers=response_headers)
1071+
response_headers=args.header)
10761072

10771073
class HTTPDualStackServer(DualStackServerMixin, ThreadingHTTPServer):
10781074
pass

Lib/test/test_httpservers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1505,7 +1505,7 @@ def test_response_headers_arg(self):
15051505
mock_handler_init.assert_called_once_with(
15061506
mock.ANY, mock.ANY, mock.ANY, directory=mock.ANY,
15071507
response_headers=[
1508-
('Set-Cookie', 'k=v'), ('Set-Cookie', 'k2=v2')
1508+
['Set-Cookie', 'k=v'], ['Set-Cookie', 'k2=v2']
15091509
]
15101510
)
15111511

0 commit comments

Comments
 (0)