]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
50 min agotests/data: add `%PERL` to postcheck commands where missing master
Viktor Szakats [Sun, 30 Nov 2025 01:57:39 +0000 (02:57 +0100)] 
tests/data: add `%PERL` to postcheck commands where missing

To avoid potentially executing a different Perl than used by the rest
of the build and tests.

Also to be more portable by not relying on shebang support, though these
particular tests require POSIX shell anyway.

Closes #19767

50 min agotest613.pl: integrate mtime check for test 1445, 1446
Viktor Szakats [Sun, 30 Nov 2025 00:45:57 +0000 (01:45 +0100)] 
test613.pl: integrate mtime check for test 1445, 1446

Move check logic from postchecks to `test613.pl`.

To make these test data files XML-compliant.
Also to avoid POSIX/bash-shellisms in postcheck.

Closes #19766

50 min agotests/data: replace Perl `&&` with `and` for XML-compliance
Viktor Szakats [Sun, 30 Nov 2025 00:26:56 +0000 (01:26 +0100)] 
tests/data: replace Perl `&&` with `and` for XML-compliance

Bringing down non-XML-compliant files to 50 (from 58).

Follow-up to 7f3731ce142c1d74023abad183cc8ce0fd527fab #19595

Closes #19765

50 min agolib: fix formatting nits (part 1)
Viktor Szakats [Sat, 29 Nov 2025 21:37:26 +0000 (22:37 +0100)] 
lib: fix formatting nits (part 1)

From `lib/a*` to `lib/cs*`.

Closes #19764

50 min agolib/subdirs: fix formatting nits
Viktor Szakats [Sat, 29 Nov 2025 01:16:52 +0000 (02:16 +0100)] 
lib/subdirs: fix formatting nits

Closes #19757

74 min agotool_operatate: return error for OOM in append2query
Daniel Stenberg [Sat, 29 Nov 2025 22:44:23 +0000 (23:44 +0100)] 
tool_operatate: return error for OOM in append2query

Closes #19763

11 hours agombedtls: replace macro constant with `CURL_ARRAYSIZE()`
Viktor Szakats [Sat, 29 Nov 2025 18:51:45 +0000 (19:51 +0100)] 
mbedtls: replace macro constant with `CURL_ARRAYSIZE()`

Also move from `int` to `size_t` for index variables.

Closes #19762

13 hours agorustls: simplify init err path
Daniel McCarney [Sat, 29 Nov 2025 14:30:48 +0000 (09:30 -0500)] 
rustls: simplify init err path

Closes #19759

13 hours agorustls: verify that verifier_builder is not NULL
Daniel Stenberg [Fri, 28 Nov 2025 22:59:23 +0000 (23:59 +0100)] 
rustls: verify that verifier_builder is not NULL

Since this function returns allocated resources there is probably at
least a theoretical risk this can return NULL.

Pointed out by ZeroPath

Closes #19756

16 hours agolib/sendf.h: forward declare two structs
Viktor Szakats [Sat, 29 Nov 2025 15:07:59 +0000 (16:07 +0100)] 
lib/sendf.h: forward declare two structs

To fix non-unity builds using certain header orders (seen in ntlm.c with
the include order changed):
```
lib/vauth/../sendf.h:117:27: error: ‘struct Curl_cwriter’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
  117 |                    struct Curl_cwriter *writer);
      |                           ^~~~~~~~~~~~
lib/vauth/../sendf.h:215:54: error: ‘struct Curl_creader’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
  215 |   CURLcode (*do_init)(struct Curl_easy *data, struct Curl_creader *reader);
      |                                                      ^~~~~~~~~~~~
[...]
```
Ref: https://github.com/curl/curl/actions/runs/19785420705/job/56691185397?pr=19760

Ref: #19760
Closes #19761

20 hours agocmake: save and restore `CMAKE_MODULE_PATH` in `curl-config.cmake`
Viktor Szakats [Sat, 29 Nov 2025 13:17:04 +0000 (14:17 +0100)] 
cmake: save and restore `CMAKE_MODULE_PATH` in `curl-config.cmake`

