Commit Graph

387 Commits

Author SHA1 Message Date
Dan Fandrich
17e8200733 tests: make whitespace between functions and classes consistent
Mostly, this means two blank lines between classes and functions and one
line between methods. Since these checks are currently in preview, they
are done in a separate ruff invocation to avoid turning ALL the preview
checks on at the same time.
2026-04-08 10:28:05 -07:00
Dan Fandrich
98e470b3a8 tests: alphabetize and group Python imports & add check
- De-duplicates, groups, and sorts imports based on the provided `isort` settings.
2026-04-08 10:28:05 -07:00
Dan Fandrich
4c1b6f5494 tests: enable more ruff checks
- Checks for missing explicit `return` statements at the end of functions
that can return non-`None` values.
- Checks for classes that inherit from `object`.
- Checks for useless expressions.
- Within an `except*` clause, raise exceptions with `raise ... from err`
or `raise ... from None` to distinguish them from errors in exception
handling
- Checks for variable assignments that immediately precede a `return` of the
assigned variable.
- Checks for `else` statements with a `return` statement in the preceding
`if` block.
- Checks for unnecessary parentheses on raised exceptions.

Closes: #21258
2026-04-08 10:28:05 -07:00
Stefan Eissing
78e281bf6a
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
2026-04-03 17:06:16 +02:00
Dan Fandrich
bae6237c45 docs: list more dependencies for running Python HTTP tests
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
Reviewed-by: Viktor Szakats <commit@vsz.me>
Closes #21110
2026-03-30 21:54:39 -07:00
dependabot[bot]
bb0c8cf5af
GHA: bump pip-dependencies
- update `filelock` from 3.24.3 to 3.25.2
- update `ruff` from 0.15.2 to 0.15.7
- update `cryptography` from 46.0.5 to 46.0.6 (CVE-2026-34073)

Closes #21138
2026-03-28 03:43:26 +01:00
Stefan Eissing
a186ecf4bf
proxy: chunked response, error code
Add test1715 to check proper handling of chunked transfer
encoding in CONNECT responses. Change proxy error code from
56 (RECV_ERROR) for everything to 7 (COULDNT_CONNECT) when
the server response could be read successfully, but establishing
the connection is not possible (http status code wrong).

Adapt several test expectations from 56 to 7.

Closes #21084
2026-03-25 12:16:21 +01:00
Stefan Eissing
39036c9021
async-thrdd: use thread queue for resolving
Use a thread queue and pool for asnyc threaded DNS resolves.
Add pytest test_21_* for verification.

Add `CURLMOPT_RESOLVE_THREADS_MAX` to allow applications to
resize the thread pool used.

Add `CURLMOPT_QUICK_EXIT` to allow applications to skip thread
joins when cleaning up a multi handle. Multi handles in
`curl_easy_perform()` inherit this from `CURLOPT_QUICK_EXIT`.

Add several debug environment variables for testing.

Closes #20936
2026-03-25 12:14:21 +01:00
Stefan Eissing
745344ea4e
hostip: fix !no_signal mixup in resolve refaactor
When extracting the resolve case using alarm timers, the check for "we
are not allowed to use signals" was refactored wrong.

Follow-up to 96d5b5c688

Closes #21047
2026-03-21 14:28:54 +01:00
Stefan Eissing
9bc8b078eb
multi: improve wakeup and wait code
- Split WINSOCK and POSIX code in `multi_wait()` as the ifdef'ery
  was becoming unreadable
- define `ENABLE_WAKEUP` to mean the wakeup socketpair is enabled,
  no additional USE_WINSOCK check needed. Under WINSOCK
  `ENABLE_WAKEUP` is not defined, so it's availability is as before
  under the double defined() checks
- When the multi handle has "alive" transfers, the admin handle's
  pollset include the wakeup receive socket. This results in the
  admin handle running when someone uses `curl_multi_wakeup()`.
