Commit Graph

38400 Commits

Author SHA1 Message Date
Daniel Stenberg
9820e5dfac
tool_operate: fix memory-leak on failed uploads
Add test case 1673 to do repeated upload failures and verify there is no
leak. This proved a previous leak and now it verifies the fix.

Reported-by: James Fuller
Closes #21062
2026-03-22 23:58:02 +01:00
Viktor Szakats
e8c64a06c5
asyn-thrdd: fix clang-tidy unused value warning
with `-DCURL_DISABLE_SOCKETPAIR=ON`.

```
lib/asyn-thrdd.c:227:5: error: Value stored to 'do_abort' is never read [clang-analyzer-deadcode.DeadStores,-warnings-as-errors]
  227 |     do_abort = addr_ctx->do_abort;
      |     ^          ~~~~~~~~~~~~~~~~~~
```

Closes #21061
2026-03-22 19:15:56 +01:00
Viktor Szakats
757fd6aae9
gnutls: fix clang-tidy warning with !verbose
with
`-DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_USE_GNUTLS=ON -DCURL_CLANG_TIDY=ON`.

```
lib/vtls/gtls.c:268:7: error: Value stored to 'strerr' is never read [clang-analyzer-deadcode.DeadStores,-warnings-as-errors]
  268 |       strerr = gnutls_strerror(rc);
      |       ^        ~~~~~~~~~~~~~~~~~~~
```

Closes #21060
2026-03-22 19:15:56 +01:00
Daniel Stenberg
57a94fec47
multi.h: add CURLMNWC_CLEAR_ALL
The two bitmask constants for *CLEAR_DNS and *CLEAR_CONNS were
duplicates (both set to 1), so they cannot be distinguished and both
actions fire.

This shipped in public releases since 8.16.0 to and include 8.19.0.

This fix adds CURLMNWC_CLEAR_ALL to be the new 1, and it now implies all
bits. The DNS and CONNS defines get two new bits (2, 4).

Follow-up to 55c045c863

Found by Codex Security
Closes #20968
2026-03-22 18:06:32 +01:00
Daniel Stenberg
e9eddedf38
Revert "md5/md4: enable unaligned access fast path on powerpc64"
This reverts commit 21fc17b265.

That was not properly thought through. PowerPC can run in either endian
and the preprocessor does not know which.

Ref: #20985
Closes #21058
2026-03-22 18:04:08 +01:00
Viktor Szakats
fcec44df00
FAQ.md: point archive.org link to the original, no-JS, revision [ci skip]
To make it pass mdlinkcheck, open faster, w/o cookie banner, and not
need special URL format to make JS happy.

Ref: 1dc0ce9562
2026-03-22 13:33:34 +01:00
Daniel Stenberg
d3ae2e0565
RELEASE-NOTES: synced 2026-03-22 12:02:49 +01:00
Daniel Stenberg
6393103b99
lib: make SMB support opt-in
The SMB protocol has weak security and is rarely used these days.

Note that SMB also requires NTLM enabled.

Closes #20846
2026-03-22 11:55:39 +01:00
Viktor Szakats
06a83340b1
GHA/curl-for-win: enable c-ares with HTTPS-RR in an existing job
c-ares builds have been sped up within curl-for-win using, pre-fills. It
allows building it with acceptable performance, making it practical to
use it, alongside HTTPS-RR, in curl CI and possibly in curl-for-win. It
has been enabled in its dev branch for a while.

Ref: 61a7354120

Closes #21032
2026-03-22 00:26:25 +01:00
Viktor Szakats
e09a7b83d6
cf-https-connect: silence -Wimplicit-int-enum-cast with HTTPS-RR + clang 21
Fixing (seen in curl-for-win dev branch):
```
In file included from _a64-linux-gnu-bld/lib/CMakeFiles/libcurl_object.dir/Unity/unity_0_c.c:34:
lib/cf-https-connect.c:681:28: error: implicit conversion from 'unsigned char' to enumeration type 'enum alpnid' is invalid in C++ [-Werror,-Wimplicit-int-enum-cast]
  681 |         enum alpnid alpn = rr->alpns[i];
      |                     ~~~~   ^~~~~~~~~~~~e
```

Ref: #21032

Closes #21057
2026-03-21 23:45:55 +01:00
Daniel Stenberg
789282cb8d
lib: drop support for < c-ares 1.16.0
Closes #20911
2026-03-21 23:37:59 +01:00
Scott Boudreaux
21fc17b265
md5/md4: enable unaligned access fast path on powerpc64
PowerPC64 (both big-endian and little-endian) supports efficient
unaligned memory access, similar to x86. This extends the existing
fast path that avoids byte-by-byte loads in the MD5 and MD4 SET/GET
macros.

On POWER8 ppc64le, this eliminates 3 shifts + 3 ORs per 32-bit word
load, replacing them with a single lwz (or lwbrx on big-endian).

Co Authored By Claude Opus 4.6 (1M context)

Closes #20985
2026-03-21 23:35:58 +01:00
Daniel Stenberg
77ed315096
progress: count amount of data "delivered" to application
... and apply the CURLOPT_MAXFILESIZE limit (if set) on that as well.
This effectively protects the user against "zip bombs".

Test case 1618 verifies using a 14 byte brotli payload that otherwise
explodes to 102400 zero bytes.

Closes #20787
2026-03-21 23:21:55 +01:00
Daniel Stenberg
fa13f373b2
netrc: skip malformed macdef lines
When skipping macdef lines inside netrc files, ignore it completely and
do not tokenize or bail out on bad quotes.

Verify in test 1672

Follow-up to 3b43a05e00

Spotted by Codex Security
Closes #21049
2026-03-21 23:20:49 +01:00
Daniel Stenberg
6026d76fdf
test1668: unit test the FTP 213 time response parser
Should make it harder to introduce regressions.

Closes #21051
2026-03-21 23:10:32 +01:00
Daniel Stenberg
89d649c482
badwords-all: stop checking source code comments
The code runs under different rules than documentation and these checks
cause too much friction with too little gain.

Leave checking of the public include files since they are almost
documentation.

Closes #21048
2026-03-21 22:58:51 +01:00
Viktor Szakats
6c64d39dce
hostip: drop guard from Curl_resolver_error() definition
To sync with its declaration.

Fixing (seen when building trurl in curl-for-win):
```
ld.lld: error: undefined symbol: Curl_resolver_error
```
Ref: https://github.com/curl/curl-for-win/actions/runs/23388349475/job/68038915761#step:3:7469

Closes #21054
2026-03-21 22:42:38 +01:00
Viktor Szakats
3025c9778a
testcurl.pl: replace shell commands with Perl rmtree()
Ref: https://perldoc.perl.org/5.8.2/File::Path
Follow-up to e992aa6a54

Closes #21053
2026-03-21 22:42:38 +01:00
Harry Sintonen
e2186933c1
tool: add check for curlinfo->age when determining if ssh backend is libssh2
The code failed to check for the version, and could thus read memory
past the existing curl_version_info_data structure. This could lead to a
crash.

Closes #21050
2026-03-21 18:54:23 +01:00
Viktor Szakats
8fce3e17e6
cmake: add CMake Config-based dependency detection
After limiting `find_package()`/`find_dependency()` calls to curl local
Find modules via the `MODULES` keyword, it became possible to detect
dependencies via CMake Configs from within those local Find modules, by
calling `find_package()` again with the `CONFIG` keyword. This patch
implements this. Then maps detection results to the result variables and
curl-specific imported targets the rest of the build expects.

Also honor recently introduced `*_USE_STATIC_LIBS` (experimental) flags
to map to the static target when requested.

This adds CMake Configs as an alternative to the existing `pkg-config`
and `find_path()`/`find_library()` auto-detection methods.

Enabled by default for MSVC, outside vcpkg and when not cross-building.
To enable for other cases, or override the default, you can use
`-DCURL_USE_CMAKECONFIG=ON` or `OFF`.

When enabled, Config detection happens after `pkg-config` and before
`find_path()`/`find_library()`. Using CMake's built-in options, you may
also manually point to the absolute directory holding Config files:

`Libssh2_DIR`, `MbedTLS_DIR`, `NGHTTP2_DIR`, `NGHTTP3_DIR`,
`NGTCP2_DIR` v1.19.0+ (with non-fork OpenSSL only), `Zstd_DIR` v1.4.5+

E.g. `-DMbedTLS_DIR=/path/to/mbedtls/lib/cmake/MbedTLS`

These dependencies typically need to be built with CMake to support
this.

Tagged as experimental.

Refs:
#20013 #19156 #19117
https://github.com/curl/curl/pull/20784#issuecomment-3984318492

Depends-on: fad1ebaecc #20840
Follow-up to 91e06fde1b #20784
Follow-up to 26c39d8df1 #20015

Closes #20814
2026-03-21 18:52:31 +01:00
Daniel Stenberg
aef8fd00c8
GHA: add NTLM to lots of builds 2026-03-21 15:30:04 +01:00
Daniel Stenberg
cc0c83c5f8
build: make NTLM disabled by default
NTLM has weak security and does not work over HTTP/2 or HTTP/3.

Enable in cmake or configure to get support for it.

Closes #20698
2026-03-21 15:30:03 +01:00
Daniel Stenberg
c247725b92
DEPRECATE: remove last empty line 2026-03-21 15:18:33 +01:00
Daniel Stenberg
ceae02db04
rtmp: drop support
- librtmp has no test cases, makes no proper releases and has not had a
  single commit within the last year

- librtmp parses the URL itself and requires non-compliant URLs for this

- we have no RTMP tests

- RTMP was used by 2.2% of curl users (self-identified in the 2025
  survey)

Closes #20673
2026-03-21 14:56:06 +01:00
Daniel Stenberg
ff28f67970
DEPRECATE: fix minor release number typo 2026-03-21 14:49:36 +01:00
Stefan Eissing
5649b21297
curlx_now(), prevent zero timestamp
As code checks `curltime` values for zero and interprets this
as not-initialized or "forever" in several places, make sure
`curlx_now()` never returns a zero timestamp.

Closes #21034
2026-03-21 14:47:36 +01:00
Daniel Stenberg
7e0a9b309c
CURLOPT_HAPROXY_CLIENT_IP.md: mention assuption on data format
The user is assumed to pass in correct data. I think we should start
clarifying this in more places.

Closes #21042
2026-03-21 14:46:55 +01:00
Stefan Eissing
82009c4220
share: concurrency handling, easy updates
Replace the `volatile int dirty` with a reference counter
protected by a mutex when available.

Solve the problem of when to call application's lock function
by adding a volatile flag that indicates a share has been added
to easy handles in its lifetime. That flag ever goes from
FALSE to TRUE, so volatile might work (in the absence of a mutex).

(The problem is that the lock/unlock functions need 2-3
`curl_share_setopt()` invocations to become usable and there
is no way of telling if the third will ever happen. Calling
the lock function before the 3rd setopt may crash the
application.)

When removing a share from an easy handle (or replacing it with
another share), detach the easy connection on a share with a
connection pool.

When cleaning up a share, allow this even if it is still used in
easy handles. It will be destroyed when the reference count
drops to 0.

Closes #20870
2026-03-21 14:42:49 +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
renovate[bot]
d560002551
GHA: update dependency rustls/rustls-ffi to v0.15.1
Closes #21044
2026-03-21 13:32:52 +01:00
Viktor Szakats
a8bc4cbcfe
build: assume snprintf() in mprintf, drop feature check
- it was already required for `curl_*printf()` float/double support.
- some curl tests always fail without it.
- it was already assumed to be present to build test servers.
  Source code did not check for `HAVE_SNPRINTF` detection variable.
- it was already required to build examples.

Windows builds stopped using this detection and the function via earlier
commits.

Follow-up to 64f28b8f88 #20765
Follow-up to 935b1bd454 #9570 #9569

Closes #20763
2026-03-21 13:30:37 +01:00
Viktor Szakats
89043ba906
cmake: drop support for CMake 3.17 and older
Require CMake 3.18 (2020-07-15) or newer, up from 3.7 (2016-11-11)
prior to this patch.

This requirement also applies to the distributed `curl-config.cmake`.

To allow dropping compatibility code maintained for old versions, and to
use features which were unpractical in separate code paths. Also to make
testing, documentation and development easier, CI builds faster due to
CMake performance improvements over time. (e.g. integration tests on
macOS run 8x faster (10 minutes is now under 1.5m) in CI, 2.5x faster on
Windows.)

CMake offers pre-built binaries for major platforms. They work without
an install step, just by unpacking and pointing the cmake command to
them. Making upgrades easy in many cases:
https://cmake.org/download/
https://cmake.org/files/
https://github.com/Kitware/CMake/releases

CMake 3.18 brings these feature as generally available when building or
consuming curl/libcurl:

LTO support, improved performance, `pkg-config` and interface target
support, `OBJECT` target (for faster libcurl builds), modern invocation
with `-S`/`-B` options, better support for custom linker options,
FetchContent, `GnuTLS::GnuTLS` target, `--verbose` and `--install`
options, `CMAKE_GENERATOR` env, last but not least unity mode and Ninja
generator.

For maximum build speed, use:
`-DCMAKE_UNITY_BUILD=ON -DCURL_DROP_UNUSED=ON`

As for deprecations, C++11 is required to build CMake itself, which may
be a limit on some platforms. autotools continues to cover them.

Follow-up to 9bcdfb3809 #20408
Follow-up to a7c974e038 #19902
Follow-up to dfbe035c8b #10161
Discussion: https://github.com/curl/curl/discussions/18704

Closes #20407
2026-03-21 13:24:47 +01:00
Viktor Szakats
d5014a2b95
scripts: drop redundant double-quotes: "$var" -> $var (Perl)
Closes #21009
2026-03-21 13:21:06 +01:00
Viktor Szakats
f45bf74b5a
curl/curl.h: replace recursive macros with C++-friendly method to enforce 3 args
Certain uses may still trigger a C compiler warning
`-Wdisabled-macro-expansion` after this, e.g. when the call is wrapped
in the `CURL_IGNORE_DEPRECATION()` macro as seen in docs/examples.

