tool: fix retries in parallel mode

Verify that curl's --retry behaviour works

- test 502 in serial, works
- test 502 in parallel, hangs forver, test skipped by default
- test 401, no retries done

Fixes #20669
Reported-by: BlackFuffey on github
Closes #21206
This commit is contained in:
Stefan Eissing 2026-04-01 14:35:18 +02:00 committed by Daniel Stenberg
parent c54a3319ad
commit 78e281bf6a
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 67 additions and 0 deletions

View file

@ -143,3 +143,40 @@ class TestErrors:
])
assert r.exit_code == 60, f'{r}'
assert r.stats[0]['errormsg'] != 'CURL_DBG_SOCK_FAIL_IPV6: failed to open socket'
# Get, retry on 502
def test_05_06_retry_502(self, env: Env, httpd, nghttpx):
proto = 'http/1.1'
curl = CurlClient(env=env)
url = f'https://{env.authority_for(env.domain1, proto)}/curltest/tweak?status=502'
r = curl.http_download(urls=[url], alpn_proto=proto, extra_args=[
'--retry', '2', '--retry-all-errors', '--retry-delay', '1',
])
r.check_response(http_status=502)
assert r.stats[0]['num_retries'] == 2, f'{r}'
# curious, since curl does the retries, it finds the previous
# connection in the cache and reports that no connects were done
assert r.stats[0]['num_connects'] == 0, f'{r}'
# Get, retry on 502 in parallel mode
def test_05_07_retry_502_parallel(self, env: Env, httpd, nghttpx):
proto = 'http/1.1'
curl = CurlClient(env=env)
url = f'https://{env.authority_for(env.domain1, proto)}/curltest/tweak?status=502'
r = curl.http_download(urls=[url], alpn_proto=proto, extra_args=[
'--retry', '2', '--retry-all-errors', '--retry-delay', '1', '--parallel'
])
r.check_response(http_status=502)
assert r.stats[0]['num_retries'] == 2, f'{r}'
# Get, retry on 401, not happening
def test_05_08_retry_401(self, env: Env, httpd, nghttpx):
proto = 'http/1.1'
curl = CurlClient(env=env)
url = f'https://{env.authority_for(env.domain1, proto)}/curltest/tweak?status=401'
r = curl.http_download(urls=[url], alpn_proto=proto, extra_args=[
'--retry', '2', '--retry-all-errors', '--retry-delay', '1'
])
r.check_response(http_status=401)
# No retries on a 401
assert r.stats[0]['num_retries'] == 0, f'{r}'