Skip to content
Myr

Add note on connection timeout being larger than specified. Fix #5773

Before adoption: this commit came in with the history the project adopted, so no landing records it.

On servers with multiple IPs, such as IPv4 and IPv6, `urllib3` tries each address sequentially until one successfully connects, using the specified timeout for _each_ attempt, leading to a total connection timeout that is a _multiple_ of the requested time.

authored by Rodrigo Silva · committed by GitHub · parent a25fde6 · Browse files · 1 file+8 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−0 removed

  • other:+8 added−0 removed

1 file+8 added−0 removed

modified:docs/user/advanced.rst+8 added
1120 unmodified lines
1121::11221123 r = requests.get('https://github.com', timeout=None)11241125.. note:: The connect timeout applies to each connection attempt to an IP address.1126If multiple addresses exist for a domain name, the underlying ``urllib3`` will1127try each address sequentially until one successfully connects.1128This may lead to an effective total connection timeout *multiple* times longer1129than the specified time, e.g. an unresponsive server having both IPv4 and IPv61130addresses will have its perceived timeout *doubled*, so take that into account1131when setting the connection timeout.11321133.. _`connect()`: https://linux.die.net/man/2/connect