Forward uds, local_address and retries to proxied connections - #1172
Open
mbeijen wants to merge 1 commit into
Open
Forward uds, local_address and retries to proxied connections#1172mbeijen wants to merge 1 commit into
uds, local_address and retries to proxied connections#1172mbeijen wants to merge 1 commit into
Conversation
When a `proxy` was configured, `HTTPTransport` and `AsyncHTTPTransport` silently dropped `uds`, `local_address` and `retries` instead of forwarding them to the underlying pool. The gap ran deeper than the transport layer: `httpcore2.HTTPProxy` accepted all three but its `create_connection` never handed them (or `socket_options`) to the proxy connections it built, `ConnectionPool(proxy=...)` had the same gap in all three of its proxy branches, and `SOCKSProxy` accepted `retries` while the Socks5 connection had no retry logic at all. - Thread `retries`, `local_address` and `uds` through the forward and tunnel proxy connections down to the inner `HTTPConnection`. - Implement connect retries for Socks5 connections, mirroring the backoff behaviour of `HTTPConnection`. - Forward the options from both transports. SOCKS proxies support `retries` only, now noted in the transports documentation. See pydantic#1160
Merging this PR will not alter performance
Comparing Footnotes
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a
proxywas configured,HTTPTransportandAsyncHTTPTransportsilently dropped
uds,local_addressandretriesinstead of forwardingthem to the underlying pool.
The gap ran deeper than the transport layer:
httpcore2.HTTPProxyaccepted all three but itscreate_connectionneverhanded them (or
socket_options) to the proxy connections it built.ConnectionPool(proxy=...)had the same gap in all three of its proxybranches.
SOCKSProxyacceptedretrieswhile the Socks5 connection had no retrylogic at all.
Changes
retries,local_addressandudsthrough the forward and tunnelproxy connections down to the inner
HTTPConnection.behaviour of
HTTPConnection(same exception set, sameexponential_backoffsequence, sameTrace("retry", ...)).retriesonly;
uds,local_addressandsocket_optionsare not available there,now noted in the transports documentation.
local_addressandudsentries from theSOCKSProxydocstring,which documented parameters the constructor does not accept.
Note that
socket_optionsremains silently ignored for SOCKS proxies ratherthan raising — that would be a behaviour change for anyone currently passing
the combination, so it is documented instead.
See #1160