Why a Single HTTP Timeout Value Cannot Protect Against Every Stall
Setting a timeout on outbound HTTP requests is common, but there are three distinct kinds: connect, read, and total, each guarding a different stage. The author tested Python's requests library (version 2.34.0 on Python 3.12.8) to observe how each behaves in practice. A read timeout fires on silence between data chunks, so a slowly trickling response can run far past the limit without triggering it. Connect timeouts and refused connections also fail differently, taking different amounts of time and raising different exceptions. The article concludes that enforcing an overall deadline requires explicit measures such as tracking elapsed time or wrapping the call in a caller-side deadline.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in