mirror of
https://github.com/curl/curl.git
synced 2026-08-24 14:53:31 +03:00
parent
5c5334f831
commit
b093d88447
35 changed files with 91 additions and 90 deletions
|
|
@ -103,13 +103,13 @@ class TestEyeballs:
|
|||
|
||||
# check timers when trying 3 unresponsive addresses
|
||||
@pytest.mark.skipif(condition=not Env.curl_has_feature('IPv6'),
|
||||
reason='curl lacks ipv6 support')
|
||||
reason='curl lacks IPv6 support')
|
||||
@pytest.mark.skipif(condition=not Env.curl_has_feature('AsynchDNS'),
|
||||
reason='curl lacks async DNS support')
|
||||
@pytest.mark.skipif(condition=not Env.curl_is_verbose(), reason="needs curl verbose strings")
|
||||
def test_06_13_timers(self, env: Env):
|
||||
curl = CurlClient(env=env)
|
||||
# ipv6 0100::/64 is supposed to go into the void (rfc6666)
|
||||
# IPv6 0100::/64 is supposed to go into the void (rfc6666)
|
||||
r = curl.http_download(urls=['https://xxx.invalid/'], extra_args=[
|
||||
'--resolve', 'xxx.invalid:443:0100::1,0100::2,0100::3',
|
||||
'--connect-timeout', '1',
|
||||
|
|
|
|||
|
|
@ -392,9 +392,9 @@ class TestProxy:
|
|||
r.check_response(count=1, http_status=200,
|
||||
protocol='HTTP/2' if proto == 'h2' else 'HTTP/1.1')
|
||||
|
||||
# download via http: ipv4 proxy (no tunnel) using IP address, IPv6 only
|
||||
# download via http: IPv4 proxy (no tunnel) using IP address, IPv6 only
|
||||
@pytest.mark.skipif(condition=not Env.curl_has_feature('IPv6'),
|
||||
reason='no ipv6 support')
|
||||
reason='no IPv6 support')
|
||||
def test_10_15_proxy_ip_addr(self, env: Env, httpd):
|
||||
proto = 'http/1.1'
|
||||
curl = CurlClient(env=env, force_resolv=False)
|
||||
|
|
@ -406,9 +406,9 @@ class TestProxy:
|
|||
r.check_exit_code(0)
|
||||
r.check_response(count=1, http_status=200, protocol='HTTP/1.1')
|
||||
|
||||
# download via http: ipv6 proxy (no tunnel) using IP address, IPv4 only
|
||||
# download via http: IPv6 proxy (no tunnel) using IP address, IPv4 only
|
||||
@pytest.mark.skipif(condition=not Env.curl_has_feature('IPv6'),
|
||||
reason='no ipv6 support')
|
||||
reason='no IPv6 support')
|
||||
def test_10_16_proxy_ip_addr(self, env: Env, httpd):
|
||||
proto = 'http/1.1'
|
||||
curl = CurlClient(env=env, force_resolv=False)
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ class TestWebsockets:
|
|||
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
|
||||
# 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}/'
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class TestResolve:
|
|||
indir = httpd.docs_dir
|
||||
env.make_data_file(indir=indir, fname="data-0k", fsize=0)
|
||||
|
||||
# use .invalid host name that should never resolv
|
||||
# use .invalid hostname that should never resolv
|
||||
def test_21_01_resolv_invalid_one(self, env: Env, httpd, nghttpx):
|
||||
count = 1
|
||||
run_env = os.environ.copy()
|
||||
|
|
@ -62,7 +62,7 @@ class TestResolve:
|
|||
r.check_exit_code(6)
|
||||
r.check_stats(count=count, http_status=0, exitcode=6)
|
||||
|
||||
# use .invalid host name, one after the other
|
||||
# use .invalid hostname, one after the other
|
||||
@pytest.mark.parametrize("delay_ms", [1, 50])
|
||||
def test_21_02_resolv_invalid_serial(self, env: Env, delay_ms, httpd, nghttpx):
|
||||
count = 10
|
||||
|
|
@ -74,7 +74,7 @@ class TestResolve:
|
|||
r.check_exit_code(6)
|
||||
r.check_stats(count=count, http_status=0, exitcode=6)
|
||||
|
||||
# use .invalid host name, parallel
|
||||
# use .invalid hostname, parallel
|
||||
@pytest.mark.parametrize("delay_ms", [1, 50])
|
||||
def test_21_03_resolv_invalid_parallel(self, env: Env, delay_ms, httpd, nghttpx):
|
||||
count = 20
|
||||
|
|
@ -88,7 +88,7 @@ class TestResolve:
|
|||
r.check_exit_code(6)
|
||||
r.check_stats(count=count, http_status=0, exitcode=6)
|
||||
|
||||
# resolve first url with ipv6 only and fail that, resolve second
|
||||
# resolve first URL with IPv6 only and fail that, resolve second
|
||||
# with ipv*, should succeed.
|
||||
def test_21_04_resolv_inv_v6(self, env: Env, httpd):
|
||||
count = 2
|
||||
|
|
@ -100,7 +100,7 @@ class TestResolve:
|
|||
pytest.skip(f'example client not built: {client.name}')
|
||||
dfiles = [client.download_file(i) for i in range(count)]
|
||||
self._clean_files(dfiles)
|
||||
# let the first URL resolve via ipv6 only, which we force to fail
|
||||
# let the first URL resolve via IPv6 only, which we force to fail
|
||||
r = client.run(args=[
|
||||
'-n', f'{count}', '-6', '-C', env.ca.cert_file, url
|
||||
])
|
||||
|
|
@ -108,7 +108,7 @@ class TestResolve:
|
|||
assert not os.path.exists(dfiles[0])
|
||||
assert os.path.exists(dfiles[1])
|
||||
|
||||
# use .invalid host name, parallel, single resolve thread
|
||||
# use .invalid hostname, parallel, single resolve thread
|
||||
@pytest.mark.skipif(condition=not Env.curl_resolv_threaded(), reason="no threaded resolver")
|
||||
def test_21_05_resolv_single_thread(self, env: Env, httpd, nghttpx):
|
||||
count = 10
|
||||
|
|
|
|||
|
|
@ -552,7 +552,7 @@ class TestH3Proxy:
|
|||
# _require_available(h2o_proxy=h2o_proxy)
|
||||
# curl = CurlClient(env=env, timeout=15)
|
||||
# url = f"https://localhost:{h2o_proxy.port}/data.json"
|
||||
# # ipv6 0100::/64 is supposed to go into the void (rfc6666)
|
||||
# # IPv6 0100::/64 is supposed to go into the void (rfc6666)
|
||||
# xargs = [
|
||||
# '--proxy', 'https://xxx.invalid/',
|
||||
# '--resolve', 'xxx.invalid:443:0100::1,0100::2,0100::3',
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ static void usage_hx_download(const char *msg)
|
|||
" -r <host>:<port>:<addr> resolve information\n"
|
||||
" -T number max concurrent connections total\n"
|
||||
" -V http_version (http/1.1, h2, h3) http version to use\n"
|
||||
" -6 use ipv6 for resolving the FIRST URL\n"
|
||||
" -6 use IPv6 for resolving the FIRST URL\n"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ if($stunnel_version < 400) {
|
|||
$socketopt = "-O a:SO_REUSEADDR=1";
|
||||
}
|
||||
# TODO: we do not use $host_ip in this old version. I find
|
||||
# no documentation how to. But maybe ipv6 is not available anyway?
|
||||
# no documentation how to. But maybe IPv6 is not available anyway?
|
||||
$cmd = "\"$stunnel\" -p $certfile -P $pidfile ";
|
||||
$cmd .= "-d $accept_port -r $target_port -f -D $loglevel ";
|
||||
$cmd .= ($socketopt) ? "$socketopt " : "";
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ static CURLcode test_unit1658(const char *arg)
|
|||
"r:43|"
|
||||
},
|
||||
{
|
||||
"alpn + two ipv4 addresses",
|
||||
"alpn + two IPv4 addresses",
|
||||
(const unsigned char *)"\x00\x10" /* 16-bit prio */
|
||||
"\x00" /* no RNAME */
|
||||
"\x00\x01" /* RR (1 == ALPN) */
|
||||
|
|
@ -370,7 +370,7 @@ static CURLcode test_unit1658(const char *arg)
|
|||
"r:0|p:16|.|alpn:10|ipv4:192.168.0.1|ipv4:192.168.0.2|"
|
||||
},
|
||||
{
|
||||
"alpn + two ipv4 addresses in wrong order",
|
||||
"alpn + two IPv4 addresses in wrong order",
|
||||
(const unsigned char *)"\x00\x10" /* 16-bit prio */
|
||||
"\x00" /* no RNAME */
|
||||
"\x00\x04" /* RR (4 == Ipv4hints) */
|
||||
|
|
@ -385,7 +385,7 @@ static CURLcode test_unit1658(const char *arg)
|
|||
"r:8|"
|
||||
},
|
||||
{
|
||||
"alpn + ipv4 address with wrong size",
|
||||
"alpn + IPv4 address with wrong size",
|
||||
(const unsigned char *)"\x00\x10" /* 16-bit prio */
|
||||
"\x00" /* no RNAME */
|
||||
"\x00\x01" /* RR (1 == ALPN) */
|
||||
|
|
@ -399,7 +399,7 @@ static CURLcode test_unit1658(const char *arg)
|
|||
"r:43|"
|
||||
},
|
||||
{
|
||||
"alpn + one ipv6 address",
|
||||
"alpn + one IPv6 address",
|
||||
(const unsigned char *)"\x00\x10" /* 16-bit prio */
|
||||
"\x00" /* no RNAME */
|
||||
"\x00\x01" /* RR (1 == ALPN) */
|
||||
|
|
@ -413,7 +413,7 @@ static CURLcode test_unit1658(const char *arg)
|
|||
"r:0|p:16|.|alpn:10|ipv6:fe80:dabb:c1ff:fea3:8a22:1234:5678:9123|"
|
||||
},
|
||||
{
|
||||
"alpn + one ipv6 address with wrong size",
|
||||
"alpn + one IPv6 address with wrong size",
|
||||
(const unsigned char *)"\x00\x10" /* 16-bit prio */
|
||||
"\x00" /* no RNAME */
|
||||
"\x00\x01" /* RR (1 == ALPN) */
|
||||
|
|
@ -427,7 +427,7 @@ static CURLcode test_unit1658(const char *arg)
|
|||
"r:43|"
|
||||
},
|
||||
{
|
||||
"alpn + two ipv6 addresses",
|
||||
"alpn + two IPv6 addresses",
|
||||
(const unsigned char *)"\x00\x10" /* 16-bit prio */
|
||||
"\x00" /* no RNAME */
|
||||
"\x00\x01" /* RR (1 == ALPN) */
|
||||
|
|
|
|||
|
|
@ -268,12 +268,12 @@ static void check_result(const struct test_case *tc, struct test_result *tr)
|
|||
fail(msg);
|
||||
}
|
||||
if(tr->cf4.creations != tc->exp_cf4_creations) {
|
||||
curl_msprintf(msg, "%d: expected %d ipv4 creations, but got %d",
|
||||
curl_msprintf(msg, "%d: expected %d IPv4 creations, but got %d",
|
||||
tc->id, tc->exp_cf4_creations, tr->cf4.creations);
|
||||
fail(msg);
|
||||
}
|
||||
if(tr->cf6.creations != tc->exp_cf6_creations) {
|
||||
curl_msprintf(msg, "%d: expected %d ipv6 creations, but got %d",
|
||||
curl_msprintf(msg, "%d: expected %d IPv6 creations, but got %d",
|
||||
tc->id, tc->exp_cf6_creations, tr->cf6.creations);
|
||||
fail(msg);
|
||||
}
|
||||
|
|
@ -290,7 +290,7 @@ static void check_result(const struct test_case *tc, struct test_result *tr)
|
|||
fail(msg);
|
||||
}
|
||||
if(tr->cf6.creations && tr->cf4.creations && tc->pref_family) {
|
||||
/* did ipv4 and ipv6 both, expect the preferred family to start right away
|
||||
/* did IPv4 and IPv6 both, expect the preferred family to start right away
|
||||
* with the other being delayed by the happy_eyeball_timeout */
|
||||
struct ai_family_stats *stats1 = !strcmp(tc->pref_family, "v6") ?
|
||||
&tr->cf6 : &tr->cf4;
|
||||
|
|
@ -359,7 +359,7 @@ static void test_connect(CURL *easy, const struct test_case *tc)
|
|||
* - replace the creation of the TCP socket filter with our test filter
|
||||
* - test filter does nothing and reports failure after configured delay
|
||||
* - we feed addresses into the resolve cache to simulate different cases
|
||||
* - we monitor how many instances of ipv4/v6 attempts are made and when
|
||||
* - we monitor how many instances of IPv4/IPv6 attempts are made and when
|
||||
* - for mixed families, we expect HAPPY_EYEBALLS_TIMEOUT to trigger
|
||||
*
|
||||
* Max Duration checks needs to be conservative since CI jobs are not
|
||||
|
|
@ -384,20 +384,20 @@ static CURLcode test_unit2600(const char *arg)
|
|||
{ 1, TURL, "abc.test:123:192.0.2.1", CURL_IPRESOLVE_WHATEVER,
|
||||
CNCT_TMOT, 150, 250, 250, 1, 0, 200, TC_TMOT, R_FAIL, NULL,
|
||||
1 },
|
||||
/* 1 ipv4, fails after ~200ms, reports COULDNT_CONNECT */
|
||||
/* 1 IPv4, fails after ~200ms, reports COULDNT_CONNECT */
|
||||
{ 2, TURL, "abc.test:123:192.0.2.1,192.0.2.2", CURL_IPRESOLVE_WHATEVER,
|
||||
CNCT_TMOT, 150, 250, 250, 2, 0, 400, TC_TMOT, R_FAIL, NULL,
|
||||
2 },
|
||||
/* 2 ipv4, fails after ~400ms, reports COULDNT_CONNECT */
|
||||
/* 2 IPv4, fails after ~400ms, reports COULDNT_CONNECT */
|
||||
#ifdef USE_IPV6
|
||||
{ 3, TURL, "abc.test:123:::1", CURL_IPRESOLVE_WHATEVER,
|
||||
CNCT_TMOT, 150, 250, 250, 0, 1, 200, TC_TMOT, R_FAIL, NULL,
|
||||
1 },
|
||||
/* 1 ipv6, fails after ~200ms, reports COULDNT_CONNECT */
|
||||
/* 1 IPv6, fails after ~200ms, reports COULDNT_CONNECT */
|
||||
{ 4, TURL, "abc.test:123:::1,::2", CURL_IPRESOLVE_WHATEVER,
|
||||
CNCT_TMOT, 150, 250, 250, 0, 2, 400, TC_TMOT, R_FAIL, NULL,
|
||||
2 },
|
||||
/* 2 ipv6, fails after ~400ms, reports COULDNT_CONNECT */
|
||||
/* 2 IPv6, fails after ~400ms, reports COULDNT_CONNECT */
|
||||
{ 5, TURL, "abc.test:123:192.0.2.1,::1", CURL_IPRESOLVE_WHATEVER,
|
||||
CNCT_TMOT, 150, 250, 250, 1, 1, 350, TC_TMOT, R_FAIL, "v6",
|
||||
2 },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue