@@ -1822,6 +1822,17 @@ For timeout kwargs left at `0`, fall back to the client's default for the named
18221822 return getfield (client, field)
18231823end
18241824
1825+ const _DEFAULT_CONNECT_TIMEOUT = 30
1826+
1827+ @inline function _resolve_connect_timeout (client:: Union{Nothing,Client} , value:: Union{Nothing,Real} ):: Real
1828+ if value === nothing
1829+ client === nothing && return _DEFAULT_CONNECT_TIMEOUT
1830+ default = client. default_connect_timeout
1831+ return default > 0 ? default : _DEFAULT_CONNECT_TIMEOUT
1832+ end
1833+ return _client_default_timeout (client, value, :default_connect_timeout )
1834+ end
1835+
18251836
18261837function request (
18271838 method:: Union{AbstractString,Symbol} ,
@@ -1854,7 +1865,7 @@ function request(
18541865 max_sse_event_bytes:: Integer = _DEFAULT_SSE_CLIENT_MAX_EVENT_BYTES,
18551866 client:: Union{Nothing,Client} = nothing ,
18561867 context:: Union{Nothing,RequestContext} = nothing ,
1857- connect_timeout:: Real = 30 ,
1868+ connect_timeout:: Union{Nothing, Real} = nothing ,
18581869 request_timeout:: Real = 0 ,
18591870 response_header_timeout:: Real = 0 ,
18601871 read_idle_timeout:: Real = 0 ,
@@ -1907,7 +1918,7 @@ function request(
19071918 max_sse_line_bytes >= 0 || throw (ArgumentError (" max_sse_line_bytes must be >= 0" ))
19081919 max_sse_event_bytes >= 0 || throw (ArgumentError (" max_sse_event_bytes must be >= 0" ))
19091920 # Merge per-call values with client defaults (per-call wins)
1910- connect_timeout = _client_default_timeout (client, connect_timeout, :default_connect_timeout )
1921+ connect_timeout = _resolve_connect_timeout (client, connect_timeout)
19111922 request_timeout = _client_default_timeout (client, request_timeout, :default_request_timeout )
19121923 response_header_timeout = _client_default_timeout (client, response_header_timeout, :default_response_header_timeout )
19131924 read_idle_timeout = _client_default_timeout (client, read_idle_timeout, :default_read_idle_timeout )
@@ -2071,7 +2082,8 @@ Keyword arguments:
20712082 is created
20722083- `connect_timeout`: connection establishment timeout in seconds, covering DNS,
20732084 TCP connect, HTTP proxy `CONNECT` or SOCKS5 handshakes, TLS handshake, and
2074- HTTP/2 session setup in the high-level client paths
2085+ HTTP/2 session setup in the high-level client paths. When not passed, the
2086+ `client`'s `connect_timeout` default applies if set, else 30; `0` disables
20752087- `request_timeout`: overall request deadline in seconds
20762088- `response_header_timeout`: maximum time to wait for response headers after
20772089 the request has been sent
0 commit comments