From 180af899ab99a97589b1d4f04c09d4e2ddf7eb08 Mon Sep 17 00:00:00 2001 From: NewUserHa <32261870+NewUserHa@users.noreply.github.com> Date: Sun, 10 Dec 2023 04:11:00 +0800 Subject: [PATCH 1/7] Fixing missed arguments for pools when init transports --- httpx/_transports/default.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/httpx/_transports/default.py b/httpx/_transports/default.py index c0c4ffd40a..51fe3eafc9 100644 --- a/httpx/_transports/default.py +++ b/httpx/_transports/default.py @@ -140,9 +140,9 @@ def __init__( keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, - uds=uds, - local_address=local_address, retries=retries, + local_address=local_address, + uds=uds, socket_options=socket_options, ) elif proxy.url.scheme in ("http", "https"): @@ -162,6 +162,9 @@ def __init__( keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, + retries=retries, + local_address=local_address, + uds=uds, socket_options=socket_options, ) elif proxy.url.scheme == "socks5": @@ -187,6 +190,7 @@ def __init__( keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, + retries=retries, ) else: # pragma: no cover raise ValueError( @@ -280,9 +284,9 @@ def __init__( keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, - uds=uds, - local_address=local_address, retries=retries, + local_address=local_address, + uds=uds, socket_options=socket_options, ) elif proxy.url.scheme in ("http", "https"): @@ -301,6 +305,9 @@ def __init__( keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, + retries=retries, + local_address=local_address, + uds=uds, socket_options=socket_options, ) elif proxy.url.scheme == "socks5": @@ -326,6 +333,7 @@ def __init__( keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, + retries=retries, ) else: # pragma: no cover raise ValueError( From f90ca24c21d461aeba9b64f074dc0f03b96fd137 Mon Sep 17 00:00:00 2001 From: NewUserHa <32261870+NewUserHa@users.noreply.github.com> Date: Sun, 10 Dec 2023 08:51:18 +0800 Subject: [PATCH 2/7] update --- httpx/_transports/default.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/httpx/_transports/default.py b/httpx/_transports/default.py index 51fe3eafc9..76a7191432 100644 --- a/httpx/_transports/default.py +++ b/httpx/_transports/default.py @@ -140,9 +140,9 @@ def __init__( keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, - retries=retries, - local_address=local_address, uds=uds, + local_address=local_address, + retries=retries, socket_options=socket_options, ) elif proxy.url.scheme in ("http", "https"): @@ -162,9 +162,9 @@ def __init__( keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, - retries=retries, - local_address=local_address, uds=uds, + local_address=local_address, + retries=retries, socket_options=socket_options, ) elif proxy.url.scheme == "socks5": @@ -190,7 +190,10 @@ def __init__( keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, + uds=uds, + local_address=local_address, retries=retries, + socket_options=socket_options, ) else: # pragma: no cover raise ValueError( From 3fa6052a1869dba3c5dfb05eecc0cbbe0141d0a5 Mon Sep 17 00:00:00 2001 From: NewUserHa <32261870+NewUserHa@users.noreply.github.com> Date: Sun, 10 Dec 2023 08:54:04 +0800 Subject: [PATCH 3/7] fix lint --- httpx/_transports/default.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/httpx/_transports/default.py b/httpx/_transports/default.py index 76a7191432..9170cb2211 100644 --- a/httpx/_transports/default.py +++ b/httpx/_transports/default.py @@ -287,9 +287,9 @@ def __init__( keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, - retries=retries, - local_address=local_address, uds=uds, + local_address=local_address, + retries=retries, socket_options=socket_options, ) elif proxy.url.scheme in ("http", "https"): @@ -308,9 +308,9 @@ def __init__( keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, - retries=retries, - local_address=local_address, uds=uds, + local_address=local_address, + retries=retries, socket_options=socket_options, ) elif proxy.url.scheme == "socks5": @@ -336,7 +336,10 @@ def __init__( keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, + uds=uds, + local_address=local_address, retries=retries, + socket_options=socket_options, ) else: # pragma: no cover raise ValueError( From 45e5f1423b7c58b83e6cbadbe7985a9f7de747f5 Mon Sep 17 00:00:00 2001 From: NewUserHa <32261870+NewUserHa@users.noreply.github.com> Date: Tue, 12 Dec 2023 03:50:11 +0800 Subject: [PATCH 4/7] leave `uds` and `local_address` of socksproxy for antoher PR --- httpx/_transports/default.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/httpx/_transports/default.py b/httpx/_transports/default.py index 9170cb2211..5ae3f70804 100644 --- a/httpx/_transports/default.py +++ b/httpx/_transports/default.py @@ -190,8 +190,6 @@ def __init__( keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, - uds=uds, - local_address=local_address, retries=retries, socket_options=socket_options, ) @@ -336,8 +334,6 @@ def __init__( keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, - uds=uds, - local_address=local_address, retries=retries, socket_options=socket_options, ) From 30a8c7b4329e346deb69f661f2e09964c683c0c6 Mon Sep 17 00:00:00 2001 From: NewUserHa <32261870+NewUserHa@users.noreply.github.com> Date: Tue, 12 Dec 2023 03:51:17 +0800 Subject: [PATCH 5/7] leave `socket_options` for another PR --- httpx/_transports/default.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/httpx/_transports/default.py b/httpx/_transports/default.py index 5ae3f70804..18ffcb84ad 100644 --- a/httpx/_transports/default.py +++ b/httpx/_transports/default.py @@ -191,7 +191,6 @@ def __init__( http1=http1, http2=http2, retries=retries, - socket_options=socket_options, ) else: # pragma: no cover raise ValueError( @@ -335,7 +334,6 @@ def __init__( http1=http1, http2=http2, retries=retries, - socket_options=socket_options, ) else: # pragma: no cover raise ValueError( From cb50ff82716b522122a43d05c7568a960a014524 Mon Sep 17 00:00:00 2001 From: NewUserHa <32261870+NewUserHa@users.noreply.github.com> Date: Tue, 12 Dec 2023 03:52:55 +0800 Subject: [PATCH 6/7] reorder `retries`, ``local_address`, `uds` --- httpx/_transports/default.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/httpx/_transports/default.py b/httpx/_transports/default.py index 18ffcb84ad..f5b8c35d04 100644 --- a/httpx/_transports/default.py +++ b/httpx/_transports/default.py @@ -162,9 +162,9 @@ def __init__( keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, - uds=uds, - local_address=local_address, retries=retries, + local_address=local_address, + uds=uds, socket_options=socket_options, ) elif proxy.url.scheme == "socks5": @@ -305,9 +305,9 @@ def __init__( keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, - uds=uds, - local_address=local_address, retries=retries, + local_address=local_address, + uds=uds, socket_options=socket_options, ) elif proxy.url.scheme == "socks5": From 78ac27a62fb60bf3cff09a6e616bc2e5063656bd Mon Sep 17 00:00:00 2001 From: NewUserHa <32261870+NewUserHa@users.noreply.github.com> Date: Fri, 15 Dec 2023 06:20:55 +0800 Subject: [PATCH 7/7] fix --- httpx/_transports/default.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/httpx/_transports/default.py b/httpx/_transports/default.py index cac507c21b..5188821055 100644 --- a/httpx/_transports/default.py +++ b/httpx/_transports/default.py @@ -126,9 +126,9 @@ def __init__( limits: Limits = DEFAULT_LIMITS, trust_env: bool = True, proxy: typing.Optional[ProxyTypes] = None, - uds: typing.Optional[str] = None, - local_address: typing.Optional[str] = None, retries: int = 0, + local_address: typing.Optional[str] = None, + uds: typing.Optional[str] = None, socket_options: typing.Optional[typing.Iterable[SOCKET_OPTION]] = None, ) -> None: ssl_context = create_ssl_context(verify=verify, cert=cert, trust_env=trust_env) @@ -142,9 +142,9 @@ def __init__( keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, - uds=uds, - local_address=local_address, retries=retries, + local_address=local_address, + uds=uds, socket_options=socket_options, ) elif proxy.url.scheme in ("http", "https"): @@ -271,9 +271,9 @@ def __init__( limits: Limits = DEFAULT_LIMITS, trust_env: bool = True, proxy: typing.Optional[ProxyTypes] = None, - uds: typing.Optional[str] = None, - local_address: typing.Optional[str] = None, retries: int = 0, + local_address: typing.Optional[str] = None, + uds: typing.Optional[str] = None, socket_options: typing.Optional[typing.Iterable[SOCKET_OPTION]] = None, ) -> None: ssl_context = create_ssl_context(verify=verify, cert=cert, trust_env=trust_env) @@ -287,9 +287,9 @@ def __init__( keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, - uds=uds, - local_address=local_address, retries=retries, + local_address=local_address, + uds=uds, socket_options=socket_options, ) elif proxy.url.scheme in ("http", "https"):