Suggested-by: Kai Pastor
Ref: https://github.com/curl/curl/issues/20682#issuecomment-3949788664

Follow-up to ee9b000438 #20686
Follow-up to daa6b27b4d #20597

Closes #20709
2026-03-21 13:21:06 +01:00
Viktor Szakats
c3c2bf5941
libtest: drop duplicate include
Include moved to `unitcheck.h` earlier.

Follow-up to 96d5b5c688 #20864
Ref: 8a1f361716 #21024

Closes #21046
2026-03-21 13:14:46 +01:00
Viktor Szakats
e0038e1096
tool_operhlp: propagate low-level OOM in add_file_name_to_url()
Bug: https://github.com/curl/curl/pull/21011#discussion_r2961678069

Closes #21043
2026-03-21 13:14:46 +01:00
Viktor Szakats
8ffe0db8f8
lib: move all UNITTEST prototypes to C files (cont.)
Follow-up to 98d8e82c74 #21014

Closes #21040
2026-03-21 13:14:46 +01:00
Daniel Stenberg
f36a8ac5a2
dnscache.h: include curlx/timeval.h for struct curltime
Follow-up to 96d5b5c688

Closes #21045
2026-03-21 12:27:34 +01:00
Daniel Stenberg
322db3efc0
ftp: make the MDTM date parser stricter (again)
A previous refactor made the parser more lenient and this takes it back
to making sure only ascii digits are accepted.

Added test 1684 to verify

Follow-up to 304b5183fd

Pointed out by Codex Security

Closes #21041
2026-03-21 12:25:14 +01:00
Stefan Eissing
96d5b5c688
dnscache: own source file, improvements
- Rename `Curl_resolv_unlink()` to `Curl_dns_entry_unlink()`.
- Change `Curl_dnscache_get()` to return CURLcode result. Returns
  now `CURLE_COULDNT_RESOLVE_HOST` for "negative" cache entries.
- Add `Curl_dnscache_add_negative()` to put a "negative" entry
  into the cache.

Closes #20864
2026-03-21 12:04:36 +01:00
Stefan Eissing
b0f6e9a3d7
openssl channel_binding: lookup digest algorithm without NID
Use an alternate OpenSSL API to get the digest algorithm tied
to a certificate signature to compute the channel binding.

Fixes #20590
Reported-by: Rob Crittenden
Closes #20734
2026-03-21 12:00:17 +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
Daniel Stenberg
447b32f13a
RELEASE-NOTES: synced
Bump curlver to 8.20.0 for pending release
2026-03-20 22:28:50 +01:00
Viktor Szakats
208b87744e
GHA/windows: disable taskkill in torture jobs
As an experiment.

Also:
- processhelp.pm: log when `taskkill` is force-skipped.

Ref: #21035

Follow-up to f450f3801b #19897
Follow-up to 2701ac6a4d #19421

Closes #21039
2026-03-20 19:53:11 +01:00
Stefan Eissing
708b3f8b4e
wolfssl: fix handling of abrupt connection close
A closed connection without TLS notify shutdowns, has been reported as a
correct EOF instead of an error. Fix the error handling in wolfSSL
backend receive handling.

Spotted by Codex Security

Closes #21002
2026-03-20 17:48:56 +01:00
Daniel Stenberg
1eb9096897
transfer: enable custom methods again on next transfer
`http_ignorecustom` is set on redirect handling but was not reset
between transfers, so once a redirect occurs in the new follow modes,
custom request methods were ignored for later transfers on the same
handle.

Follow-up to fb13923dd6

Detected by Codex Security

Closes #21037
2026-03-20 17:46:50 +01:00
Daniel Stenberg
f2ba8f0613
protcol.h: fix the CURLPROTO_MASK
It had an 'f' too few. Also provide CURLPROTO_WS* unconditionally
internally, so that code can depend on them in all builds.

Follow-up to cd5ca80f00

Spotted by Codex Security

Test case 3219 added to catch this next time.

Closes #21031
2026-03-20 17:24:01 +01:00
Viktor Szakats
07c10f09a5
tool_operhlp: fix add_file_name_to_url() result on OOM
Return `CURLE_OUT_OF_MEMORY` instead of `CURLE_URL_MALFORMAT` when
`curl_url()`, `curl_easy_escape()`, or `curl_maprintf()` calls failed.

Found by Codex Security

Also reuse deinit code from a success branch.

Closes #21011
2026-03-20 17:23:25 +01:00
Daniel Stenberg
b9e179e4e5
urldata: make speeder_c uint32
This counter is meant to virtually never wrap.

Follow-up to e3691612ea

Spotted by Codex Security

Closes #21036
2026-03-20 16:56:48 +01:00
Daniel Stenberg
73a5288344
unit1627.c: remove a newline 2026-03-20 16:55:19 +01:00