Daniel Stenberg [Tue, 5 Aug 2025 06:47:31 +0000 (08:47 +0200)]
setopt: add helper functions to setopt_long()
- Consistently keep options within ranges
- Reduce the maximum maxredirs value to fit a signed short
- Removed comments as the place to document the options is not here
Stefan Eissing [Wed, 23 Jul 2025 07:18:59 +0000 (09:18 +0200)]
multi: add new information extraction method
Adds `curl_off_t curl_multi_get_offt(CURLM *multi_handle, CURLMinfo_offt
info)` to the multi interface with enums:
* CURLMINFO_XFERS_CURRENT: current number of transfers
* CURLMINFO_XFERS_RUNNING: number of running transfers
* CURLMINFO_XFERS_PENDING: number of pending transfers
* CURLMINFO_XFERS_DONE: number of finished transfers to read
* CURLMINFO_XFERS_ADDED: total number of transfers added, ever
Add documentation for functions and info enums.
Add use in the curl command line tool to replace two static
variables counting the same "from the outside".
Stefan Eissing [Mon, 4 Aug 2025 14:17:37 +0000 (16:17 +0200)]
lib: replace `getsock()` logic with pollsets
`getsock()` calls operated on a global limit that could
not be configure beyond 16 sockets. This is no longer adequate
with the new happy eyeballing strategy.
Instead, do the following:
- make `struct easy_pollset` dynamic. Starting with
a minimal room for two sockets, the very common case,
allow it to grow on demand.
- replace all protocol handler getsock() calls with pollsets
and a CURLcode to return failures
- add CURLcode return for all connection filter `adjust_pollset()`
callbacks, since they too can now fail.
- use appropriately in multi.c and multi_ev.c
- fix unit2600 to trigger pollset growth
Viktor Szakats [Mon, 4 Aug 2025 13:41:41 +0000 (15:41 +0200)]
GHA/windows: give more time for Ubuntu installs
Recently sometimes the Ubuntu package repository is very slow to access.
Remove the time limit for the install step, and bump the total limit,
aligning with Linux jobs.
In most cases the `install packages` steps takes 15-25 seconds.
Sometimes this goes up to 30-45 minutes.
Reported-by: nevakrien on github
Bug: https://github.com/curl/curl/discussions/14854#discussioncomment-13988574
Closes #18163
Daniel Stenberg [Mon, 4 Aug 2025 12:15:03 +0000 (14:15 +0200)]
hostip: do DNS cache pruning in milliseconds
Instead of using integer seconds. Also: if the cache contains over
30,000 entries after first pruning, it makes anoter round and removes
all entries that are older than half the age of the oldest entry until
it goes below 30,000.
Viktor Szakats [Sat, 2 Aug 2025 11:15:28 +0000 (13:15 +0200)]
runtests: add `--ci` option, show `Env:` only when non-empty
To reduce log noise in local test runs:
- move the `buildinfo.txt` dump and header info lines
`OS:`, `Perl:`, `diff:` behind a `--ci` `runtests.pl` option.
- enable this option for the CI test targets.
- hide `Env:` header info line if empty.
- merge `Env:` output into a single `logmsg()` call.
Viktor Szakats [Fri, 1 Aug 2025 22:18:12 +0000 (00:18 +0200)]
configure: if no perl, disable unity and shell completion, related tidy ups
Also:
- GHA/linux, macos: test `install` with autotools too.
- GHA/linux, macos: enable fish and zsh completion in an autotools job.
- scripts: drop dynamic perl checks redundant after this patch.
- scripts: drop two interim variables.
- autotools: make `build-certs` target check perl first.
- autotools: replace `$(PERL)` with `@PERL@` to match the pattern used
in most automake scripts. For consistency. This makes `PERL` be
defined at configure-time, as opposed to make-time, for these cases
now.
Stefan Eissing [Sat, 2 Aug 2025 10:55:11 +0000 (12:55 +0200)]
unit2600: add another case
Add a case with 1 ipv4 and 3 ipv6 and check that all are attempted with
the correct minimum duration before failures. To check that more ipv6
than ipv4 lead to the correct behaviour.
Viktor Szakats [Sat, 2 Aug 2025 11:10:05 +0000 (13:10 +0200)]
cmake: re-add simple test target, and name it `tests`
Before this patch there was no (easy) way to run tests without various
verbose options, hindering readability of the output due its length.
Unfortunately CMake reserves `test` as a target name, which was
the reason for its removal earlier. Re-add it with the name `tests`,
to have the functionality without the name collision.
Also add a `tests` target as an alias to `test` for autotools.
Viktor Szakats [Fri, 1 Aug 2025 10:49:40 +0000 (12:49 +0200)]
docs: add CURLOPT type change history, drop casts where present
Some CURLOPT constants defined in the curl public headers were initially
enums (= ints), or macros with bare numeric values. Recent curl releases
upgraded them to `long` constants, to make them pass correctly to
`curl_easy_setop()` by default, i.e. without requiring a `(long)` cast.
This patch drops such casts from the examples embedded in the docs. At
the same time it documents which curl release made them `long` types,
to keep them useful when working with previous libcurl versions.
Also:
- drop a `(long)` cast that was never necessary.
- CURLOPT_ALTSVC_CTRL.md: bump local copy of macros to long.
- test1119: make it ignore symbols ending with an underscore, to skip
wildcard, e.g. `**CURLAUTH_***`.
Viktor Szakats [Thu, 31 Jul 2025 14:38:34 +0000 (16:38 +0200)]
build: if no perl, fix to use the pre-built hugehelp, if present
- cmake: Before this patch a missing perl disabled the curl manual.
After this patch, it automatically picks up a pre-built hugehelp,
if present (= when building from a release tarball).
Follow-up to 0035ff45c59437db1a8ffe960b40905c8582b149 #16081
- autotools: Rework behavior when perl is missing. Before this patch
it caused a hard error when docs/manual/ca-embed were enabled.
Of these, docs were enabled by default. After this patch, doc
generation is automatically skipped, with a warning. Manual generation
falls back to using a pre-built hugehelp, or a stub if that's missing.
CA-embed is automatically skipped, with a warning.
Slight difference from cmake: When built with no perl and no pre-built
hugehelp, the manual is enabled, but the content is empty; with cmake
it's disabled proper.
Follow-up to 137aecfbf1e933e7228a4f62cc977eabffb2afbf #13514
Follow-up to 541321507e386744c3ea1200cc83cc98338e27d7 #12857
Also:
- GHA/distcheck: verify if the pre-built hugehelp makes it into curl.
- GHA/distcheck: streamline disabling perl with autotools.
- GHA/distcheck: `--disable-docs` no longer required to build without perl.
Passing it also implicitly disables the curl manual, which is
undesired in these tests.
- cmake: drop redundant `HAVE_MANUAL_TOOLS` interim variable.
- cmake: move two `set()` lines close to their counterparts.
Viktor Szakats [Fri, 1 Aug 2025 14:27:15 +0000 (16:27 +0200)]
CURLOPT: bump remaining macros to `long`
This patch bumps the size of these macros from `int` to `long`, while
keeping their actual values the same. It may cause incompatibilities in
user code, requiring the bump of holder variables and/or adding casts:
Viktor Szakats [Fri, 1 Aug 2025 14:47:41 +0000 (16:47 +0200)]
CURLOPT: bump `CURLPROTO_*` macros to `long`
This patch bumps the size of these macros from `int` to `long`, while
keeping their actual values the same. It may cause incompatibilities in
user code, requiring the bump of holder variables and/or adding casts:
Viktor Szakats [Fri, 1 Aug 2025 14:43:33 +0000 (16:43 +0200)]
CURLOPT: bump `CURL_SSLVERSION_*` macros to `long`
This patch bumps the size of these macros from `int` to `long`, while
keeping their actual values the same. It may cause incompatibilities in
user code, requiring the bump of holder variables and/or adding casts:
Viktor Szakats [Fri, 1 Aug 2025 15:35:42 +0000 (17:35 +0200)]
CURLOPT: bump `CURLWS_NOAUTOPONG`, `CURLWS_RAW_MODE` macros to `long`
This patch bumps the size of these macros from `int` to `long`, while
keeping their actual values the same. It may cause incompatibilities in
user code, requiring the bump of holder variables and/or adding casts:
- CURLWS_NOAUTOPONG
- CURLWS_RAW_MODE
Also:
- keep existing cast within the documentation to make sure it applies
to older curl versions as well.
Stefan Eissing [Fri, 1 Aug 2025 12:55:52 +0000 (14:55 +0200)]
openssl: check SSL_write() length on retries
When an SSL_write() blocks we need to retry it with the
same length as before or stupid OpenSSL freaks out. Remember
it, limit any longer sends and fail shorter ones.
Fixes #18121 Reported-by: adamse on github
Closes #18132
Stefan Eissing [Wed, 23 Jul 2025 09:21:36 +0000 (11:21 +0200)]
tls: CURLINFO_TLS_SSL_PTR testing
Add tests of CURLINFO_TLS_SSL_PTR and its returned value in test client
'hx-download'. Use obtained pointer to look up the negotiated TLS
version.
Update manpage of CURLINFO_TLS_SSL_PTR to also describe the behaviour of
wolfSSL similar to OpenSSL. Fix the wolfSSl implementation for TCP to
behave like that. Update the QUIC queries.
Fix rustls `get_internals()` to return the rustls_connection* and not
the address of the pointer.
Viktor Szakats [Thu, 31 Jul 2025 05:44:35 +0000 (07:44 +0200)]
schannel: not supported with UWP, drop redundant code
Schannel is not supported by UWP. SSPI is also required by Schannel in
curl, and SSPI also isn't supported by UWP.
mingw-w64 is able to create such build regardless (my guess: due to API
parts not accurately marked as UWP-only), but the binary is unlikely
to work. With MSVC the failure happens at build-time.
Drop all UWP-related logic, including two related feature checks, that
can now be permanently enabled.
Also:
- build: show fatal error for Schannel in UWP mode.
- build: do not allow enabling SSPI in UWP mode.
- drop undocumented option `DISABLE_SCHANNEL_CLIENT_CERT`. Added without
mention in an unrelated commit. The PR text says to save size. On x64
this is 0.3%, or 4KB out of 1.3MB. The tiny gain doesn't justify
an extra build variant. Ref: 8beff4355956e3d18ceb3afc21c1f3edec82543c
- move `MPROTO_SCHANNEL_CERT_SHARE_KEY` closer to its use.
- replace commented block with `#if 0`.
Viktor Szakats [Wed, 30 Jul 2025 00:12:22 +0000 (02:12 +0200)]
libtests: update format strings to avoid casts, drop some macros
- bump format strings to show the full value, drop casts.
- drop redundant casts (enum -> `%d`).
- drop some single-use macros.
- replace `int` with `bool` in testtrace.
Viktor Szakats [Wed, 30 Jul 2025 21:54:47 +0000 (23:54 +0200)]
CURLOPT: bump `CURL_REDIR_*` macros to `long`
This patch bumps the size of these macros from `int` to `long`, while
keeping their actual values the same. It may cause incompatibilities in
user code, requiring the bump of holder variables and/or adding casts:
Viktor Szakats [Tue, 29 Jul 2025 17:36:20 +0000 (19:36 +0200)]
windows: document toolchain support for some macros
The oldest MS SDK I checked is 6.0A (VS2008). Versions are approximate
beyond 7.1A. I only have two Win10 SDKs to verify:
10.0.16299.0 (VS2017-15.4) and 10.0.22621.0 (VS2022).
Viktor Szakats [Wed, 30 Jul 2025 11:50:38 +0000 (13:50 +0200)]
GHA/distcheck: add more tarball builds
- add AM out-of-tree no perl job.
- add AM in-tree no perl job.
- make CM out-of-tree job use no perl.
- add CM in-tree no perl job.
- run `curl -V` after builds.
- show the number of `--manual` lines.
- set `--enable-werror` in autotools jobs.
Viktor Szakats [Wed, 30 Jul 2025 12:11:05 +0000 (14:11 +0200)]
tests: fix perl warnings in http2-server, http3-server
AM libressl heimdal:
```
Global symbol "$verbose" requires explicit package name (did you forget to declare "my $verbose"?) at tests/http2-server.pl line 52.
Global symbol "$certfile" requires explicit package name (did you forget to declare "my $certfile"?) at tests/http2-server.pl line 109.
Global symbol "$keyfile" requires explicit package name (did you forget to declare "my $keyfile"?) at tests/http2-server.pl line 110.
Execution of tests/http2-server.pl aborted due to compilation errors.
[...]
```
Ref: https://github.com/curl/curl/actions/runs/16622030370/job/47028537336?pr=18099#step:39:3148
Viktor Szakats [Wed, 30 Jul 2025 11:15:20 +0000 (13:15 +0200)]
tests: fix prechecks to call the bundle libtest tool
Some tests make a hard-coded call to the libtest binary in the precheck
step. With bundle builds the binary changed name and calling convention.
Before this patch these tests failed the pre-check and did not run for
the 5 affected tests: 518, 537, 678, 1517, 1960
Since the content varies during connection setup and while doing it
(eyeballing), remove these strcut from `connectdata` and replace use
with querying the connection filters. Those keep that information
already.
Change the info logging of established connections to also give the
local address and port.
Viktor Szakats [Tue, 29 Jul 2025 07:53:14 +0000 (09:53 +0200)]
tests: merge clients into libtests, drop duplicate code
libtests and clients were built the same way after recent overhauls.
libtests are used by runtests, clients by pytests.
Merge clients into libtests, aligning their entry function signature,
dropping common utility functions, and simplifying the build.
Note: After this patch `CURLDEBUG` applies to cli tests, when enabled.
Also:
- lib552: drop local copy-paste debug callback in favor of testtrace.
- lib552: drop local copy-paste dump function in favor of testtrace.
- clients: use `long` for HTTP version, drop casts.
- clients: replace local dump function in favor of testrace clone.
- sync cli test entry function prototype with libtests'.
- h2_serverpush: replace local trace callback with testtrace.
- de-duplicate 3 websocket close, ping, ping, functions. Kept the pong
iteration from `ws_pingpong`. Note: the pong clone in `lib2304` was
returning an error when `curl_ws_recv()` returned non-zero and
the payload matched the expected one anyway. After this patch, this
case returns success, as it does in `ws_pingpong`.
`lib2304` keeps passing, but I'm not sure if the previous behavior
was intentional.
- display full value in websocket close, ping, pong, drop casts.
Stefan Eissing [Tue, 29 Jul 2025 08:15:43 +0000 (10:15 +0200)]
pytest: use dante-server in CI
- add startup check for 'danted' to avoid fails on low cpu
- rename 'sockd' to 'danted' everywhere to clarify what we use
- add proper defaults for 'danted' for debian
- install 'dante-server' in pytest ci runs