Commit graph

38374 commits

Author SHA1 Message Date
Viktor Szakats
20b18a43f6
src: drop detecting and redefining system symbol ftruncate
Introduce `toolx_ftruncate()` macro and map it to existing replacements
for non-mingw-w64 Windows and DJGPP, or to `ftruncate` otherwise.

Follow-up to 6041b9b11b #21109

Closes #21130
2026-03-30 13:46:14 +02:00
Stefan Eissing
335dc0e3c5
cf-dns: connection filter for DNS queries
New connection filter `cf-dns` that manages DNS queries. If hands
out addresses and HTTPS-RR records to anyone interested. Used by
HTTPS and IP happy eyeballing.

Information may become available *before* the libcurl "dns entry"
is complete, e.g. all queries have been answered. The cf-ip-happy
filter uses this information to start connection attempts as soon
as the first address is available.

The multi MSTATE_RESOLVING was removed. A new connection always
goes to MSTATE_CONNECTING. The connectdata bit `dns_resolved`
indicates when DNS information is complete. This is used for
error reporting and starting the progress meter.

Removed dns entries `data->state.dns[i]`, as the `cf-dns` filter
now keeps the reference now.

Many minor tweaks for making this work and pass address information
around safely.

Closes #21027
2026-03-30 13:28:38 +02:00
Viktor Szakats
89741958e8
cmake: use AIX built-in variable (with CMake 4.0+)
Also keep the old method for compatibility with CMake <4.0.

Ref: https://cmake.org/cmake/help/v4.0/variable/AIX.html

Closes #21134
2026-03-30 13:05:17 +02:00
Viktor Szakats
3502c5159b
GHA/linux: drop slow server logic for non-Azure source [ci skip]
Ref: https://github.com/curl/curl/actions/runs/23740539514/job/69156214117
Follow-up to 5172ba5475 #21107
2026-03-30 13:02:24 +02:00
Viktor Szakats
9dfe69cb3c
GHA/windows: bump to stunnel 5.77 (from 5.76)
Ref: https://www.stunnel.org/mailman3/hyperkitty/list/stunnel-announce@lists.stunnel.org/thread/BLYG54UILDIADJC2HWVFWQ2MK2YC3HOM/

Closes #21154
2026-03-30 11:00:37 +02:00
Viktor Szakats
89dbe84fdf
curl_ngtcp2: extend and update callbacks for 1.22.0+
Fixing:
```
lib/vquic/curl_ngtcp2.c:880:1: error: missing field 'recv_stateless_reset2' initializer [-Wmissing-field-initializers]
  880 | };
      | ^
```

Also:
- GHA/http3-linux: bump to ngtcp2 v1.22.0.

Refs:
https://github.com/ngtcp2/ngtcp2/releases/tag/v1.22.0
b7bfe41db8
https://github.com/ngtcp2/ngtcp2/pull/2035

Closes #21152
2026-03-30 10:59:38 +02:00
Daniel Stenberg
78cf1566f1
docs: mention more zip bomb precautions
Closes #21143
2026-03-29 23:42:11 +02:00
Daniel Stenberg
d87d4022aa
tool_operate: actually apply the --parallel-max-host limit
It was wrongly previously only used in debug code for event based
transfer and not in the "normal" parallel transfer case.

Follow-up to 4654493fed

Closes #21147
2026-03-29 18:59:34 +02:00
Daniel Stenberg
8f3f470bae
tool_cb_rea: make waitfd() return void
Nothing cared about the return code. Simplified.

Closes #21127
2026-03-28 23:00:42 +01:00
Dexter Gerig
fde2e9a6b2
configure: remove superfluous experimental warning for HTTP/3
This warning was created at a time when all backends for HTTP/3 were
experimental. Since there are now non-experimental backends this warning
is incorrect in some cases and was already handled by backends that were
added to the experimental list.

Follow-up to 0535f6ec71

Closes #21139
2026-03-28 22:59:22 +01:00
Viktor Szakats
f0f0a7f7d6
boringssl: fix more coexist cases with Schannel/WinCrypt
By moving the coexist workaround from vtls/openssl.c to vtls/openssl.h.
This way it also applies to vtls.c (and possibly other sources including
`vtls/openssl.h`), which may need it in unity builds before BoringSSL
header `openssl/ssl.h` pulling in the conflicting symbols and causing
conflicts otherwise.

Seen with build config:
```
-DCURL_USE_SCHANNEL=ON -DCURL_USE_OPENSSL=ON
-DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=30
```