- Without any "alive" transfers, the wakeup socket is removed from
  the pollset. Otherwise, event based processing would never finish,
  eg. leave the event loop.
- The wakeup socket was never registered for event processing before,
  e.g. `curl_multi_wakeup()` never worked in that mode.
- Adjust test exepectations on socket callback invocations and
  number of sockets appearing in waitfds sets.

Closes #20832
2026-03-21 11:58:24 +01:00
Viktor Szakats
3bc6ae5500
mod_curltest: fix allocation size
It wasn't causing an issue with current usage.

Found by Codex Security

Follow-up to 35cfb081d2 #16541

Closes #20994
2026-03-19 12:02:10 +01:00
Stefan Eissing
91b422d356
pytest: add additional quiche check for flaky test_05_01
As long as stream resets are not visible in the API reliably,
exclude test_05_01, same as test_05_02 already.

Closes #20952
2026-03-17 14:53:15 +01:00
Stefan Eissing
5f13a7645e
proxy-auth: additional tests
Also eliminate the special handling for socks proxy match.

Closes #20837
2026-03-06 22:52:39 +01:00
dependabot[bot]
4427e6152a
GHA: bump actions and pip dependencies
- update action `actions/cache` from 5.0.1 to 5.0.3
- update action `github/codeql-action` from 4.31.9 to 4.32.4
- update pip `filelock` from 3.20.3 to 3.24.3
- update pip `ruff` from 0.14.14 to 0.15.2

Closes #20782
Closes #20783
2026-03-01 19:06:39 +01:00
Stefan Eissing
f1c9d5e484
easy: reset errorbuf on eyeballing success
Any failf() that fill the errorbuf need to be forgotten once happy
eyeballing finds a succssful winner. Because the errorbuf, once set, is
not overwritten with future error information.

Adds test_05_05 to verify.

Reported-by: Tim Friedrich Brüggemann
Fixes #20608

Closes #20613
2026-02-18 12:04:23 +01:00
Viktor Szakats
e269e3daf1
pytest: bump pip cryptography to 46.0.5
For CVE-2026-26007 (curl not affected)
2026-02-11 06:10:21 +01:00
dependabot[bot]
47734f3244
GHA: bump GHA and pip dependencies
- update `actions/checkout` from 6.0.1 to 6.0.2
- update `ruff` from 0.14.11 to 0.14.14
- update `cryptography` from 46.0.3 to 46.0.4
- update `psutil` from 7.2.1 to 7.2.2
- update `websockets` from 15.0.1 to 16.0

Closes #20490
Closes #20491
2026-02-01 16:40:37 +01:00
Stefan Eissing
f062b4b903
pytest: remove 03_02
The test for restarting the server during ongoing transfers does not
work reliably for HTTP/3. This seems due to the nature of UDP/QUIC where
the client may learn about a closed connection at any time, not only
when starting a new request.

Remove the test.

Closes #20458
2026-01-28 11:39:02 +01:00
Stefan Eissing
065b149df0
OpenSSL: check reuse of sessions for verify status
OpenSSL records its peer verification status inside its SSL_SESSION
objects. When a session is later reused, the SSL connection inherits
this verify status.

Session keys prevent reuse of sessions between connections that verify
the peer and those who do not. However, when Apple SecTrust is used
to verify a connection, this does not update the Sessions verify
status (and there is no setter). On session reuse, OpenSSL fails
the verification and Apple SecTrust cannot verify either since the
certificate peer chain is not available.

Fix this by checking the verification status on session reuse and
remove the session again if the peer needs to be verified, but the
session is not.

Reported-by: Christian Schmitza
Fixes #20435
Closes #20446
2026-01-27 14:03:47 +01:00
Daniel Stenberg
6aaac9dd38
vquic: drop support for OpenSSL-QUIC
- It is slower and uses more memory than the alternatives and is only
  experimental in curl.
