]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
4 days agoopenssl-quic: use stdint types
Stefan Eissing [Tue, 25 Nov 2025 12:39:35 +0000 (13:39 +0100)] 
openssl-quic: use stdint types

Use int64_t and uint64_t directly without needing to cast to
curl_int64_t and curl_uint64_t.

Closes #19698

4 days agoquiche: use stdint types
Stefan Eissing [Tue, 25 Nov 2025 12:21:25 +0000 (13:21 +0100)] 
quiche: use stdint types

Use int64_t and uint64_t directly without needing to cast to
curl_int64_t and curl_uint64_t.

Closes #19697

4 days agongtcp2: use stdint types
Stefan Eissing [Tue, 25 Nov 2025 12:03:04 +0000 (13:03 +0100)] 
ngtcp2: use stdint types

Use int64_t and uint64_t directly without needing to cast to
curl_int64_t and curl_uint64_t.

Closes #19696

4 days agobufq: use uint8_t
Stefan Eissing [Tue, 25 Nov 2025 09:24:14 +0000 (10:24 +0100)] 
bufq: use uint8_t

instead of unsigned char

Closes #19690

4 days agomulti: simplify admin handle processing
Stefan Eissing [Wed, 19 Nov 2025 10:54:36 +0000 (11:54 +0100)] 
multi: simplify admin handle processing

Fold the special connection pool shutdown handling in multi the things
the admin handle cares about. Add the admin handle to the 'process'
bitset, deduce it from the 'running' count.

The admin handle is the processed like any other transfer, but has a
special case in `multi_runsingle()`. Simplifies all other multi
processing parts.

Closes #19604

4 days agolib: timer stats improvements
Stefan Eissing [Tue, 25 Nov 2025 09:00:23 +0000 (10:00 +0100)] 
lib: timer stats improvements

* move the TIMER_POSTQUEUE to the time a connection is chosen,
  so that TIMER_NAMELOOKUP always happens afterwards
* client writer: do not trigger TIMER_STARTTRANSFER on CLIENTWRITE_INFO
  as ftp and other pingpong protocols write that before starting anything
  that is the tranfer itself
* Elimnating debug trancing of "closed stream/connection - bailing"
  as confusing, as connection is not really closed on most cases.
* Setting 'data->req.upload_done` correctly, so that no "abort upload"
  is happening at the end of a perfectly fine download.
* Adding test cases with up-/download of 0-length files.
* pytest: add a "timeline" of timer value checks to Resulst in curl.py,
  so that this can be used in several test cases, replacing the local
  stuff in test_16
* add timeline checks to ftp test cases

Closes #19269

4 days agotool: log when loading .curlrc in verbose mode
Yedaya Katsman [Sun, 23 Nov 2025 19:29:46 +0000 (21:29 +0200)] 
tool: log when loading .curlrc in verbose mode

Inspired by @vszakats in
https://github.com/curl/curl/pull/19631#issuecomment-3560803674

Closes #19663

4 days agoratelimit: remove a debug mprintf
Stefan Eissing [Tue, 25 Nov 2025 10:39:04 +0000 (11:39 +0100)] 
ratelimit: remove a debug mprintf

Follow-up to 24b36fdd1585ea22e5e

Closes #19694

5 days agoINTERNALS.md: add more dependency versions and dates
Viktor Szakats [Tue, 25 Nov 2025 09:42:07 +0000 (10:42 +0100)] 
INTERNALS.md: add more dependency versions and dates

Closes #19691

5 days agocurlx: replace `sprintf` with `snprintf`
Viktor Szakats [Tue, 25 Nov 2025 02:35:40 +0000 (03:35 +0100)] 
curlx: replace `sprintf` with `snprintf`

To avoid using a deprecated function on Windows.

Also: de-dupe `SNPRINTF` definition in curlx.

Closes #19681

5 days agoslist: constify Curl_slist_append_nodup() string argument
Patrick Monnerat [Mon, 24 Nov 2025 13:57:38 +0000 (14:57 +0100)] 
slist: constify Curl_slist_append_nodup() string argument

Although finally stored as a non-const pointer, the string is intended
to be left unchanged.

This change allows using the function without the need of a cast for
const pointers.

Closes #19692

5 days agodoc: some returned in-memory data may not be altered
Patrick Monnerat [Mon, 24 Nov 2025 18:50:26 +0000 (19:50 +0100)] 
doc: some returned in-memory data may not be altered

Some public prototypes do not declare return values or out parameters as
const where they should be. Avoid changing the public interface, but
document those values as read-only.

Closes #19692

5 days agospeedlimit: also reset on send unpausing
Stefan Eissing [Tue, 25 Nov 2025 08:30:34 +0000 (09:30 +0100)] 
speedlimit: also reset on send unpausing

The low speedlimit currently counts both up- and download speed
accumulated. So, when unpausing upload, also reset the counter.

Closes #19687

5 days agotool_doswin: clear pointer when thread takes ownership
Daniel Stenberg [Tue, 25 Nov 2025 09:14:28 +0000 (10:14 +0100)] 
tool_doswin: clear pointer when thread takes ownership

Attempt to address #19675
Closes #19689

5 days agoasyn-ares: handle Curl_dnscache_mk_entry() OOM error
Daniel Stenberg [Tue, 25 Nov 2025 09:07:30 +0000 (10:07 +0100)] 
asyn-ares: handle Curl_dnscache_mk_entry() OOM error

To avoid leaking memory.

Follow-up to ce06fe7771052549ff430
Closes #19688

5 days agoprogress: remove two redundant variable checks
Daniel Stenberg [Tue, 25 Nov 2025 08:09:50 +0000 (09:09 +0100)] 
progress: remove two redundant variable checks

The entry condition in the function already exits early if either
low_speed_time or low_speed_limit is not set.

Pointed out by CodeSonar

Closes #19686

5 days agosendf: fix uninitialized variable in trace output
Daniel Stenberg [Tue, 25 Nov 2025 07:53:59 +0000 (08:53 +0100)] 
sendf: fix uninitialized variable in trace output

Initialize *nread early on.

Pointed out by CodeSonar

Closes #19684

5 days agohostip: make more functions return CURLcode
Daniel Stenberg [Mon, 24 Nov 2025 13:00:09 +0000 (14:00 +0100)] 
hostip: make more functions return CURLcode

- Curl_async_getaddrinfo() always returned NULL so it was pointless.
  Return proper curlcode instead to distinguish between errors. Same for
  Curl_doh().
- simplify the IP address handling
- make Curl_str2addr() function return CURLcode

Closes #19669

5 days agoexamples: fix minor typo
Sunny [Tue, 25 Nov 2025 07:29:32 +0000 (08:29 +0100)] 
examples: fix minor typo

Closes #19683

5 days agocurlx/fopen: replace open CRT functions their with `_s` counterparts (Windows)
Viktor Szakats [Tue, 18 Nov 2025 00:32:43 +0000 (01:32 +0100)] 
curlx/fopen: replace open CRT functions their with `_s` counterparts (Windows)

- `_wopen`        -> `_wsopen_s`
- `_open`, `open` -> `_sopen_s`
- `_wfopen`       -> `_wfopen_s`
- `fopen`         -> `fopen_s`
- `_wfreopen`     -> `_wfreopen_s`
- `freopen`       -> `freopen_s`

For better error handling and for using the CRT functions recommended
via warnings suppressed by `_CRT_SECURE_NO_WARNINGS`.

Also:
- add missing `freopen_s()` prototype when building with mingw-w64 <5.
  https://sourceforge.net/p/mingw-w64/mingw-w64/ci/a5d824654cdc57f6eac1bb581b078986f3eb6856/
- tests/server: replace `open()` in the signal handler with `_sopen_s()`
  on Windows.
- tests/server: reduce scope of a checksrc exception to a single line.
- checksrc: ban replaced functions.

Refs:
https://learn.microsoft.com/cpp/c-runtime-library/reference/open-wopen
https://learn.microsoft.com/cpp/c-runtime-library/reference/sopen-s-wsopen-s
https://learn.microsoft.com/cpp/c-runtime-library/reference/freopen-wfreopen
https://learn.microsoft.com/cpp/c-runtime-library/reference/fopen-wfopen
https://learn.microsoft.com/cpp/c-runtime-library/reference/fopen-s-wfopen-s
https://learn.microsoft.com/cpp/c-runtime-library/reference/freopen-s-wfreopen-s

Closes #19643

5 days agotests/server: use curlx file open/close functions
Viktor Szakats [Mon, 24 Nov 2025 14:55:17 +0000 (15:55 +0100)] 
tests/server: use curlx file open/close functions

Replace:
- `open()` with `curlx_open()` (1 call).
- `fopen()` with `curlx_fopen()`.
- `fclose()` with `curlx_fclose()`.

To centralize interacting with the CRT in preparation for using "safe"
alternatives on Windows. This also adds long-filename and Unicode
support for these operations on Windows.

Keep using `open()` in the signal handler to avoid any issues with
calling code not allowed in signal handlers.

Cherry-picked from #19643
Closes #19679

5 days agoINTERNALS.md: add release dates to build dependencies
Viktor Szakats [Mon, 24 Nov 2025 22:55:57 +0000 (23:55 +0100)] 
INTERNALS.md: add release dates to build dependencies

Also:
- delete `roffit`, that's not used anymore.
  Follow-up to ea0b575dab86a3c44dd1d547dc500276266aa382 #12753

Follow-up to 92d9dbe4c008646dd467d23dea963fa32e16cf85 #19611

Closes #19677

5 days agolib: rename internal header `share.h` to `curl_share.h` to avoid collision
Viktor Szakats [Fri, 21 Nov 2025 19:36:26 +0000 (20:36 +0100)] 
lib: rename internal header `share.h` to `curl_share.h` to avoid collision

Windows CRTs have a `share.h`. Before this patch when trying to
`#include <share.h>` it, the compiler picked up curl's internal
`lib/share.h` instead. Rename it to avoid this issue.

CRT `share.h` has constants necessary for using safe open CRT functions.

Also rename `lib/share.c` to keep matching the header.

Ref: https://learn.microsoft.com/cpp/c-runtime-library/sharing-constants
Ref: 625f2c1644da58b9617479775badea21f125ce6d #16949 #16991
Cherry-picked from #19643
Closes #19676

5 days agomanage: expand the 'libcurl support required' message
Daniel Stenberg [Mon, 24 Nov 2025 11:46:01 +0000 (12:46 +0100)] 
manage: expand the 'libcurl support required' message

Example of old text:

 --dns-ipv4-addr requires that libcurl is built to support c-ares.

New version:

 For --dns-ipv4-addr to work, it requires that the underlying libcurl is
 built to support c-ares.

Closes #19665

5 days agoratelimit: redesign
Stefan Eissing [Tue, 11 Nov 2025 13:26:48 +0000 (14:26 +0100)] 
ratelimit: redesign

Description of how this works in `docs/internal/RATELIMITS.ms`.

Notable implementation changes:
- KEEP_SEND_PAUSE/KEEP_SEND_HOLD and KEEP_RECV_PAUSE/KEEP_RECV_HOLD
  no longer exist. Pausing is down via blocked the new rlimits.
- KEEP_SEND_TIMED no longer exists. Pausing "100-continue" transfers
  is done in the new `Curl_http_perform_pollset()` method.
- HTTP/2 rate limiting implemented via window updates. When
  transfer initiaiting connection has a ratelimit, adjust the
  initial window size
- HTTP/3 ngtcp2 rate limitin implemnented via ack updates
- HTTP/3 quiche does not seem to support this via its API
- the default progress-meter has been improved for accuracy
  in "current speed" results.

pytest speed tests have been improved.

Closes #19384

5 days agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 24 Nov 2025 22:32:59 +0000 (23:32 +0100)] 
RELEASE-NOTES: synced

5 days agoINTERNALS.md: add brotli and zstd version info
Daniel Stenberg [Mon, 24 Nov 2025 17:45:53 +0000 (18:45 +0100)] 
INTERNALS.md: add brotli and zstd version info

And alpha-sort the dependency list

Closes #19672

5 days agocontent_encoding: drop a guard for brotli 1.0.0+ macro
Viktor Szakats [Mon, 24 Nov 2025 18:38:34 +0000 (19:38 +0100)] 
content_encoding: drop a guard for brotli 1.0.0+ macro

Also add comment with version requirement for the other guard.

Refs:
https://github.com/google/brotli/commit/19d86fb9a60aa7034d4981b69a5b656f5b90017e
https://github.com/google/brotli/commit/03739d2b113afe60638069c4e1604dc2ac27380d

Ref: #19672
Follow-up to e639d4ca4d794c222dde4680d9ff35053f501042
Closes #19673

5 days agotftpd: fix/tidy up `open()` mode flags
Viktor Szakats [Mon, 24 Nov 2025 13:51:18 +0000 (14:51 +0100)] 
tftpd: fix/tidy up `open()` mode flags

- replace 0777 with `S_I*` macros.
- fix to not pass invalid flags on Windows.

Follow-up to 537987d8c66aac6ec96cde098ab45525e156b54e #19645

Closes #19671

5 days agovquic: do not pass invalid mode flags to `open()` (Windows)
Viktor Szakats [Mon, 24 Nov 2025 13:43:49 +0000 (14:43 +0100)] 
vquic: do not pass invalid mode flags to `open()` (Windows)

Follow-up to 82013066a6149aa906b1fda3f8f1f27bd272a6c2 #19647

Closes #19670

5 days agoGHA: update dependency ngtcp2/nghttp3 to v1.13.1
renovate[bot] [Mon, 24 Nov 2025 10:43:14 +0000 (10:43 +0000)] 
GHA: update dependency ngtcp2/nghttp3 to v1.13.1

Closes #19664

5 days agocurlx/strerr: use `strerror_s()` on Windows
Viktor Szakats [Fri, 21 Nov 2025 14:55:33 +0000 (15:55 +0100)] 
curlx/strerr: use `strerror_s()` on Windows

To replace deprecated, unsafe `sys_nerr`, `sys_errlist` global
variables with the function suggested by the CRT warning silenced via
`_CRT_SECURE_NO_WARNINGS`:
```
lib/curlx/strerr.c(291): warning C4996: '__sys_nerr': This function or variable may be unsafe. Consider using strerror instead.
lib/curlx/strerr.c(292): warning C4996: '__sys_errlist': This function or variable may be unsafe. Consider using strerror instead.
```
(where `strerror` in turn suggests `strerror_s`...)

Upside: returns an error and has a Unicode variant. Downaside: happy
to return success when passing unrecognized error codes. Work it around
by looking for the string "Unknown error" returned in such cases and
falling back to other methods to retrieve a description.

Refs:
https://learn.microsoft.com/cpp/c-runtime-library/errno-doserrno-sys-errlist-and-sys-nerr
https://learn.microsoft.com/cpp/c-runtime-library/reference/strerror-s-strerror-s-wcserror-s-wcserror-s

Closes #19646

5 days agofile: do not pass invalid mode flags to `open()` on upload (Windows)
Viktor Szakats [Sat, 22 Nov 2025 00:42:15 +0000 (01:42 +0100)] 
file: do not pass invalid mode flags to `open()` on upload (Windows)

Ref: https://learn.microsoft.com/cpp/c-runtime-library/reference/open-wopen

Ref: #19645
Cherry-picked from #19643
Closes #19647

5 days agocurl_fopen: do not pass invalid mode flags to `open()` on Windows
Viktor Szakats [Sat, 22 Nov 2025 00:20:44 +0000 (01:20 +0100)] 
curl_fopen: do not pass invalid mode flags to `open()` on Windows

The safe (`_s`) variants of the Windows `open()` reject these flags,
while the classic ones silently accepted them.

Also:
- also drop the now unused `stat()` call on Windows.
- replace magic number with their equivalent Windows and Unix-specific
  `S_*` macros.

Refs:
https://learn.microsoft.com/cpp/c-runtime-library/reference/open-wopen
https://learn.microsoft.com/cpp/c-runtime-library/reference/fstat-fstat32-fstat64-fstati64-fstat32i64-fstat64i32

Cherry-picked from #19643
Closes #19645

5 days agocmake: add support for libbacktrace, fix two build issues
Viktor Szakats [Mon, 24 Nov 2025 11:49:15 +0000 (12:49 +0100)] 
cmake: add support for libbacktrace, fix two build issues

Also:
- memdebug: fix symbol collision in unity builds.
- memdebug: fix compiler warning by making a variable static.

Follow-up to c77bed81a2e1325ffdebc223c27e3d1355147529 #19657

Closes #19666

5 days agotool_writeout: bail out proper on OOM
Daniel Stenberg [Mon, 24 Nov 2025 12:08:37 +0000 (13:08 +0100)] 
tool_writeout: bail out proper on OOM

Closes #19667

5 days agomemdebug: produce stack trace dump with libbacktrace
Daniel Stenberg [Tue, 18 Nov 2025 13:29:09 +0000 (14:29 +0100)] 
memdebug: produce stack trace dump with libbacktrace

Enable with "configure --enable-backtrace", inserts a backtrace in the
memdump log when a torture test limit is reached.

Closes #19657

5 days agospeedcheck: do not trigger low speed cancel on transfers with CURL_READFUNC_PAUSE
bttrfl on github [Sun, 23 Nov 2025 03:55:16 +0000 (06:55 +0300)] 
speedcheck: do not trigger low speed cancel on transfers with CURL_READFUNC_PAUSE

When a trasfer is paused from a read callback with a CURL_READFUNC_PAUSE
code, it should be excluded from the speedcheck. Currently only
transfers paused from write callbacks are excluded, because the code
only checks for "recv direction" of the transfer. This commit adds a
check for "send direction".

Issue similar to https://github.com/curl/curl/issues/6358

Closes #19653

6 days agoGHA: update ngtcp2/nghttp3 to v1.13.0 from v1.12.0
renovate[bot] [Sun, 23 Nov 2025 18:23:32 +0000 (18:23 +0000)] 
GHA: update ngtcp2/nghttp3 to v1.13.0 from v1.12.0

Closes #19654

6 days agoGHA: update ngtcp2/ngtcp2 to v1.18.0 from v1.17.0
renovate[bot] [Sun, 23 Nov 2025 09:37:41 +0000 (09:37 +0000)] 
GHA: update ngtcp2/ngtcp2 to v1.18.0 from v1.17.0

Closes #19655

6 days agowolfssl: fix cipher list, skip 5.8.4 regression
Stefan Eissing [Sun, 23 Nov 2025 15:59:40 +0000 (16:59 +0100)] 
wolfssl: fix cipher list, skip 5.8.4 regression

- adjust cipher list in infof() statement for min/max TLS version

- skip test_17_07 for wolfSSL 5.8.4 when CHACHA20 is negotiated
  due to regression with homebrew build on ARM systems.

Fixes #19644
Reported-by: Viktor Szakats
Closes #19662

6 days agoasyn-ares: remove hostname free on OOM
Daniel Stenberg [Sun, 23 Nov 2025 13:42:59 +0000 (14:42 +0100)] 
asyn-ares: remove hostname free on OOM

The freeing of the already allocated hostname is done by
Curl_async_shutdown(). This extra free in the RR code path made a
double-free.

Presumably not detected because the CI torture tests don't run HTTPS-RR
enabled?

Follow-up to 8d0bfe74fb
Closes #19658

6 days agotool_msgs: make voutf() use stack instead of heap
Daniel Stenberg [Sat, 22 Nov 2025 21:44:39 +0000 (22:44 +0100)] 
tool_msgs: make voutf() use stack instead of heap

For printf()ing the message to show.

Closes #19651

7 days agotool_operate: fix a case of ignoring return code in operate()
Daniel Stenberg [Sat, 22 Nov 2025 18:09:42 +0000 (19:09 +0100)] 
tool_operate: fix a case of ignoring return code in operate()

If get_args() returns error, do not overwrite the variable in the next
call.

Also, avoid allocating memory for the default user-agent.

Closes #19650

7 days agotool_operate: fix case of ignoring return code in single_transfer
Daniel Stenberg [Sat, 22 Nov 2025 17:03:40 +0000 (18:03 +0100)] 
tool_operate: fix case of ignoring return code in single_transfer

When glob_url() returns error, stop.

Closes #19649

7 days agoKNOWN_RISKS: known risks when running and using curl and libcurl
Daniel Stenberg [Thu, 20 Nov 2025 22:57:04 +0000 (23:57 +0100)] 
KNOWN_RISKS: known risks when running and using curl and libcurl

Closes #19631

8 days agoRevert "GHA: update gnutls/gnutls to 3.8.11 from 3.8.10"
Daniel Stenberg [Fri, 21 Nov 2025 15:53:51 +0000 (16:53 +0100)] 
Revert "GHA: update gnutls/gnutls to 3.8.11 from 3.8.10"

This reverts commit a439fc0e372c3de7df3b8ae3ca7752bc3cbca826.

It requires a version of libnettle that is not included in these Ubuntu
versions: "Libnettle 3.10 was not found"

Closes #19642

8 days agocurlx: replace `mbstowcs`/`wcstombs` with `_s` counterparts (Windows)
Viktor Szakats [Tue, 18 Nov 2025 00:48:04 +0000 (01:48 +0100)] 
curlx: replace `mbstowcs`/`wcstombs` with `_s` counterparts (Windows)

They are used in Windows-specific `fopen()`, `freopen`, `open()` and
`curlx_get_winapi_error()` calls, and in `fix_excessive_path()` in
Unicode builds.

Refs:
https://learn.microsoft.com/cpp/c-runtime-library/reference/mbstowcs-mbstowcs-l
https://learn.microsoft.com/cpp/c-runtime-library/reference/mbstowcs-s-mbstowcs-s-l
https://learn.microsoft.com/cpp/c-runtime-library/reference/wcstombs-wcstombs-l
https://learn.microsoft.com/cpp/c-runtime-library/reference/wcstombs-s-wcstombs-s-l

Also ban these functions via checksrc.

Co-authored-by: Jay Satiro
Closes #19581

8 days agochecksrc: ban `_tcsncpy`, `wcscpy`, `wcsncpy`
Viktor Szakats [Fri, 21 Nov 2025 14:57:17 +0000 (15:57 +0100)] 
checksrc: ban `_tcsncpy`, `wcscpy`, `wcsncpy`

Follow-up to eaa7651374898cef89e5783b0219bdffcc0eb60e #19589

Closes #19641

8 days agoGHA: update gnutls/gnutls to 3.8.11 from 3.8.10
renovate[bot] [Thu, 20 Nov 2025 05:59:59 +0000 (05:59 +0000)] 
GHA: update gnutls/gnutls to 3.8.11 from 3.8.10

Closes #19613

8 days agomulti: make max_total_* members size_t
Stefan Eissing [Thu, 20 Nov 2025 09:58:54 +0000 (10:58 +0100)] 
multi: make max_total_* members size_t

Check size_t conversion on setting these members via CURLMIPT_*. Use
members without casting.

Closes #19618

8 days agosmb: fix a size check to be overflow safe
Daniel Stenberg [Fri, 21 Nov 2025 13:34:31 +0000 (14:34 +0100)] 
smb: fix a size check to be overflow safe

In smb_send_message, although it could never actually overflow it might
as well be done correctly. Also do the check earlier.

Closes #19640

8 days agoapple-sectrust: always ask when `native_ca_store` is in use
Stefan Eissing [Fri, 21 Nov 2025 12:06:00 +0000 (13:06 +0100)] 
apple-sectrust: always ask when `native_ca_store` is in use

When OpenSSL fails to verify the peer certificate, we checked for
one specific reason code and did not ask Apple SecTrust for any
other failure.

Always ask Apple SecTrust after OpenSSL fails when the `native_ca_store`
is enabled. If the user configures a CAfile or CApath, the native store
is disabled, so this does not affect use cases where users asks curl
to use a specific set of trust anchors.

Do the same for GnuTLS

Fixes #19636
Reported-by: ffath-vo on github
Closes #19638

8 days agobuild: add build-level `CURL_DISABLE_TYPECHECK` options
Viktor Szakats [Fri, 21 Nov 2025 11:43:54 +0000 (12:43 +0100)] 
build: add build-level `CURL_DISABLE_TYPECHECK` options

Usage:
- autotools: `--disable-typecheck` (or `--enable-typecheck` (default))
- cmake: `-DCURL_DISABLE_TYPECHECK=ON`.

To disable `curl_easy_setopt()`/`curl_easy_getinfo()` type checking with
supported (new) gcc and clang compilers. It is useful to improve build
performance for the `tests/libtest` target. In particular the CodeQL
analyzer may take above an hour to compile with type checking enabled,
and disabling it brings it down to seconds. On local machines it may
also cut build times in half when build testdeps, depending on platform
and compiler.

Other than these cases, we recommend leaving type checking enabled.

Ref: fdacf34aaeac79ad14fa48dcafae24a6de68823d #19632

Also:
- GHA/codeql: use it.
- test1165: check in `include/curl`.
- lib1912: delete stray todo comment.
- spelling and comment nits.

Closes #19637

8 days agolib: replace `_tcsncpy`/`wcsncpy`/`wcscpy` with `_s` counterparts (Windows)
Viktor Szakats [Mon, 17 Nov 2025 22:49:15 +0000 (23:49 +0100)] 
lib: replace `_tcsncpy`/`wcsncpy`/`wcscpy` with `_s` counterparts (Windows)

Replace:
- curl_sspi: macro `_tcsncpy()` with `_tcsncpy_s()`.
- curlx/fopen: `wcsncpy()` with `wcsncpy_s()`.
- curlx/fopen: `wcscpy()` with `wcscpy_s()`.

Use of the pre-existing functions were safe. This patch aims to use the
recommended Windows CRT functions. Handle errors returned by them. Also
to avoid the compiler warnings silenced via `_CRT_SECURE_NO_WARNINGS`:

```
lib/curl_sspi.c(152): warning C4996: 'wcsncpy': This function or variable may be unsafe. Consider using wcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
lib/curlx/fopen.c(161): warning C4996: 'wcsncpy': This function or variable may be unsafe. Consider using wcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
lib/curlx/fopen.c(162): warning C4996: 'wcscpy': This function or variable may be unsafe. Consider using wcscpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
lib/curlx/fopen.c(174): warning C4996: 'wcsncpy': This function or variable may be unsafe. Consider using wcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
lib/curlx/fopen.c(175): warning C4996: 'wcscpy': This function or variable may be unsafe. Consider using wcscpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
```

Refs:
https://learn.microsoft.com/cpp/c-runtime-library/reference/strncpy-strncpy-l-wcsncpy-wcsncpy-l-mbsncpy-mbsncpy-l
https://learn.microsoft.com/cpp/c-runtime-library/reference/strncpy-s-strncpy-s-l-wcsncpy-s-wcsncpy-s-l-mbsncpy-s-mbsncpy-s-l
https://learn.microsoft.com/cpp/c-runtime-library/security-features-in-the-crt

Cherry-picked from #19581 (in part)
Closes #19589

8 days agolib: cleanup some whitespace nits
x2018 [Wed, 19 Nov 2025 15:25:57 +0000 (23:25 +0800)] 
lib: cleanup some whitespace nits

Closes #19588

9 days agoopenssl: no verify failf message unless strict
Stefan Eissing [Thu, 20 Nov 2025 12:17:03 +0000 (13:17 +0100)] 
openssl: no verify failf message unless strict

If verifypeer and verifyhost are disabled, to not generate
a failf() message for failed verifications.

Fixes #19615
Reported-by: ncaklovic on github
Closes #19625

9 days agoGHA: disable TLS in the linux-old build
Daniel Stenberg [Fri, 21 Nov 2025 08:19:21 +0000 (09:19 +0100)] 
GHA: disable TLS in the linux-old build

There are no supported TLS libraries left in "stretch".

9 days agogtls: drop support for GnuTLS < 3.6.5
Daniel Stenberg [Wed, 19 Nov 2025 14:05:17 +0000 (15:05 +0100)] 
gtls: drop support for GnuTLS < 3.6.5

Release date 2018-12-01. Has TLS 1.3 support.

Closes #19609

9 days agognutls: implement CURLOPT_CAINFO_BLOB
Marc Aldorasi [Wed, 19 Nov 2025 16:12:31 +0000 (11:12 -0500)] 
gnutls: implement CURLOPT_CAINFO_BLOB

This adds support for in-memory CA certs using CURLOPT_CAINFO_BLOB to
the GnuTLS backend.

Closes #19612

9 days agosrc: move `memdebug.h` to be the last include
Viktor Szakats [Thu, 20 Nov 2025 16:39:53 +0000 (17:39 +0100)] 
src: move `memdebug.h` to be the last include

`memdebug.h` must be included last within each source. This breaks when
including it in a header, which ends up being included in the middle of
other headers, and `memdebug.h` also ending up in the middle of
includes.

Follow-up to c255d2fdcbf27b4bfd668ae3784bb657449d6889 #19602

Closes #19629

9 days agoGHA/checksrc: switch xmllint job to Linux (from macOS)
Viktor Szakats [Fri, 21 Nov 2025 02:52:04 +0000 (03:52 +0100)] 
GHA/checksrc: switch xmllint job to Linux (from macOS)

