mirror of
https://github.com/curl/curl.git
synced 2026-08-25 01:53:32 +03:00
websockets: auto-tunnel through http proxy
When using a ws: or wss: url with a http proxy, automatically switch to tunneling operation mode. Add test_20_10 to check. Fixes #21663 Closes #21691
This commit is contained in:
parent
b158d1c9f7
commit
77e4e5b86d
4 changed files with 25 additions and 5 deletions
|
|
@ -206,3 +206,17 @@ class TestWebsockets:
|
|||
large = 0
|
||||
r = client.run(args=[f'-{model}', '-c', str(count), '-m', str(large), url])
|
||||
r.check_exit_code(0)
|
||||
|
||||
# use ws:// url with HTTP proxy, check that it tunnels automatically
|
||||
def test_20_10_proxy_http(self, env: Env, httpd, ws_echo):
|
||||
curl = CurlClient(env=env)
|
||||
url = f'ws://127.0.0.1:{env.ws_port}/'
|
||||
xargs = curl.get_proxy_args(proxys=False)
|
||||
xargs.extend([
|
||||
'--max-time', '2'
|
||||
])
|
||||
r = curl.http_download(urls=[url], alpn_proto='http/1.1', with_stats=True,
|
||||
extra_args=xargs)
|
||||
# The CONNECT through the proxy fails as it does not allow it
|
||||
r.check_exit_code(7) # CURLE_COULDNT_CONNECT
|
||||
assert r.stats[0]['http_connect'] == 403, f'{r}'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue