Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Switch to for/else: syntax, as suggested
  • Loading branch information
handlerbot authored Oct 10, 2022
commit aa1508ee7c91686fffa587c9c3846d3cdef69fc9
4 changes: 1 addition & 3 deletions Lib/http/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,12 +901,10 @@ def set_tunnel(self, host, port=None, headers=None):
else:
self._tunnel_headers.clear()

saw_host_header = False
for header in self._tunnel_headers.keys():
if header.lower() == "host":
saw_host_header = True
break
if not saw_host_header:
else:
encoded_host = self._tunnel_host.encode("idna").decode("ascii")
self._tunnel_headers["Host"] = "%s:%d" % (
encoded_host, self._tunnel_port)
Expand Down