macOS was chosen because xmllint comes preinstalled, saving the prereq
install step. But, macOS's xmllint jobs sometimes doesn't finish in 1m
(instead of under 1 second) and gets cancelled, causing flaky failures.
Go with Linux and an install phase (of 15s) instead.

Examples:
https://github.com/curl/curl/actions/runs/19558021722/job/56004334495

Closes #19634

9 days agoGHA/codeql: add tweak to successfully build libtests for CodeQL
Viktor Szakats [Fri, 21 Nov 2025 01:44:08 +0000 (02:44 +0100)] 
GHA/codeql: add tweak to successfully build libtests for CodeQL

Turns out the cause of CodeQL hangs (or probably just extreme long
compile) is the header `curl/typecheck-gcc.h`. By accident I noticed
that the preprocessed output of libtests.c is 75 MB (megabytes). This
is much higher than the amounf of source code hinted, also compared to
e.g. units.c or other build targets. The reason for the extreme size
is each easy option call pulling in the large checker logic defined
in this header.

By compiling with `-DCURL_DISABLE_TYPECHECK`, preprocessed output drops
to 2.2 MB (34x), and the libtests target builds without issues.

Also build all tests and examples with the Linux HTTP/3 config, covering
3 more files.

With these, CodeQL C coverage is 893 out of 930 (96%) (was: 645 69%)

Follow-up to 71fc11e6bbf530b90bf6e93a02cb32bdaecc933b #18695
Follow-up to a333fd4411b95fc0c3061b2d675de9287b6123e0 #18557
Follow-up to b4922b1295333dc6679eb1d588ddc2fb6b7fd5b7 #18564

Closes https://github.com/vszakats/curl/pull/11
Closes #19632

9 days agoGHA: update dependency wolfSSL/wolfssl to v5.8.4
renovate[bot] [Fri, 21 Nov 2025 02:14:59 +0000 (02:14 +0000)] 
GHA: update dependency wolfSSL/wolfssl to v5.8.4

Closes #19633

9 days agoRELEASE-NOTES: spellfix
Daniel Stenberg [Thu, 20 Nov 2025 22:59:10 +0000 (23:59 +0100)] 
RELEASE-NOTES: spellfix

9 days agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 20 Nov 2025 21:42:32 +0000 (22:42 +0100)] 
RELEASE-NOTES: synced

9 days agoquiche: eliminate size_t casts
Stefan Eissing [Thu, 20 Nov 2025 11:12:52 +0000 (12:12 +0100)] 
quiche: eliminate size_t casts

Use new curlx_sotouz_fits() instead.

Remove an unnecessary cast in osslq code while we are here.

Closes #19623

9 days agofile: eliminate size_t cast
Stefan Eissing [Thu, 20 Nov 2025 10:12:53 +0000 (11:12 +0100)] 
file: eliminate size_t cast

Use curlx_sztouz() instead.

Closes #19620

9 days agotool_urlglob: clean up used memory on errors better
Daniel Stenberg [Thu, 20 Nov 2025 08:58:14 +0000 (09:58 +0100)] 
tool_urlglob: clean up used memory on errors better

Previously it had to realloc the pattern array to store the last entry
even when that last entry triggered an error and could be only half
filled in.

Also cleaned up for readability and better reallocs for sets.

Reported-by: letshack9707 on hackerone
Closes #19614

9 days agoGHA: update actions/checkout action to v6 from v5
renovate[bot] [Thu, 20 Nov 2025 16:40:52 +0000 (16:40 +0000)] 
GHA: update actions/checkout action to v6 from v5

Closes #19628

9 days agoINTERNALS: add release dates to the oldest supported dependencies
Daniel Stenberg [Wed, 19 Nov 2025 15:35:25 +0000 (16:35 +0100)] 
INTERNALS: add release dates to the oldest supported dependencies

Closes #19611

9 days agohttp: error on OOM when creating range header
Daniel Stenberg [Thu, 20 Nov 2025 17:06:37 +0000 (18:06 +0100)] 
http: error on OOM when creating range header

Closes #19630

9 days agohttpsrr/altsvc: eliminate size_t casts
Stefan Eissing [Thu, 20 Nov 2025 10:28:41 +0000 (11:28 +0100)] 
httpsrr/altsvc: eliminate size_t casts

Treat alpn raw data as unsigned chars, avoids size_t and char* casts.
Add method to convert a struct Curl_str to an alpnid.

Closes #19621

9 days agovquic: eliminate size_t casts
Stefan Eissing [Thu, 20 Nov 2025 11:28:01 +0000 (12:28 +0100)] 
vquic: eliminate size_t casts

Use new curlx_sotouz_fits() instead.

Closes #19624

9 days agocf-socket: elminiate size_t casts
Stefan Eissing [Thu, 20 Nov 2025 09:46:35 +0000 (10:46 +0100)] 
cf-socket: elminiate size_t casts

Use curlx_sztouz() instead.

Closes #19617

9 days agortmp: eliminate size_t casts
Stefan Eissing [Thu, 20 Nov 2025 10:06:14 +0000 (11:06 +0100)] 
rtmp: eliminate size_t casts

Use curlx_sztouz() instead.

Closes #19619

9 days agomqtt: eliminate size_t cast
Stefan Eissing [Thu, 20 Nov 2025 10:40:23 +0000 (11:40 +0100)] 
mqtt: eliminate size_t cast

Use new curlx_sotouz_fits() instead.

Closes #19622

9 days agoh2-proxy: eliminate size_t cast
Stefan Eissing [Thu, 20 Nov 2025 09:37:46 +0000 (10:37 +0100)] 
h2-proxy: eliminate size_t cast

Use curlx_sztouz() instead.

Closes #19616

10 days agocmake: honor `CURL_DISABLE_INSTALL` and `CURL_ENABLE_EXPORT_TARGET` in lib and src
Viktor Szakats [Wed, 19 Nov 2025 22:33:52 +0000 (23:33 +0100)] 
cmake: honor `CURL_DISABLE_INSTALL` and `CURL_ENABLE_EXPORT_TARGET` in lib and src