Fixing:
```
In file included from _cm-win-boringssl/lib/CMakeFiles/libcurl_object.dir/Unity/unity_5_c.c:7:
In file included from lib/vtls/vtls.c:54:
In file included from lib/vtls/openssl.h:33:
In file included from /path/to/boringssl/_x64-win-ucrt/usr/include/openssl/opensslv.h:18:
In file included from /path/to/boringssl/_x64-win-ucrt/usr/include/openssl/crypto.h:18:
/path/to/boringssl/_x64-win-ucrt/usr/include/openssl/base.h:293:29: error: expected ')'
  293 | typedef struct X509_name_st X509_NAME;
      |                             ^
/path/to/llvm-mingw/x86_64-w64-mingw32/include/wincrypt.h:1515:29: note: expanded from macro 'X509_NAME'
 1515 | #define X509_NAME ((LPCSTR) 7)
      |                             ^
[...]
```

Ref: 2a92c39a21 #20567

Closes #21136
2026-03-28 15:52:41 +01:00
Viktor Szakats
9b01f73ac2
keylog.h: replace literal number with macro in declaration
Also syncing with the defintion.

Closes #21141
2026-03-28 15:51:04 +01:00
Viktor Szakats
31ec67651a
keylog: drop unused/redundant includes and guards
Closes #21137
2026-03-28 12:20:03 +01: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
Viktor Szakats
f1bdbd25e3
mk-ca-bundle.pl: tidy up more leftovers
Follow-up to 351e4f956a #21116
Follow-up to ca92e20123 #20528

Closes #21131
2026-03-28 00:55:09 +01:00
Viktor Szakats
30462cd66f
GHA/http3-linux: fix openssl4 version in cache keys
Follow-up to 7523de760d #21118

Closes #21132
2026-03-28 00:49:46 +01:00
Daniel Stenberg
4f316230fd
tool_util: fix the ftruncate use for DJGPP
Follow-up to 6041b9b11b

Since we define ftruncate as a macro, we can't use the macro within
the function!

Closes #21125
2026-03-27 16:51:07 +01:00
Daniel Stenberg
d7d683c3ba
tool_cb_hdr: use the file descriptor instead of calling fileno() again
Follow-up to 6041b9b11b

Closes #21126
2026-03-27 16:50:28 +01:00
Daniel Stenberg
ff678be69a
libssh: propagate error back in SFTP function
The myssh_in_SFTP_READDIR_BOTTOM() function would not store the error
code correctly thus it could be ignored and missed when an error was
returned at that particular moment.

Follow-up to 3c26e6a896

Found by Codex Security

Closes #21122
2026-03-27 16:12:51 +01:00
Daniel Stenberg
86b39c2226
transfer: clear the URL pointer in OOM to avoid UAF
Since the pointer can be extracted with CURLINFO_EFFECTIVE_URL later it
must not linger pointing to freed memory.

Found by Codex Security

Closes #21123
2026-03-27 15:56:12 +01:00
Daniel Stenberg
28fbf4a87d
multi: fix connection retry for non-http
non-HTTP protocols no longer retry after connection reuse failures
because multi_follow() now requires a handler->follow callback that is
NULL for those protocols. Provide a fallback for plain retries.

Follow-up to 1213c31272

Spotted by Codex Security

Closes #21121
2026-03-27 15:54:22 +01:00
Stefan Eissing
2e8c922a89
http2: prevent secure schemes pushed over insecure connections
When assembling the URL of a pushed resource over a not-secured
connection, require the scheme to be known and not secure.

Reported-by: xkilua on hackerone

Closes #21113
2026-03-27 14:23:29 +01:00
Viktor Szakats
351e4f956a
mk-ca-bundle.pl: drop reproducible timestamp feature
Mozilla may push to its repo much later than the commit date, which can
be a source of confusion when using the reproducible timestamp (which is
determined by the commit date) by default. Example:

https://curl.se/ca/cacert-2026-03-19.pem vs.
https://github.com/mozilla-firefox/firefox/commits/1a84aee6387d2f9c9531c655edeea4a80aa0fcfa/security/nss/lib/ckfw/builtins/certdata.txt

This feature had no actual user (or a planned one) from within curl at
the moment, and not requested by curl users. curl-for-win does this on
its own, which is the more practical way there since everything (not
just the CA bundle) needs to be reproducible anyway. I surmise this may
be true for most if not all reproducible use-cases.

Another limitation was that it could bump into GitHub's rate limiting,
needing further updates.

Also: code had some unintented leftovers.

Reported-by: Daniel Stenberg
Bug: https://github.com/curl/curl/pull/20528#issuecomment-4140610008
Follow-up to ca92e20123 #20528