Reported-by: Kai Pastor
Bug: https://github.com/curl/curl/pull/16973#discussion_r2572957270
Follow-up to 16f073ef49f94412000218c9f6ad04e3fd7e4d01 #16973

Closes #19758

34 hours agocmake: define dependencies as `IMPORTED` interface targets
Viktor Szakats [Thu, 27 Mar 2025 00:15:16 +0000 (01:15 +0100)] 
cmake: define dependencies as `IMPORTED` interface targets

Rework the way curl's custom Find modules advertise their properties.

Before this patch, Find modules returned detected dependency properties
(header dirs, libs, libdirs, C flags, etc.) via global variables. curl's
main `CMakeLists.txt` copied their values into global lists, which it
later applied to targets. This solution worked internally, but it was
unsuited for the public, distributed `CURLConfig.cmake` and publishing
curl's Find modules with it, due to polluting the namespace of consumer
projects. It's also impractical to apply the many individual variables
to every targets depending on libcurl.

To allow using Find modules in consumer projects, this patch makes them
define as imported interface targets, named `CURL::<dependency>`. Then
store dependency information as target properties. It avoids namespace
pollution and makes the dependency information apply automatically
to all targets using `CURL::libcurl_static`.

Find modules continue to return `*_FOUND` and `*_VERSION` variables.

For dependencies detected via `pkg-config`, CMake 3.16+ is recommended.
Older CMake versions have a varying degree of support for
propagating/handling library directories. This may cause issues in envs
where dependencies reside in non-system locations and detected via
`pkg-config` (e.g. macOS + Homebrew). Use `CURL_USE_PKGCONFIG=OFF`
to fix these issues. Or upgrade to newer CMake, or link libcurl
dynamically.

Also:
- re-enable `pkg-config` for old cmake `find_library()` integration
  tests.
- make `curlinfo` build after these changes.
- distribute local Find modules.
- export the raw list of lib dependencies via `CURL_LIBRARIES_PRIVATE`.
- `CURLconfig.cmake`: use curl's Find modules to detect dependencies in
  the consumer env.
- add custom property to target property debug function.
- the curl build process no longer modifies `CMAKE_C_FLAGS`.
  Follow-up to e86542038dda88dadf8959584e803895f979310c #17047

Ref: #14930
Ref: https://github.com/libssh2/libssh2/pull/1535
Ref: https://github.com/libssh2/libssh2/pull/1571
Ref: https://github.com/libssh2/libssh2/pull/1581
Ref: https://github.com/libssh2/libssh2/pull/1623

Closes #16973

36 hours agomemdebug: buffer output data
Daniel Stenberg [Fri, 28 Nov 2025 16:16:31 +0000 (17:16 +0100)] 
memdebug: buffer output data

Instead of writing each line to file immediately, this now stores them
in an in-memory buffer until that gets full or curl exits. To make it
run faster and write to file less often.

Closes #19750

36 hours agotests: fix formatting nits
Viktor Szakats [Fri, 28 Nov 2025 20:17:58 +0000 (21:17 +0100)] 
tests: fix formatting nits

Also:
- lib1948: fix checksrc error TYPEDEFSTRUCT.
  (detected after formatting)

Closes #19754

36 hours agocurlx/multibyte: stop setting macros for non-Windows
Viktor Szakats [Fri, 28 Nov 2025 16:39:04 +0000 (17:39 +0100)] 
curlx/multibyte: stop setting macros for non-Windows

These macros are not used for non-Windows. Drop them with the unused
mappings to standard allocators.

Closes #19751

37 hours agoruntests: allow a test to switch off memdebug
Daniel Stenberg [Fri, 28 Nov 2025 16:41:59 +0000 (17:41 +0100)] 
runtests: allow a test to switch off memdebug

Test 3207 now uses this as its multi-threading is not fully memdebug
compliant.

Closes #19752