Based on existing code and commit history it appears
`CURL_DISABLE_INSTALL` means to prevent calling `install()`;
`CURL_ENABLE_EXPORT_TARGET` means to prevent calling `export()` and
`install()`s with `EXPORT` in them.

Fix them to also apply to the lib and src directories in that vain:
- lib: honor `CURL_DISABLE_INSTALL`
- src: honor `CURL_DISABLE_INSTALL`
- src: honor `CURL_ENABLE_EXPORT_TARGET`

https://cmake.org/cmake/help/v4.2/command/install.html
https://cmake.org/cmake/help/v4.2/command/export.html

- `CURL_DISABLE_INSTALL` follow-up to:
  aace27b0965c10394544d1dacc9c2cb2fe0de3d3 #12287
- `CURL_ENABLE_EXPORT_TARGET` follow-up to:
  8698825106f7a9987ab3924128eee885278f66bb #9638
  643ec296456ba98c536857fce3ecfd021d44d913 #7060

Closes #19144

10 days agocurlx: add and use `curlx_freopen()`
Viktor Szakats [Wed, 19 Nov 2025 00:10:48 +0000 (01:10 +0100)] 
curlx: add and use `curlx_freopen()`

To complement the existing `curlx_fopen()` internal API.
It's used by the curl's `--stderr` option.

`curlx_freopen()` adds two features to the bare `freopen()`:
- tracing for debug-enabled builds.
- Unicode and long-filename support for Windows builds.

In effect this adds long-filename and enables Unicode support for
the `--stderr <filename>` curl command-line option on Windows.

Also add to checksrc.

Follow-up to 2f17a9b654121dd1ecf4fc043c6d08a9da3522db #10673

Closes #19598

10 days agoruntests: add `-m=seconds` to override test curl command timeout
Viktor Szakats [Sat, 1 Nov 2025 02:07:36 +0000 (03:07 +0100)] 
runtests: add `-m=seconds` to override test curl command timeout

To override the curl default of 5 minutes (300000 ms).

Sometimes a simple test data change can result in a stuck test, this
option makes it exit with an error early. Possible future use in CI
or fast machines to prevent a single test taking 5 minutes and failing
the whole job.

Example hangers:

tests/data/test65:
```diff
-<data1000 crlf="yes">
+<data1000 crlf="headers">
```

tests/data/tests993:
```diff
-%repeat[1000 x 95 328485%0d%0a]%</data>
+%repeat[1000 x 95 328485%0d%0a]%
+</data>
```

Closes #19319

10 days agolibssh2: add paths to error messages for quote commands
Christian Schmitz [Wed, 19 Nov 2025 12:15:37 +0000 (13:15 +0100)] 
libssh2: add paths to error messages for quote commands

We really like to know what path curl parsed from our input.

Closes #19605

10 days agohttp: eliminate ssize_t
Stefan Eissing [Wed, 19 Nov 2025 14:09:57 +0000 (15:09 +0100)] 
http: eliminate ssize_t

Use size_t to avoid conversions.

Closes #19610

10 days agogopher: convert ssize_t to size_t
Stefan Eissing [Wed, 19 Nov 2025 13:20:49 +0000 (14:20 +0100)] 
gopher: convert ssize_t to size_t

Make type conversions unnecessary.

Closes #19608

10 days agoftp: use size_t instead of ssize_t
Stefan Eissing [Wed, 19 Nov 2025 13:07:03 +0000 (14:07 +0100)] 
ftp: use size_t instead of ssize_t

Make type conversions unnecessary.

Closes #19607

10 days agotidy-up: move `CURL_UNCONST()` out from macro `curl_unicodefree()`
Viktor Szakats [Wed, 19 Nov 2025 12:30:25 +0000 (13:30 +0100)] 
tidy-up: move `CURL_UNCONST()` out from macro `curl_unicodefree()`

To stop applying it where not needed (most uses) and make it visible
where it's actually used (5 uses).

Follow-up to f4e23950c7b1c389cf0dde8b91353d85b8361b64 #16142

Closes #19606

10 days agoGHA: set `--buildinfo` for `test-torture` jobs
Viktor Szakats [Wed, 19 Nov 2025 03:53:55 +0000 (04:53 +0100)] 
GHA: set `--buildinfo` for `test-torture` jobs

Only the `test-ci` build target sets `--buildinfo` automatically,
since 985f39c0ce78b546e832c250588c14023123edfb. It needs to be set
manually for other targets used in CI, such as `test-torture`,
to enable the `buildinfo.txt` dump in the runtests step.

For Test Clutch. In an attempt to re-sync `targetarch` with the rest of
macOS jobs on the feature matrix page:
https://testclutch.curl.se/static/reports/feature-matrix.html
Before this patch and possibly since the breaking update It's `aarch64e`
for torture jobs and `aarch64` for the rest

(stricly speaking `aarch64e` is the correct value for all macOS jobs, but
autotools and cmake report arm64/aarch64 without the `e`.)

Regression from 985f39c0ce78b546e832c250588c14023123edfb #18147

Closes #19601

10 days agotest777: simple ---ssl-sessions test with wrong sessions
Daniel Stenberg [Wed, 19 Nov 2025 07:32:13 +0000 (08:32 +0100)] 
test777: simple ---ssl-sessions test with wrong sessions

10 days agocurlinfo: add "ssl-sessions" as a feature to show
Daniel Stenberg [Wed, 19 Nov 2025 07:30:49 +0000 (08:30 +0100)] 
curlinfo: add "ssl-sessions" as a feature to show

To allow tests depend on it

10 days agotool_cfgable: free ssl-sessions at exit
Daniel Stenberg [Wed, 19 Nov 2025 07:32:41 +0000 (08:32 +0100)] 
tool_cfgable: free ssl-sessions at exit

Also free the memory correctly in tool_ssls_load

