|
21 | 21 | import logging
|
22 | 22 | import random
|
23 | 23 | import re
|
24 |
| -from typing import Any, Collection, Dict, List, Optional, Sequence, Tuple |
| 24 | +from typing import Any, Collection, Dict, List, Optional, Sequence, Tuple, Union |
25 | 25 | from urllib.parse import urlparse
|
26 | 26 | from urllib.request import ( # type: ignore[attr-defined]
|
27 | 27 | getproxies_environment,
|
@@ -351,7 +351,9 @@ def http_proxy_endpoint(
|
351 | 351 | proxy: Optional[bytes],
|
352 | 352 | reactor: IReactorCore,
|
353 | 353 | tls_options_factory: Optional[IPolicyForHTTPS],
|
354 |
| - **kwargs: object, |
| 354 | + timeout: float = 30, |
| 355 | + bindAddress: Optional[Union[bytes, str, tuple[Union[bytes, str], int]]] = None, |
| 356 | + attemptDelay: Optional[float] = None, |
355 | 357 | ) -> Tuple[Optional[IStreamClientEndpoint], Optional[ProxyCredentials]]:
|
356 | 358 | """Parses an http proxy setting and returns an endpoint for the proxy
|
357 | 359 |
|
@@ -382,12 +384,15 @@ def http_proxy_endpoint(
|
382 | 384 | # 3.9+) on scheme-less proxies, e.g. host:port.
|
383 | 385 | scheme, host, port, credentials = parse_proxy(proxy)
|
384 | 386 |
|
385 |
| - proxy_endpoint = HostnameEndpoint(reactor, host, port, **kwargs) |
| 387 | + proxy_endpoint = HostnameEndpoint( |
| 388 | + reactor, host, port, timeout, bindAddress, attemptDelay |
| 389 | + ) |
386 | 390 |
|
387 | 391 | if scheme == b"https":
|
388 | 392 | if tls_options_factory:
|
389 | 393 | tls_options = tls_options_factory.creatorForNetloc(host, port)
|
390 |
| - proxy_endpoint = wrapClientTLS(tls_options, proxy_endpoint) |
| 394 | + wrapped_proxy_endpoint = wrapClientTLS(tls_options, proxy_endpoint) |
| 395 | + return wrapped_proxy_endpoint, credentials |
391 | 396 | else:
|
392 | 397 | raise RuntimeError(
|
393 | 398 | f"No TLS options for a https connection via proxy {proxy!s}"
|
|
0 commit comments