43 hours agoconnection: give send methods/prototypes an uint8_t buffer
Stefan Eissing [Fri, 28 Nov 2025 09:44:05 +0000 (10:44 +0100)] 
connection: give send methods/prototypes an uint8_t buffer

To conclude changing the send buffer type from `const void *` to `const
uint8_t *`, change the top level send function and its implementations.

Closes #19743

43 hours agohttp1: parse header from uint8_t buffer
Stefan Eissing [Fri, 28 Nov 2025 09:25:59 +0000 (10:25 +0100)] 
http1: parse header from uint8_t buffer

To save casting the passed buffer when parsing HTTP/1 request
headers from an uint8_t buffer.

Closes #19742

43 hours agolibssh: fix state machine loop to progress as it should
Stefan Eissing [Fri, 28 Nov 2025 13:05:34 +0000 (14:05 +0100)] 
libssh: fix state machine loop to progress as it should

43 hours agossh: tracing and better pollset handling
Stefan Eissing [Fri, 28 Nov 2025 11:49:16 +0000 (12:49 +0100)] 
ssh: tracing and better pollset handling

Remove connection member `waitfor` and keep it in the SSH connection
meta. Add `ssh` to supported tracing features, convert many DEBUGF
printgs to traces.

Closes #19745

44 hours agoGHA/curl-for-win: drop WINE install, do not run curl after build
Viktor Szakats [Fri, 28 Nov 2025 14:16:08 +0000 (15:16 +0100)] 
GHA/curl-for-win: drop WINE install, do not run curl after build

To reduce to amount of Debian packages to install, which hopefully
removes some flakiness due to sometimes very slow Azure package
distro servers. Possible also making these jobs finish 20s faster.

Windows from Debian | llvm               | gcc
:------------------ | :----------------: | :----------------:
build time          |  2m41s  ->  2m20s  |  3m19s  ->  2m57s
installed packages  |  288    ->  142    |  247    ->  99
downloads           |  403 MB ->  240 MB |  297 MB -> 134 MB
disk space          | 2132 MB -> 1289 MB | 1582 MB -> 739 MB

Before: https://github.com/curl/curl/actions/runs/19765983026
After: https://github.com/curl/curl/actions/runs/19766373960?pr=19749

Ref: https://github.com/curl/curl-for-win/commit/02149b7e364a1830d8fa2c947cfc713d925c186d

Closes #19749

44 hours agoexample: fix formatting nits
Viktor Szakats [Fri, 28 Nov 2025 13:19:18 +0000 (14:19 +0100)] 
example: fix formatting nits

Also:
- drop non-portable `__STRING()` macro use where still used.

Closes #19746

44 hours agocurlx/fopen: fix typo in copyright
Yedaya Katsman [Fri, 28 Nov 2025 13:48:03 +0000 (15:48 +0200)] 
curlx/fopen: fix typo in copyright

Follow-up to 193cb00ce9b47e75d42157c650cc3de3fd96d35d #19626

Closes #19747

2 days agobuild: stop overriding standard memory allocation functions
Viktor Szakats [Wed, 8 Oct 2025 00:33:19 +0000 (02:33 +0200)] 
build: stop overriding standard memory allocation functions

Before this patch curl used the C preprocessor to override standard
memory allocation symbols: malloc, calloc, strdup, realloc, free.
The goal of these is to replace them with curl's debug wrappers in
`CURLDEBUG` builds, another was to replace them with the wrappers
calling user-defined allocators in libcurl. This solution needed a bunch
of workarounds to avoid breaking external headers: it relied on include
order to do the overriding last. For "unity" builds it needed to reset
overrides before external includes. Also in test apps, which are always
built as single source files. It also needed the `(symbol)` trick
to avoid overrides in some places. This would still not fix cases where
the standard symbols were macros. It was also fragile and difficult
to figure out which was the actual function behind an alloc or free call
in a specific piece of code. This in turn caused bugs where the wrong
allocator was accidentally called.

To avoid these problems, this patch replaces this solution with
`curlx_`-prefixed allocator macros, and mapping them _once_ to either
the libcurl wrappers, the debug wrappers or the standard ones, matching
the rest of the code in libtests.

This concludes the long journey to avoid redefining standard functions
in the curl codebase.

Note: I did not update `packages/OS400/*.c` sources. They did not
`#include` `curl_setup.h`, `curl_memory.h` or `memdebug.h`, meaning
the overrides were never applied to them. This may or may not have been
correct. For now I suppressed the direct use of standard allocators
via a local `.checksrc`. Probably they (except for `curlcl.c`) should be
updated to include `curl_setup.h` and use the `curlx_` macros.

This patch changes mappings in two places:
- `lib/curl_threads.c` in libtests: Before this patch it mapped to
  libcurl allocators. After, it maps to standard allocators, like
  the rest of libtests code.
- `units`: before this patch it mapped to standard allocators. After, it
  maps to libcurl allocators.

Also:
- drop all position-dependent `curl_memory.h` and `memdebug.h` includes,
  and delete the now unnecessary headers.
- rename `Curl_tcsdup` macro to `curlx_tcsdup` and define like the other
  allocators.
- map `curlx_strdup()` to `_strdup()` on Windows (was: `strdup()`).
  To fix warnings silenced via `_CRT_NONSTDC_NO_DEPRECATE`.
- multibyte: map `curlx_convert_*()` to `_strdup()` on Windows
  (was: `strdup()`).
- src: do not reuse the `strdup` name for the local replacement.
- lib509: call `_strdup()` on Windows (was: `strdup()`).
- test1132: delete test obsoleted by this patch.
- CHECKSRC.md: update text for `SNPRINTF`.
- checksrc: ban standard allocator symbols.

Follow-up to b12da22db1f11da51082977dc21a7edee7858911 #18866
Follow-up to db98daab05aec251bcb6615d2d38dfebec291736 #18844
Follow-up to 4deea9396bc7dd25c6362fa746a57bf309c74ada #18814
Follow-up to 9678ff5b1bfea1c847aee4f9edf023e8f01c9293 #18776
Follow-up to 10bac43b873fe45869e15b36aac1c1e5bc89b6e0 #18774
Follow-up to 20142f5d06f7120ba94cbcc25c998e8d81aec85b #18634
Follow-up to bf7375ecc50e857760b0d0a668c436e208a400bd #18503
Follow-up to 9863599d69b79d290928a89bf9160f4e4e023d4e #18502
Follow-up to 3bb5e58c105d7be450b667858d1b8e7ae3ded555 #17827

Closes #19626

2 days agohttp: add asserts for null terminator for input strings
Daniel Stenberg [Fri, 28 Nov 2025 08:43:27 +0000 (09:43 +0100)] 
http: add asserts for null terminator for input strings

http_rw_hd() assumes the null terminator is present. These asserts make
sure this remains true.

Closes #19741

2 days agoGHA/linux-old: add support for using custom CMake versions
Viktor Szakats [Fri, 28 Nov 2025 00:23:57 +0000 (01:23 +0100)] 
GHA/linux-old: add support for using custom CMake versions

Install CMake from the Kitware GitHub release archive. To allow choosing
its version independently from the OS.

Switch to 3.7.0 (from 3.7.2) to test the earliest supported version.
Also tested OK with 3.18.4 and 3.7.2.

The download and install step takes 1-2 seconds.

Follow-up to c9e50e9e393508c6a28c695abcf62980b3c1b023 #19737

Closes #19738

2 days agoGHA: update dependency pyspelling to v2.12.1
renovate[bot] [Thu, 27 Nov 2025 01:01:01 +0000 (01:01 +0000)] 
GHA: update dependency pyspelling to v2.12.1

Closes #19712

2 days agoGHA: update dependency google/boringssl to v0.20251124.0
renovate[bot] [Wed, 26 Nov 2025 01:19:06 +0000 (01:19 +0000)] 
GHA: update dependency google/boringssl to v0.20251124.0