Closes #21116
2026-03-27 14:19:31 +01:00
Viktor Szakats
7523de760d
GHA/http3-linux: add OpenSSL 4 beta jobs, with ECH
Closes #21118
2026-03-27 12:23:12 +01:00
Viktor Szakats
c025082967
openssl: fix build with 4.0.0-beta1 no-deprecated
```
lib/vtls/openssl.c:4238:22: error: ‘SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED’ undeclared (first use in this function); did you mean ‘SSL_R_TLS_ALERT_CERTIFICATE_EXPIRED’?
 4238 |           (reason == SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED))) {
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                      SSL_R_TLS_ALERT_CERTIFICATE_EXPIRED
lib/vtls/openssl.c:4238:22: note: each undeclared identifier is reported only once for each function it appears in
```
Ref: https://github.com/curl/curl/actions/runs/23641366299/job/68863072427#step:24:189

Cherry-picked from #21118

Closes #21119
2026-03-27 12:05:51 +01:00
Viktor Szakats
68fefb9f59
GHA/http3-linux: add missing step conditions
To omit unused cache restores. Saving ~7 seconds in jobs not using them.

Closes #21120
2026-03-27 11:53:57 +01:00
Daniel Stenberg
10d5177984
request: reset resp_trailer in new requests
Otherwise the trailer state lingers on into subsequent requests.

Follow-up to 29610e5f3d

Spotted by Codex Security

Closes #21112
2026-03-27 09:51:34 +01:00
Daniel Stenberg
cfc86e4e04
RELEASE-NOTES: synced 2026-03-27 09:38:59 +01:00
Daniel Stenberg
248b92939a
cf-socket: avoid low risk integer overflow on ancient Solaris
Spotted by Codex Security

Closes #21111
2026-03-27 09:34:42 +01:00
Daniel Stenberg
860c57dffd
test1619: download into %LOGDIR
Otherwise it will end up in tests/ which is not wanted.

Follow-up to d63432d1f8

Reported-by: Stefan Eissing

Closes #21114
2026-03-27 09:33:54 +01:00
Daniel Stenberg
916faac3dc
runtests: check for Debug case sensitively
For both TrackMemory and Debug

Closes #21099
2026-03-27 08:10:39 +01:00
Daniel Stenberg
b71973c115
tool: fix memory mixups
memory allocated by libcurl must be freed with curl_free() and vice versa,
memory allocated by the tool itself must be freed with curlx_free().

- dynbuf: free libcurl data with curl_free()
- tool_operate: make sure we get URL using the right memory
- tool_operhlp: free libcurl memory with curl_free()
- tool_operate: free curl_maprintf() pointer with curl_free
- var: data from curlx_base64_decode needs curlx_free
- tool_operate: fix memory juggling in etag handling
- tool_cb_hdr: fix memory area mixups
- tool_operate: another mixup in etag management
- tool_cb_hdr: more memory mixup fixes
- tool_cfgable.c: document some details
- tool_help: show global-mem-debug in -V output

Closes #21099
2026-03-27 08:10:32 +01:00
Daniel Stenberg
46d0ade086
GHA: add a 'curl_global_init_mem debug' job
Closes #21099
2026-03-27 08:10:29 +01:00
Daniel Stenberg
59c11074cf
src: add curl_global_init_mem testing
Build with "configure --enable-init-mem-debug" to make the tool use
curl_global_init_mem() and a set of private memory funtion callbacks for
libcurl's memory management.

Using this setup, memory mixups in tool code is more likely to cause
crashes and thus get discovered while running tests.

This curl_global_init_mem debug mode can only be done when building
libcurl shared (not static) and without debugging enabled - since it
needs to use the custom memory funtion callbacks.

Closes #21099
2026-03-27 08:10:14 +01:00
Daniel Stenberg
6041b9b11b
src: use ftruncate() unconditionally
Systems without it need to provide a custom alternative just like we
have have for Windows. This adds an MSDOS version that fails if trying
to truncate a too large file.

Closes #21109
2026-03-27 08:05:48 +01:00
Daniel Stenberg
d63432d1f8
tool_cb_hdr: only truncate etags output when regular file
When sending the output to stdout it cannot truncate.

Add test1619 to verify --etag-save to stdout

Spotted by Codex Security

Closes #21103
2026-03-26 23:39:28 +01:00
Daniel Stenberg
e1fdbdd16f
hsts: when a dupe host adds subdomains, use that
Otherwise a weaker earlier entry is allowed to override a later more
restrictive one.

Add test 1638 to verify.

Closes #21108
2026-03-26 23:27:24 +01:00
Viktor Szakats
5172ba5475
GHA: try workaround for slow Azure Ubuntu distro server
It's been going on for almost a year, chances seem slim to have this
fixed upstream.

