Skip to content

Commit 5e0b9f3

Browse files
authored
Catch TimeoutError in send_request method
Handle TimeoutError specifically when sending requests.
1 parent cfde44b commit 5e0b9f3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Lib/http/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ def request(self, method, url, body=None, headers={}, *,
13411341
"""Send a complete request to the server."""
13421342
try:
13431343
self._send_request(method, url, body, headers, encode_chunked)
1344-
except Exception:
1344+
except TimeoutError:
13451345
# If the transmission fails (e.g. timeout), close the connection
13461346
# to reset the state machine to _CS_IDLE
13471347
self.close()

0 commit comments

Comments
 (0)