Closes #19685

2 days agoGHA/linux-old: stop installing `groff`, it is unused
Viktor Szakats [Fri, 28 Nov 2025 01:40:19 +0000 (02:40 +0100)] 
GHA/linux-old: stop installing `groff`, it is unused

2 days agoappveyor: add support for using custom CMake versions
Viktor Szakats [Thu, 27 Nov 2025 22:23:18 +0000 (23:23 +0100)] 
appveyor: add support for using custom CMake versions

To allow more flexibility and not be limited by defaults offered by
the runner machines:
- Visual Studio 2013: CMake 3.12.2
- Visual Studio 2015, 2017: CMake 3.16.2
Ref: https://www.appveyor.com/docs/windows-images-software/

Start using 3.18.4, 3.19.8, 3.20.6 in older VS jobs to add variations.

Time cost is a couple of seconds per job.

Ref: #18704 (Discussion)
Ref: #16973

Closes #19737

2 days agounit1653: replace local macro with `Curl_safefree()`
Viktor Szakats [Thu, 27 Nov 2025 19:48:43 +0000 (20:48 +0100)] 
unit1653: replace local macro with `Curl_safefree()`

Cherry-picked from #19626
Closes #19736

2 days agomemdebug: replace `(fwrite)` with `fwrite`
Viktor Szakats [Thu, 20 Nov 2025 02:57:45 +0000 (03:57 +0100)] 
memdebug: replace `(fwrite)` with `fwrite`

Cherry-picked from #19626
Closes #19735

2 days agocurl_setup.h: drop superfluous parenthesis from `Curl_safefree` macro
Viktor Szakats [Thu, 27 Nov 2025 19:08:43 +0000 (20:08 +0100)] 
curl_setup.h: drop superfluous parenthesis from `Curl_safefree` macro

Cherry-picked from #19626
Closes #19734

2 days agoCODE_STYLE.md: sync banned function list with checksrc.pl
Viktor Szakats [Thu, 27 Nov 2025 17:32:35 +0000 (18:32 +0100)] 
CODE_STYLE.md: sync banned function list with checksrc.pl

Also alpha sort the list in checksrc.pl.

Closes #19733

2 days agombedtls_threadlock: avoid calloc, use array
Daniel Stenberg [Thu, 27 Nov 2025 16:42:55 +0000 (17:42 +0100)] 
mbedtls_threadlock: avoid calloc, use array

Closes #19732

2 days agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 27 Nov 2025 15:14:37 +0000 (16:14 +0100)] 
RELEASE-NOTES: synced

2 days agotests: allow 2500-2503 to use ~2MB malloc
Daniel Stenberg [Thu, 27 Nov 2025 14:55:47 +0000 (15:55 +0100)] 
tests: allow 2500-2503 to use ~2MB malloc

On Linux using UDP_GRO, curl might allocate a (single) 1.5MB buffer for
maximum performance.

Fixes #19716
Closes #19731

2 days agoGHA/http3-linux: add H3 valgrind tests
Viktor Szakats [Thu, 27 Nov 2025 11:17:27 +0000 (12:17 +0100)] 
GHA/http3-linux: add H3 valgrind tests

Ref: #19714
Ref: #19717

Closes #19719

2 days agocfilter: send uint8_t bytes
Stefan Eissing [Thu, 27 Nov 2025 14:13:11 +0000 (15:13 +0100)] 
cfilter: send uint8_t bytes

Change the send parameter from `const void *` to `const uint8_t *` and
adapt calling code. Several had already unsigned chars and were casting.

Closes #19729

2 days agongtcp2: remove the unused Curl_conn_is_ngtcp2 function
Daniel Stenberg [Thu, 27 Nov 2025 13:19:34 +0000 (14:19 +0100)] 
ngtcp2: remove the unused Curl_conn_is_ngtcp2 function

Closes #19725

2 days agocfilters: make conn_forget_socket a private libssh function
Daniel Stenberg [Thu, 27 Nov 2025 13:25:43 +0000 (14:25 +0100)] 
cfilters: make conn_forget_socket a private libssh function

It is only used for (old) libssh builds.

Closes #19727

2 days agoGHA/http3-linux: fix broken h3 server in non-openssl jobs, for more pytests
Viktor Szakats [Thu, 27 Nov 2025 12:44:27 +0000 (13:44 +0100)] 
GHA/http3-linux: fix broken h3 server in non-openssl jobs, for more pytests

It also revealed 3 failing earlydata tests with two backends on Linux,
seen earlier on macOS:
```
LibreSSL     before: 571 passed, 141 skipped in 45.34s
LibreSSL      after: 736 passed,  95 skipped in 68.08s

aws-lc       before: 571 passed, 141 skipped in 78.87s
aws-lc        after: 736 passed,  95 skipped in 66.71s

BoringSSL    before: 511 passed, 201 skipped in 46.47s
BoringSSL     after: 676 passed, 155 skipped in 63.96s

GnuTLS       before: 515 passed, 197 skipped in 48.31s
GnuTLS        after: 688 passed, 140 skipped in 67.79s (3 failed)

wolfSSL      before: 541 passed, 171 skipped in 52.49s
wolfSSL       after: 714 passed, 114 skipped in 83.84s (3 failed)

OpenSSL      before: 757 passed,  74 skipped in 65.43s
OpenSSL       after: 757 passed,  74 skipped in 65.06s

OpenSSL-quic before: 741 passed,  90 skipped in 62.85s
OpenSSL-quic  after: 741 passed,  90 skipped in 57.20s

quiche       before: 511 passed, 201 skipped in 45.94s
quiche        after: 664 passed, 167 skipped in 59.57s
```
Before: https://github.com/curl/curl/actions/runs/19734972379
After: https://github.com/curl/curl/actions/runs/19736703398?pr=19723

Failures address via: 0081c5b12627ddfb5d6e71198475dc9f95c0a53e #19730

Ref: #19724

Closes #19723

2 days agopytest: disable two H3 earlydata tests for all platforms (was: macOS)
Viktor Szakats [Thu, 27 Nov 2025 14:37:19 +0000 (15:37 +0100)] 
pytest: disable two H3 earlydata tests for all platforms (was: macOS)

Follow-up to 692c7f133e6f9a5053a87b1fffbf3c41697a7742 #19252
Follow-up to eefd03c572996e5de4dec4fe295ad6f103e0eefc #18703

Ref: #19719
Ref: #19723

Fixes #19724
Closes #19730

2 days agobadwords: make some words match case-insensitively
Viktor Szakats [Fri, 21 Nov 2025 12:46:53 +0000 (13:46 +0100)] 
badwords: make some words match case-insensitively

Also:
- wcurl.md: sync with upstream to pass the badwords check.

Ref: https://github.com/curl/wcurl/commit/11f840cddd840e03b4281cb7408b246c0d09da0f
Ref: https://github.com/curl/wcurl/pull/79

Closes #19713

2 days agoruntests: fix showing `nghttpx-h3` in the `Env:` log when detected
Viktor Szakats [Thu, 27 Nov 2025 12:02:49 +0000 (13:02 +0100)] 
runtests: fix showing `nghttpx-h3` in the `Env:` log when detected

Ref: #19723
Closes #19728

2 days agoGHA: add timeouts to mitigate hung brew install step
Viktor Szakats [Thu, 27 Nov 2025 13:19:48 +0000 (14:19 +0100)] 
GHA: add timeouts to mitigate hung brew install step

Ref: https://github.com/curl/curl/actions/runs/19736703410/job/56550251534?pr=19723

Closes #19726

2 days agocurlx_base64_encode: use uint8_t* for input
Stefan Eissing [Thu, 27 Nov 2025 12:18:09 +0000 (13:18 +0100)] 
curlx_base64_encode: use uint8_t* for input