Closes #19602

11 days agocurl_setup.h: document more funcs flagged by `_CRT_SECURE_NO_WARNINGS`
Viktor Szakats [Wed, 19 Nov 2025 00:36:28 +0000 (01:36 +0100)] 
curl_setup.h: document more funcs flagged by `_CRT_SECURE_NO_WARNINGS`

Based on these logs (non-Unicode, Unicode Schannel):
https://github.com/curl/curl/actions/runs/19446115443/job/55640968722?pr=19175
https://github.com/curl/curl/actions/runs/19446115443/job/55640968764?pr=19175

Follow-up to 5fa2d8320c4196435c1d554b06dfdcca73824dec #19175

Closes #19597

11 days agotests/data: mark non-XML-compliant files as such, xmllint the rest in CI
Viktor Szakats [Tue, 18 Nov 2025 18:10:53 +0000 (19:10 +0100)] 
tests/data: mark non-XML-compliant files as such, xmllint the rest in CI

There are 58 non-compliant files. Mark them with the `notxml` keyword.
Also include the compliant ones in the GHA/checksrc xmllint CI job.

Also:
- delete XML prolog from the 3 test data files that had them.
- FILEFORMAT.md: document the `notxml` keyword.
- FILEFORMAT.md: fix a typo.

Follow-up to de49cc89abc917cb4f273ebea8c6fb584d097de2 #19470
Follow-up to f3095f0dbd7e842d4a72c0300ba4817a755c74f5 #19528
Follow-up to 87ba80a6df1dfd7ceaaa52352c9f23afff0ed513

Closes #19595

11 days agoDISTROS.md: add OpenBSD
Viktor Szakats [Tue, 18 Nov 2025 20:41:42 +0000 (21:41 +0100)] 
DISTROS.md: add OpenBSD

Closes #19596

11 days agolib: error for OOM when extracting URL query
Daniel Stenberg [Tue, 18 Nov 2025 16:01:30 +0000 (17:01 +0100)] 
lib: error for OOM when extracting URL query

Closes #19594

11 days agotest2405, 2407: mark tests based on lib2405 flaky
Viktor Szakats [Tue, 18 Nov 2025 11:02:36 +0000 (12:02 +0100)] 
test2405, 2407: mark tests based on lib2405 flaky

Flaky in macOS CI jobs.

2405:
https://github.com/curl/curl/actions/runs/19448567968/job/55648448197 CM gcc-13 aws-lc
https://github.com/curl/curl/actions/runs/19432797208/job/55595742192 AM clang !ssl
https://github.com/curl/curl/actions/runs/19431697816/job/55591941993 AM clang !ssl !debug brotli zstd
https://github.com/curl/curl/actions/runs/19421214342/job/55558775785 CM llvm@18 GnuTLS !ldap krb5 +examples
https://github.com/curl/curl/actions/runs/19413038235/job/55537174590 CM llvm@18 mbedTLS !ldap brotli zstd MultiSSL AppleIDN

2407:
https://github.com/curl/curl/actions/runs/19462732039/job/55691022408 AM clang !ssl
https://github.com/curl/curl/actions/runs/19440283144/job/55621665647 CM gcc-13 OpenSSL gsasl rtmp AppleIDN SecTrust +examples
https://github.com/curl/curl/actions/runs/19440283144/job/55621665682 AM gcc-13 !ssl !debug
https://github.com/curl/curl/actions/runs/19436530386/job/55608724437 CM gcc-13 aws-lc
https://github.com/curl/curl/actions/runs/19436530386/job/55608724641 CM llvm@18 GnuTLS !ldap krb5 +examples
https://github.com/curl/curl/actions/runs/19435651588/job/55605648449 CM llvm@18 OpenSSL gsasl rtmp AppleIDN SecTrust +examples

Ref: https://testclutch.curl.se/static/reports/results-count.html

Bug: https://github.com/curl/curl/pull/19487#issuecomment-3546858203
Bug: https://github.com/curl/curl/pull/19487#issuecomment-3546921877

Follow-up to 2c7e1792a06b81b2bf41c9d348d374a83621340b #19487
Follow-up to 96a5ce5a82eb0f08650649ffafb7bb4e51fc4444 #19481
Follow-up to c78044c07e97cb720049579f4fe3cab33a7ea8d3 #15146 #15155

Closes #19587

11 days agotests/data: more XML-compliance via `%LT` and `%GT` macros in email addresses
Viktor Szakats [Tue, 11 Nov 2025 19:21:44 +0000 (20:21 +0100)] 
tests/data: more XML-compliance via `%LT` and `%GT` macros in email addresses

Reduce number of files failing `xmllint --format` from 133 to 57 (-76)
(3% of 1894), by replacing `<` and `>` with new macro `%LT` and `%GT`,
in most places, which is in email addresses (192 lines).

Follow-up to a9ec2a676c4257cf522a4349fb24fa547ed48aad #19491

Closes #19470

11 days agohsts: propagate and error out correctly on OOM
Daniel Stenberg [Tue, 18 Nov 2025 15:13:28 +0000 (16:13 +0100)] 
hsts: propagate and error out correctly on OOM

Closes #19593

11 days agocookie: return error on OOM
Daniel Stenberg [Tue, 18 Nov 2025 14:00:50 +0000 (15:00 +0100)] 
cookie: return error on OOM

Follow-up to 3f0629ca443825916cbc0795bcd5f241fbf710
Closes #19591

11 days agourl: if OOM in parse_proxy() return error
Daniel Stenberg [Tue, 18 Nov 2025 13:29:36 +0000 (14:29 +0100)] 
url: if OOM in parse_proxy() return error

Closes #19590

11 days agoopenssl: exit properly on OOM when getting certchain
Daniel Stenberg [Tue, 11 Nov 2025 21:40:31 +0000 (22:40 +0100)] 
openssl: exit properly on OOM when getting certchain

Previously, a momentary OOM error in the middle could produce a broken
result instead of correctly returning error.

Closes #19471