- We disable a few tests for OpenSSL-QUIC because of flakiness
- It gets little attention from OpenSSL and we have no expectation of the
  major flaws getting corrected anytime soon.
- No one has spoken up for keeping it
- curl users building with vanilla OpenSSL can still use QUIC through the
  means of ngtcp2

Closes #20226
2026-01-17 22:49:34 +01:00
Stefan Eissing
1a57302d1a
ratelimit: download finetune
When a download size is known and rate limiting is in effect, adjust the
duration of each measurement step and its rate for maximum precision.

Since it is unpredictable how long the last bytes of a download will
take, download speed can be thrown off if the "last bytes" are a
significant amount of the total download. Make the "last bytes" small in
comparision to the rest and "stretch" the rate limit intervals to
accommodate the difference.

Fix ngtcp2 receive data acknowldgements to be based on a local window
size tracking. This allows window updates controlled by rate limits.

Fix ratelimit wait time calculation to accomodate negative tokens.

h3 rate limit, update timeers

Make download rate limits work correctly in ngtcp2. Fix multi handling
of rate limits to set a timer for when limits will update again.

Without running the transfer on limit updates, protocols like h2/h3 may
stall if the server does not send due to stream windows being too small.

scorecard: measure download speedlimits

When running scorecard with --limit-rate=n, show the reported download
speed averages plus percentage deviation from the limit.

Closes #20228
2026-01-16 16:42:31 +01:00
Viktor Szakats
ac6264366f
tidy-up: miscellaneous
- tool_bname: scope an include.
- `endif` comments.
- Markdown fixes.
- comment tidy-ups.
- whitespace, newlines, indent.

Closes #20309
2026-01-15 13:06:13 +01:00
Viktor Szakats
2949faa93c
badwords: fix typos found
Not caught in CI.

Closes #20308
2026-01-14 03:11:33 +01:00
dependabot[bot]
ad8374aedc
GHA: bump pip-dependencies
- update `ruff` from 0.14.10 to 0.14.11
- update `filelock` from 3.20.1 to 3.20.3 (CVE-2026-22701) (used in pytests)
- update `psutil` from 7.2.0 to 7.2.1

Closes #20300
2026-01-13 23:17:10 +01:00
Viktor Szakats
60f9d3dd7b
build: omit forward declarations
- drop redundant forward declarations.
- reorder local functions to not need forward declarations.
- tftpd: merge two `ifdef` blocks.

Closes #20297
2026-01-13 21:15:36 +01:00
Viktor Szakats
b6298a2336
mod_curltest: silence unused argument compiler warning
Closes #20292
2026-01-13 17:43:35 +01:00
Stefan Eissing
3b261e2ad7
pytest: bump quiche version check update
Since the Lazy Lucas did not manage to get the fix merged in 0.24.7,
increase the pytest version check number in the hope that it will happen
in the next release.

Closes #20229
2026-01-09 15:47:27 +01:00
Stefan Eissing
68b94daeb8
pytest: test 16_01 stabilize
When checking the reported times of a transfer, do not exptect
the 'queue' time to be in any relation to others. 'queue' uses its own
start timestamp and the reported duration is thereofore independant.

Ref: #20112
Closes #20163
2026-01-03 13:04:21 +01:00
Stefan Eissing
a348f19bd1
pytest: test 07_22 stabilize
Do not generate a 400 response code, but use a 200 one. The upload needs
to fail on sending, not on seeing a 400 response. Seeing a 400 before
the sending fails (when CI timings shift) will expose the wrong error
code.

Ref: #20112
Closes #20164
2026-01-03 00:48:54 +01:00
Stefan Eissing
2c32ab12a0
pytest: test 07_70 stabilize (curl_ngtcp2)
We recently allowed a larger send buffer in ngtcp2 streams. This allowed
curl to send more early data then previously when the server was slow in
performing the handshake. This led to flaky test failures when the
amount of early data was larger than expected.

Change test expectations to allow for varying amount of early data.

Ref: #20112
Closes #20161
2026-01-03 00:48:54 +01:00
Viktor Szakats
8292820b73
pytest: replace allowlist with feature check to enable OCSP test 17_08
Add a `cert-status` feature flag to `curlinfo`, based on the conditions
used in `lib/vtls` sources.

To:
- fix disabling this test when using OpenSSL (or fork) built with
  the `no-ocsp` option.
- enable this test for AWS-LC in CI.

Note:
- BoringSSL (and quiche) has OSCP disabled by default.
- MultiSSL dynamic selection continues to confuse this test.
  (To fix it, support would need to be detected by querying libcurl
  via curl. Probably overkill given that OCSP is on its way out.)

Follow-up to f2c765028f #20149

Closes #20133
2026-01-02 01:23:27 +01:00
Viktor Szakats
f2c765028f
pytest: enable OCSP test 17_08 for LibreSSL
Before: 735 passed, 115 skipped
After: 738 passed, 112 skipped

Closes #20149
2026-01-01 23:46:05 +01:00
dependabot[bot]
ef97f47635
GHA: bump pip-dependencies
- update `ruff` from 0.14.9 to 0.14.10
- update `psutil` from 7.1.3 to 7.2.0

Closes #20141
2026-01-01 20:49:00 +01:00
Stefan Eissing
4ec7136010
scorecard: more upload options
`--upload-no-cl` for uploads without "Content-Length:"
`--upload-parallel=1` for testing only serial uploads

Closes #20035
2025-12-19 13:58:12 +01:00
dependabot[bot]
1b205078bd
GHA: bump pip-dependencies
- update `filelock` from 3.20.0 to 3.20.1 (CVE-2025-68146) (used in pytests)
- update `pytest` from 9.0.1 to 9.0.2
- update `ruff` from 0.14.8 to 0.14.9

Closes #20004
2025-12-17 00:55:26 +01:00
Stefan Eissing
3a485c2ea0
pytest: do not ignore server issues
When a test server is found or configured, do not silently ignore
errors to start and disable them when checking their version.

This forces pytest to fail when a server is not operating
as it should.

Closes #19996
2025-12-16 13:19:00 +01:00
Viktor Szakats
d248d17cf3
cmake: update a comment 2025-12-12 13:09:52 +01:00
Stefan Eissing
eb39fee40b
pytest: add tests using sshd
With either /usr/sbin/sshd found or configured via --with-test-sshd=path
add tests for SCP down- and uploads, insecure, with known hosts or not,
with authorized user key or unauthorized one.

Working now with libssh and libssh2, using a hashed known_hosts file.

Closes #19934
2025-12-12 11:58:57 +01:00
Stefan Eissing
a73040ac8a
quiche: fix version for skip due to flakiness
0.24.6 is the quiche version without the fix for proper handling fo
RESET streams. Require a verion higher than that to run test_05_02.

Follow-up to 14478429e7 #19916

Closes #19921
2025-12-10 18:07:51 +01:00
Stefan Eissing
14478429e7
pytest: quiche flakiness
Let nghttpx only use http/1.1 to backend. This reproduces the bug in
quiche with higher frequency. Allow test_14_05 to now return a 400 in
addition to the 431 we get from a h2 backend to nghttpx.

Skip test_05_02 in h3 on quiche not newer than version 0.24.4 in which
its bug is fixed: https://github.com/cloudflare/quiche/pull/2278

Ref: https://github.com/cloudflare/quiche/issues/2277
Closes #19770 (original Issue)
Closes #19916
2025-12-10 15:26:27 +01:00
Stefan Eissing
d371288de7
test: increase altsvc test reliability
Move new tests from test_12 to test_06 (eyeballing) where they better
fit. Increase reliability by check Alt-Svc redirects from h3 to a lower
version for a port where no h3 is available.