Change `inputbuff` parameter from `const char *` to `const uint8_t *` to
reflect the binary nature of the input bytes. Half the code was casting
unsigned char to signed already in calling.

Closes #19722

2 days agows: use uint8_t
Stefan Eissing [Thu, 27 Nov 2025 11:50:04 +0000 (12:50 +0100)] 
ws: use uint8_t

Convert `unsigned char` use to `uint8_t`.

Closes #19721

2 days agoip_quadruple/proxy: make port uint16_t
Stefan Eissing [Wed, 26 Nov 2025 13:05:46 +0000 (14:05 +0100)] 
ip_quadruple/proxy: make port uint16_t

Make `port` member in these struct of type `uint16_t`.

add `uint8_t transport` to `struct ip_quadruple

Define TRNSPRT_NONE as 0. By assigning a valid transport only on a
successful connection, it is clear when the ip_quadruple members are
valid. Also, for transports not involving ports, the getinfos for
`CURLINFO_PRIMARY_PORT` and `CURLINFO_LOCAL_PORT` will now always return
-1.

Make all `transport` members and parameters of type `uint8_t`.

Document the return value of `CURLINFO_LOCAL_PORT` and
`CURLINFO_PRIMARY_PORT` in this regard. Add tests that writeout stats
report ports correctly.

Closes #19708

2 days agoconncontrol: reuse handling
Stefan Eissing [Mon, 3 Nov 2025 12:12:50 +0000 (13:12 +0100)] 
conncontrol: reuse handling

Add protocol handler flag `PROTOPT_CONN_REUSE` to indicate that the
protocol allows reusing connections for other tranfers. Add that
to all handlers that support it.

Create connections with `conn->bits.close = FALSE` and remove all
the `connkeep()` calls in protocol handlers setup/connect implementations.
`PROTOPT_CONN_REUSE` assures that the default behaviour applies
at the end of a transfer without need to juggle the close bit.

`conn->bits.close` now serves as an additional indication that a
connection cannot be reused. Only protocol handles that allow
reuse need to set it to override the default behaviour.

Remove all `connclose()` and `connkeep()` calls from connection
filters. Filters should not modify connection flags. They are
supposed to run in eyeballing situations where a filter is just
one of many determining the outcome.

Fix http response header handling to only honour `Connection: close`
for HTTP/1.x versions.

Closes #19333

2 days agovquic: do_sendmsg full init
Stefan Eissing [Thu, 27 Nov 2025 09:23:43 +0000 (10:23 +0100)] 
vquic: do_sendmsg full init

When passing a `msg_ctrl` to sendmsg() as part of GSO handling, zero the
complete array. This fixes any false positives by valgrind that complain
about uninitialised memory, even though the kernel only ever accesses
the first two bytes.

Reported-by: Aleksei Bavshin
Fixes #19714
Closes #19715

2 days agongtcp2+openssl: fix leak of session
Stefan Eissing [Thu, 27 Nov 2025 11:11:39 +0000 (12:11 +0100)] 
ngtcp2+openssl: fix leak of session

Fix return value indicating to OpenSSL if reference to session is kept
(it is not), so OpenSSL frees it.

Reported-by: Aleksei Bavshin
Fixes #19717
Closes #19718

3 days agotest433: verify "Note: Read config file from..."
Daniel Stenberg [Tue, 25 Nov 2025 15:14:43 +0000 (16:14 +0100)] 
test433: verify "Note: Read config file from..."

Which was added in fc09a2da4ad0595292

Closes #19699

3 days agodocs: add rustls to supported backends for CERT and KEY
Yedaya Katsman [Wed, 26 Nov 2025 13:58:40 +0000 (15:58 +0200)] 
docs: add rustls to supported backends for CERT and KEY

Followup to 1c8c93ae15c692c547e3238c4f067f76616a53e8

Closes #19709

3 days agotypes: remove curl_int64_t/curl_uint64_t
Stefan Eissing [Wed, 26 Nov 2025 11:02:02 +0000 (12:02 +0100)] 
types: remove curl_int64_t/curl_uint64_t

These types and the definitions surrounding them are no longer needed.

Closes #19706

3 days agoexamples/multi-uv: simplify passing `uv` struct
Viktor Szakats [Wed, 26 Nov 2025 11:56:44 +0000 (12:56 +0100)] 
examples/multi-uv: simplify passing `uv` struct

Reported-by: st751228051 on github
Follow-up to c722346518365c401b572f8dbe5fa6792ba923cd #19538 #19462
Closes #19707

3 days agoexamples/multi-uv: fix invalid req->data access
BANADDA [Sat, 15 Nov 2025 02:08:10 +0000 (02:08 +0000)] 
examples/multi-uv: fix invalid req->data access

The on_uv_timeout callback was trying to access req->data as
a curl_context pointer, but uv.timeout.data was never initialized,
making it always NULL. This rendered the code inside the if(context)
block unreachable.

Fixes #19462
Closes #19538

3 days agoautotools: add nettle library detection via pkg-config (for GnuTLS)
Viktor Szakats [Wed, 26 Nov 2025 01:03:29 +0000 (02:03 +0100)] 
autotools: add nettle library detection via pkg-config (for GnuTLS)

Also:
- fix to restore full state when gnutls canary function is not found.
- fix indentation.

Closes #19703

3 days agohttp: fix OOM exit in Curl_http_follow
Daniel Stenberg [Wed, 26 Nov 2025 10:01:09 +0000 (11:01 +0100)] 
http: fix OOM exit in Curl_http_follow

Spotted by "strict torture" tests.

Closes #19705

4 days agourlapi: handle OOM properly when setting URL
Daniel Stenberg [Wed, 26 Nov 2025 07:23:04 +0000 (08:23 +0100)] 
urlapi: handle OOM properly when setting URL

Closes #19704

4 days agodocs: spell it Rustls with a capital R
Daniel Stenberg [Tue, 25 Nov 2025 23:47:04 +0000 (00:47 +0100)] 
docs: spell it Rustls with a capital R

I believe this is how the project itself uses it.

Closes #19702

4 days agoGHA/http3-linux: build nettle manually for GnuTLS 3.8.11+
Viktor Szakats [Tue, 25 Nov 2025 01:34:26 +0000 (02:34 +0100)] 
GHA/http3-linux: build nettle manually for GnuTLS 3.8.11+

GnuTLS 3.8.11 started requiring a nettle version new enough to be
missing from Ubuntu LTS released a year ago. To keep up testing it,
build nettle from source. Besides the necessary one time effort this
has the downside that nettle updates now need to be done manually
a couple of times per year when renovate detects one. (if I got the
renovate formula correct to catch the tag format).

Also:
- switch the local GnuTLS build to use the release tarball instead of
  the Git repo and calling the script `bootstrap`. The script could
  potentially download source code using the cleartext `git:` protocol.
  It's also downloading lots of content, including a full OpenSSL repo.

Ref: https://github.com/gnutls/gnutls/blob/955f7a7fc223642d1ede6d55f094961cb97bfa68/NEWS#L41-L44
Follow-up to 905b718de3fb9287c7c0037b2737aa395f01ad3c #19642
Follow-up to a439fc0e372c3de7df3b8ae3ca7752bc3cbca826 #19613

Closes #19680

4 days agohostip: only store negative response for CURLE_COULDNT_RESOLVE_HOST
Daniel Stenberg [Tue, 25 Nov 2025 22:03:33 +0000 (23:03 +0100)] 
hostip: only store negative response for CURLE_COULDNT_RESOLVE_HOST

Follow-up from ce06fe77710525

This allows us to drop the 'keep_negative' variable completely.

Closes #19701

4 days agolib: change uint sets to operate on uint32_t
Stefan Eissing [Tue, 25 Nov 2025 10:33:38 +0000 (11:33 +0100)] 
lib: change uint sets to operate on uint32_t

- clarify names and change types
- make multi's `mid` a uint32_t
- update documentation

Closes #19695

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