The observed issue is that on GitHub-supplied CI runner images,
sometimes, `apt-get install` using the stock distro server
`http://azure.archive.ubuntu.com/ubuntu` sees extreme slowness while
downloading data, then reaching the job timeout and aborting, making CI
red and necessitating a manual restart of the failed job(s).

In majority of cases the install step takes no longer than 8-40 seconds
(download + install), while in the failing case it takes 10-20+ minutes
just to download.

Earlier I slimmed down installs to avoid unnecessary packages, which
mitigated, but did not completely fix the issue.

Example:
https://github.com/curl/curl/actions/runs/23599596928/job/68725576899?pr=21105

Follow-up to 0455d8772a #18509

Closes #21107
2026-03-26 23:05:59 +01:00
Viktor Szakats
128c252975
GHA/curl-for-win: pass GH token to the containers
To avoid rate limits when accessing GH APIs during the build.

Aiming to avoid (while trying to retrieve a file timestamp):
```
++ [[ 2026-02-11-1a84aee6387d2f9c9531c655edeea4a80aa0fcfa =~ (.+)-([a-f0-9]{40,}) ]]
++ ver=2026-02-11
++ commit=1a84aee6387d2f9c9531c655edeea4a80aa0fcfa
++ set +x
curl: (22) The requested URL returned error: 403
curl: (22) The requested URL returned error: 403
curl: (22) The requested URL returned error: 403
curl: (22) The requested URL returned error: 403
[...]
```
Ref: https://github.com/curl/curl/actions/runs/23598912140/job/68723120977?pr=21104

Follow-up to:
a26898fe48
17f2fb3ead
6dd6e47e98
b461404b5a

Closes #21105
2026-03-26 16:08:37 +01:00
Viktor Szakats
20914e3753
perl: harden external command invocations
In `adddocsref.pl`, `checksrc-all.pl`, `singleuse.pl` and tests 307, 1013,
1022, 1275, 1707, 1708, 1710.

Closes #21097
2026-03-26 14:20:07 +01:00
Viktor Szakats
a56ab9dbc8
cmake: add CMake Config-based dependency detection for c-ares, wolfSSL
For wolfSSL it requires v5.2.1+, and with 5.9.0+ it's also supported when
wolfSSL was built with autotools.

Follow-up to 8fce3e17e6 #20814

Closes #21098
2026-03-26 11:20:03 +01:00
Daniel Stenberg
f660b77f74
DEPRECATE.md: fix copy-and-paste mistaken subtitles
Closes #21102
2026-03-26 11:06:25 +01:00
Daniel Stenberg
897f7143c5
docs/VERIFY.md: verify curl
Don't trust, verify!

Closes #21085
2026-03-26 07:57:25 +01:00
Daniel Stenberg
970f0a8cec
cleancmd.pl: remove markdown links before spellcheck
Closes #21085
2026-03-26 07:57:19 +01:00
Daniel Stenberg
0c14ed62c4
location/follow: mention netrc
Closes #21091
2026-03-26 07:56:42 +01:00
Viktor Szakats
bf6a34d8eb
md4, md5: switch to wolfCrypt API in wolfSSL builds
Replacing the OpenSSL-like compatibility interface, and syncing with other
hashes, when building with wolfSSL.

Also: stop stomping on OpenSSL public MD4 symbols. This makes the wolfSSL
coexist workaround unnecessary, while also syncing up with MD5 sources.

After this patch the only remaining reference to wolfSSL's OpenSSL
compatibility layer is in `lib/curl_ntlm_core.c`.

Closes #21093
2026-03-25 18:56:40 +01:00
Viktor Szakats
486334509f
curl_ntlm_core: drop redundant PP condition
`LIBWOLFSSL_VERSION_HEX` is always present in supported wolfSSL
versions.

Closes #21096
2026-03-25 18:56:40 +01:00
Viktor Szakats
afa71f1a22
spacecheck: verify filename lengths and characters
Maximum filename length 64, of which 48 maximum for the filename part.
Allowed characters: `A-Za-z0-9/._-`.

Also:
- rename a file to pass the check.
- init max constants outside the loop.
- minor fix to an error message.
  Follow-up to 62d77b12fc #21087

Closes #21095
2026-03-25 18:56:40 +01:00
Stefan Eissing
dc9a03e855
multi: multi_wait fixes after #20832
The refactoring in #20832 introduced some inconsistencies between
windows and posix handling, pointed out by reviews. Fix them:

- rename `wait_on_nop` back to `extrawait` as it was called before
- use multi_timeout() to shorten the user supplied timeout for
  both windows/posix in the same way
- remove the extra multi_timeout() check in the posix function
- Add the multi's wakeup socket for monitoring only when there
  are other sockets to poll on or when the caller wants the
  extra waiting time.

Closes #21072
2026-03-25 12:17:58 +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