Closes #19903
2025-12-10 00:23:33 +01:00
Stefan Eissing
44e64919cf
pytest: socksd startup delay
Add a small delay after the startup of the danted socks daemon to
give it more time to become responsive.

Closes #19895
2025-12-09 16:03:38 +01:00
Stefan Eissing
5ed7b5b01b
alt-svc: more flexibility on same destination
When the Alt-Svc points to the same host and port, add the destination
ALPN to the `wanted` versions and set it also as the `preferred` version
in negotiations.

This allows Alt-Svc for h3 to point to h2 and have it tried first. Also,
this allows Alt-Svc to say http/1.1 is preferred and changes the ALPN
protocol ordering for the TLS handshake.

Add tests in various combination to verify this works.

Reported-by: yushicheng7788 on github
Fixes #19740
Closes #19874
2025-12-09 15:59:09 +01:00
dependabot[bot]
cc853ddc3d
GHA: bump pip-dependencies ruff, psutil, pytest
- update `ruff` from 0.14.5 to 0.14.8
- update `psutil` from 7.1.2 to 7.1.3
- update `pytest` from 8.4.2 to 9.0.1

Closes #19876
2025-12-08 15:37:43 +01:00
Stefan Eissing
891566c72d
ftp: make EPRT connections non-blocking
On platforms where neither accept4 nor fcntl was available, an
EPRT connection did not send the accepted socket as non-blocking.

This became apparent when TLS was in use and the test receive
on shutdown did simply hang.

Reported-by: Denis Goleshchikhin
Fixes #19753
Closes #19851
2025-12-06 14:48:04 +01:00
Stefan Eissing
aba3c63ae8
pytest: fix and improve reliability
Address issues listed in #19770:
- allow for ngttpx to successfully shut down on last attempt that might
  extend beyond the finish timestamp
- timeline checks: allos `time_starttransfer` to appear anywhere in
  the timeline as a slow client might seen response data before setting
  the other counters
- dump logs on test_05_02 as it was not reproduced locally

Fixes #19970
Closes #19783
2025-12-02 17:15:36 +01:00
Stefan Eissing
9cf4a400d2
pytest: improve stragglers
A fix for the tests that took the longest:
- test_05: make the server close the HTTP/1.1 connection when
  simulating an error during a download. This eliminates waiting
  for a keepalive timeout
- test_02: pause tests with slightly smaller documents, eliminate
  special setup for HTTP/2. We test stream window handling now
  elsewhere already
- cli_hx_download: run look in 500ms steps instead of 1sec, resuming
  paused tranfers earlier.

Closes #19809
2025-12-02 17:04:20 +01:00
Viktor Szakats
d73efc62c1
tests: fix formatting nits
Also:
- lib1948: fix checksrc error TYPEDEFSTRUCT.
  (detected after formatting)

Closes #19754
2025-11-28 23:15:35 +01:00
Viktor Szakats
0081c5b126
pytest: disable two H3 earlydata tests for all platforms (was: macOS)
Follow-up to 692c7f133e #19252
Follow-up to eefd03c572 #18703

Ref: #19719
Ref: #19723

Fixes #19724
Closes #19730
2025-11-27 15:51:47 +01:00
Stefan Eissing
c4f29cc508
ip_quadruple/proxy: make port uint16_t
Make `port` member in these struct of type `uint16_t`.

add `uint8_t transport` to `struct ip_quadruple

Define TRNSPRT_NONE as 0. By assigning a valid transport only on a
successful connection, it is clear when the ip_quadruple members are
valid. Also, for transports not involving ports, the getinfos for
`CURLINFO_PRIMARY_PORT` and `CURLINFO_LOCAL_PORT` will now always return
-1.

Make all `transport` members and parameters of type `uint8_t`.

Document the return value of `CURLINFO_LOCAL_PORT` and
`CURLINFO_PRIMARY_PORT` in this regard. Add tests that writeout stats
report ports correctly.

Closes #19708
2025-11-27 14:32:01 +01:00