mirror of
https://github.com/curl/curl.git
synced 2026-08-25 07:23:31 +03:00
http2: support HTTP/2 to forward proxies, non-tunneling
- with `--proxy-http2` allow h2 ALPN negotiation to forward proxies - applies to http: requests against a https: proxy only, as https: requests will auto-tunnel - adding a HTTP/1 request parser in http1.c - removed h2h3.c - using new request parser in nghttp2 and all h3 backends - adding test 2603 for request parser - adding h2 proxy test cases to test_10_* scorecard.py: request scoring accidentally always run curl with '-v'. Removed that, expect double numbers. labeller: added http1.* and h2-proxy sources to detection Closes #10967
This commit is contained in:
parent
fb1d62ff07
commit
fc2f1e547a
28 changed files with 1522 additions and 824 deletions
|
|
@ -317,6 +317,26 @@ class CurlClient:
|
|||
if not os.path.exists(path):
|
||||
return os.makedirs(path)
|
||||
|
||||
def get_proxy_args(self, proto: str = 'http/1.1',
|
||||
proxys: bool = True, tunnel: bool = False):
|
||||
if proxys:
|
||||
pport = self.env.pts_port(proto) if tunnel else self.env.proxys_port
|
||||
xargs = [
|
||||
'--proxy', f'https://{self.env.proxy_domain}:{pport}/',
|
||||
'--resolve', f'{self.env.proxy_domain}:{pport}:127.0.0.1',
|
||||
'--proxy-cacert', self.env.ca.cert_file,
|
||||
]
|
||||
if proto == 'h2':
|
||||
xargs.append('--proxy-http2')
|
||||
else:
|
||||
xargs = [
|
||||
'--proxy', f'http://{self.env.proxy_domain}:{self.env.proxy_port}/',
|
||||
'--resolve', f'{self.env.proxy_domain}:{self.env.proxy_port}:127.0.0.1',
|
||||
]
|
||||
if tunnel:
|
||||
xargs.append('--proxytunnel')
|
||||
return xargs
|
||||
|
||||
def http_get(self, url: str, extra_args: Optional[List[str]] = None):
|
||||
return self._raw(url, options=extra_args, with_stats=False)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue