Daniel Stenberg [Tue, 8 Apr 2025 06:00:12 +0000 (08:00 +0200)]
lib: include files using known path
by including headers using "../[header]" when done from C files in
subdirectories, we do not need to specify the lib source dir as an
include path and we reduce the risk of header name collisions with
headers in the SDK using the same file names.
Johan Eliasson [Mon, 7 Apr 2025 20:20:29 +0000 (22:20 +0200)]
docs: fix incorrect shell substitution in docker run example command
Corrected the volume mount path in the Docker run example by replacing
`(pwd)` with the shell substitution syntax `$(pwd)`. This ensures the
current working directory is properly mounted into the container.
Viktor Szakats [Sun, 16 Mar 2025 13:19:38 +0000 (14:19 +0100)]
curl_multibyte: fixup low-level calls, include in unity builds
Also adjust `()` around low-level calls preventing macro overrides via
e.g. `memdebug.h`:
- add for `malloc` and `free`.
- drop for `_open`. (We do not override `_open` in curl.)
Tidy-up: also sync libcurlu custom macro order in cmake with autotools.
Andy Pan [Sun, 6 Apr 2025 12:37:10 +0000 (20:37 +0800)]
socketpair: support pipe2 where available
By replacing pipe with pipe2, it would save us 4 extra system calls of
setting O_NONBLOCK and O_CLOEXEC. This system call is widely supported
across UNIX-like OS's: Linux, *BSD, and SunOS derivatives - Solaris,
illumos, etc.
Daniel Stenberg [Sun, 6 Apr 2025 10:04:33 +0000 (12:04 +0200)]
make: clean tests better
1. 'make clean' in the root dir now also invokes 'make clean' in the
tests subdir so that it cleans up better recursively. The Makefile.am
does not list 'tests' as a normal subdir to avoid building that
directory for a normal make invoke.
2. 'make clean' in the tests/libtest and tests/unit directories now
*explicitly* remove the unity build executables even if this is not a
unit build. This, because those files may be leftovers from previous
builds and such leftovers can otherwise linger around and since
'runtests.pl' dynamically acts differently based on the mere *presence*
of those files, they can keep you fooled for a while until you
realize...
Andy Pan [Sat, 5 Apr 2025 15:55:32 +0000 (23:55 +0800)]
socket: use accept4 when available
Linux, *BSD, and Solaris support accept4 system call that enables the
caller to assign additional flags and save some extra system calls. It
can come in handy when O_NONBLOCK or/and FD_CLOEXEC is/are required on a
socket after being accepted.
scripts: completion.pl: sort the completion file for all shells
The reproducible builds effort in Debian has caught a regression in curl
8.13.0-rc1 but we were a bit slow to realize it. The ordering of the
completion file for fish is not deterministic so it can differ between
builds. Since there is no restriction about the order of the completion
file for fish, let's just sort it too.
Daniel Stenberg [Fri, 4 Apr 2025 12:34:10 +0000 (14:34 +0200)]
randdisable: build randomizer
This script makes a "random" build using configure and verifies that it
builds curl correctly. It randomly adds a number of the available
--disable-* flags to configure. When it detects a problem the script
stops, otherwise it continues trying more combinations.
Stefan Eissing [Fri, 4 Apr 2025 08:43:13 +0000 (10:43 +0200)]
http2: fix stream window size after unpausing
When pausing a HTTP/2 transfer, the stream's local window size
is reduced to 0 to prevent the server from sending further data
which curl cannot write out to the application.
When unpausing again, the stream's window size was not correctly
increased again. The attempt to trigger a window update was
ignored by nghttp2, the server never received it and the transfer
stalled.
Add a debug feature to allow use of small window sizes which
reproduces this bug in test_02_21.
Dan Fandrich [Fri, 4 Apr 2025 18:35:33 +0000 (11:35 -0700)]
tests: unify test case keywords
Unify the case, punctuation and name of test case keywords so they can
be more easily selected or skipped when desired. Add a few keywords that
were missing. Fix a couple of typos in test names.
To use curl as a tool for troubleshooting SigV4 signing, it is useful to
have the 'Canonical Request', 'String To Sign' and 'Signature'
calculations output.
SIZE_MAX is an very overkill size for certificates or keys, lower it to
100KiB for both certificate and keys. The default max size of openssl is
100KiB for the entire chain [1], and it seems firefox fails at ~60kb
[2].
Viktor Szakats [Sat, 29 Mar 2025 02:41:45 +0000 (03:41 +0100)]
tests: prefer `--insecure` over `-k`
To make it uniform in all tests, and greppability.
Also:
- replace `-k` flag with `-q` in test 1268. (the actual flag doesn't
matter in this test)
- keep `-k` in test 300 to test its short form.
(also verified to fail without a working `-k`)
Stefan Eissing [Thu, 3 Apr 2025 11:11:32 +0000 (13:11 +0200)]
dnscache: slight refactoring
Slight refactoring around dnscache, e.g. hostcache
- eliminate `data->state.hostcache`. Always look up
relevant dnscache at share/multi.
- unify naming to "dnscache", replacing "hostcache"
- use `struct Curl_dnscache`, even though it just
contains a `Curl_hash` for now.
- add `Curl_dnscache_destroy()` for cleanup in
share/multi.
Viktor Szakats [Tue, 1 Apr 2025 21:32:16 +0000 (23:32 +0200)]
eventfd: fix feature guards
Enable eventfd code consistently when both `HAVE_EVENTFD` and
`HAVE_SYS_EVENTFD_H` macros are defined.
Before this patch `HAVE_EVENTFD` guarded it alone, though the code
also required the header, which was guarded by `HAVE_SYS_EVENTFD_H`.
These should normally be detected in pairs. When they aren't, omit using
`eventfd()` to avoid calling it without a known matching header.
If this disables valid cases (e.g. some system declares this function
via a different header), feature detection and the code may be extended
for those cases. If these are known to come in pairs, always, another
option is detect them both at build stage, and forward a single macro
to C.
Viktor Szakats [Wed, 2 Apr 2025 10:24:43 +0000 (12:24 +0200)]
configure: restore link checks
The omitted link checks were not what I though they were. Omitting one
caused a mis-detection on Solaris, where the compile check alone
mis-detects `CloseSocket` as present.
Restore link checks for these functions:
`closesocket`, `ioctlsocket`, `socket`, `freeaddrinfo`, `getaddrinfo`,
`gethostname`, `getpeername`, `getsockname`,
`CloseSocket` (AmigaOS), `IoctlSocket` (AmigaOS).
Also re-sync link check code snippets with the ones in current master.
Viktor Szakats [Tue, 1 Apr 2025 22:04:56 +0000 (00:04 +0200)]
GHA/windows: move libssh job from vcpkg to MSYS2
To avoid upstream issue where libssh no longer builds with vcpkg:
```
error: building libssh:x64-windows failed with: BUILD_FAILED
```
Ref: https://github.com/curl/curl/actions/runs/14206672441/job/39805869213?pr=16909#step:5:64
Viktor Szakats [Tue, 1 Apr 2025 22:29:56 +0000 (00:29 +0200)]
GHA/windows: make libssh2 install a per job config
To allow making per-job variations for SSH backends.
Also:
- fix Cygwin builds to not ignore per-job `install:` items.
It worked by accident before this patch.
Follow-up to 66313cc036671cd4d3e72db65a79a715c7b8f154 #16629
Daniel Stenberg [Tue, 1 Apr 2025 08:46:07 +0000 (10:46 +0200)]
vtls_scache: remove "Unreachable Call"
The condition required to reach this call could not happen, because
cf_ssl_scache_get() already checks the same condition and returns NULL
for 'scache' prior to this.
Stefan Eissing [Tue, 1 Apr 2025 11:44:24 +0000 (13:44 +0200)]
http2: fix stream assignemnt for pushes
When a PUSH_PROMISE was received, the h2_stream object was assigned
to the wrong `newhandle->mid` and was thereafter not found. This led
to internal confusion, because the nghttp2 stream user_data was not
cleared and an invalid easy handle was use for trace messages,
resulting in a crash.
Reported-by: Viktor Szakats
Fixes #16881
Closes #16905
Viktor Szakats [Tue, 1 Apr 2025 10:36:06 +0000 (12:36 +0200)]
GHA/windows: drop GnuTLS-fork from vcpkg MultiSSL job
curl now has a working GnuTLS CI job, with tests, with MSYS2.
The MultiSSL build scenario is now tested on macOS.
The vcpkg GnuTLS package seems to have a deep dependency tree with large
packages that need to be rebuilt relatively frequently. Since they can't
fit into to the time limit, these cause CI failures.
To stabilize CI, drop the `shiftmedia-libgnutls` dependency.
Viktor Szakats [Tue, 1 Apr 2025 09:02:57 +0000 (11:02 +0200)]
runtests: fix bundled test invocation with `-g` option
Fixes:
```
$ ./runtests.pl -g 1940
./libtest/libtests lib1940: No such file or directory.
Argument list to give program being debugged when it is started is "http://127.0.0.1:44547/1940".
```
Reported-by: Daniel Stenberg
Fixes #16893
Closes #16898
Daniel Stenberg [Mon, 31 Mar 2025 11:49:18 +0000 (13:49 +0200)]
GHA: run random curl command lines for N seconds in CI
In the memory and address sanitizer builds.
Verify that nothing unexpected happens.
Starting out with 60 second runs.
The script does not set any seed so it runs with a new random every
time, meaning that if it fails in a single CI run it might not fail in a
subsequent one: but it should still show the full command that failed to
enable us to reproduce it locally. We can work on improving the seed
situation later if this script turns useful.
Daniel Stenberg [Sat, 29 Mar 2025 18:10:40 +0000 (19:10 +0100)]
urlapi: remove percent encoded dot sequences from the URL path
Treat %2e and %2E to be "dot equivalents" in the function and remove
such sequences as well, according to RFC 3986 section 5.2.4. That is
also what the browsers do.
This DOES NOT consider %2f sequences in the path to be actual slashes,
so there is no removal of dots for those.
This function does not decode nor encode any percent sequences.
Also switched the code to use dynbuf.
Extends test 1395 and 1560 to verify.
Assisted-by: Demi Marie Obenour
Fixes #16869
Closes #16870
Austin Moore [Wed, 19 Mar 2025 03:58:56 +0000 (23:58 -0400)]
aws_sigv4: merge repeated headers in canonical request
When multiple headers share the same name, AWS SigV4 expects them to be
merged into a single header line, with values comma-delimited in the
order they appeared.
Viktor Szakats [Sun, 30 Mar 2025 20:34:26 +0000 (22:34 +0200)]
build: drop `build-certs` as a test-run dependency
After adding it as a test executables dependency, it run twice in
MSBuild jobs. Also there is little reason to try building them in both
build and run tests targets.
(The reason MSBuild building it twice, is our use of
`TrackFileAccess=false` to improve build performance.)
Viktor Szakats [Sat, 29 Mar 2025 13:43:10 +0000 (14:43 +0100)]
genserv.pl: detect `openssl` in `PATH`, omit `command -v`
Before this patch the script relied on Perl `system()` finding `openssl`
in `PATH`, plus tried to display the full path of `openssl` by using
`command -v` (or `which` on Windows). `command -v` did not work in CI
for unknown reasons. To resolve it, this patch detects `openssl` in
`PATH` manually, displays the detected full path and calls `openssl`
with the detected full path, and stops relying on `system` for this.
It also follows how `sshhelp.pm` is detecting executables. Though this
patch uses Perl `-f` instead of `-e && -d` used there .
Silencing this in CI logs:
```
Can't exec "command": No such file or directory at ../../../tests/certs/genserv.pl line 51.
```
Ref: https://github.com/curl/curl/actions/runs/14145795884/job/39632942668?pr=16865#step:39:108