]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
12 days agoidn: avoid allocations and wcslen on Windows
Viktor Szakats [Mon, 1 Dec 2025 21:18:41 +0000 (22:18 +0100)] 
idn: avoid allocations and wcslen on Windows

Eliminate a heap buffer in both `win32_idn_to_ascii()` and
`win32_ascii_to_idn()`, by replacing it with stack buffer. The maximum
size is fixed in these cases, and small enough to fit there.

Also reuse length returned by the UTF-8 to wchar conversion, allowing
to drop `wcslen()` call in both functions, and allowing to call
the wchar to UTF-8 conversion API `WideCharToMultiByte()` with the known
length, saving length calculations within that API too.

Ref: https://github.com/curl/curl/pull/19748#issuecomment-3592015200

Closes #19798

12 days agolib: fix formatting nits (part 3)
Viktor Szakats [Tue, 2 Dec 2025 06:25:18 +0000 (07:25 +0100)] 
lib: fix formatting nits (part 3)

From `lib/h` to `lib/w`.

part 1: 47a1ab2ebecb21485c0e955316d90511e80a3c43 #19764
part 2: 86b346443b68cde7ef33e1ab770e6c8ab641d2b1 #19800

Closes #19811

12 days agotest3207: enable memdebug for this test again
Daniel Stenberg [Tue, 2 Dec 2025 16:46:52 +0000 (17:46 +0100)] 
test3207: enable memdebug for this test again

Closes #19813

12 days agoGHA/windows: install MSYS2 c-ares only when used
Viktor Szakats [Wed, 3 Dec 2025 02:06:39 +0000 (03:06 +0100)] 
GHA/windows: install MSYS2 c-ares only when used

Closes #19820

13 days agopytest: fix and improve reliability
Stefan Eissing [Mon, 1 Dec 2025 11:48:55 +0000 (12:48 +0100)] 
pytest: fix and improve reliability

Address issues listed in #19770:
- allow for ngttpx to successfully shut down on last attempt that might
  extend beyond the finish timestamp
- timeline checks: allos `time_starttransfer` to appear anywhere in
  the timeline as a slow client might seen response data before setting
  the other counters
- dump logs on test_05_02 as it was not reproduced locally

Fixes #19970
Closes #19783

13 days agopytest: improve stragglers
Stefan Eissing [Tue, 2 Dec 2025 13:26:31 +0000 (14:26 +0100)] 
pytest: improve stragglers

A fix for the tests that took the longest:
- test_05: make the server close the HTTP/1.1 connection when
  simulating an error during a download. This eliminates waiting
  for a keepalive timeout
- test_02: pause tests with slightly smaller documents, eliminate
  special setup for HTTP/2. We test stream window handling now
  elsewhere already
- cli_hx_download: run look in 500ms steps instead of 1sec, resuming
  paused tranfers earlier.

Closes #19809

13 days agolib: fix formatting nits (part 2)
Viktor Szakats [Thu, 27 Nov 2025 03:27:26 +0000 (04:27 +0100)] 
lib: fix formatting nits (part 2)

From `lib/curl*` to `lib/g*`. With fixes to part 1.

part 1: 47a1ab2ebecb21485c0e955316d90511e80a3c43 #19764

Closes #19800

13 days agoldap: provide version for "legacy" ldap as well
Daniel Stenberg [Tue, 2 Dec 2025 13:13:55 +0000 (14:13 +0100)] 
ldap: provide version for "legacy" ldap as well

It displays in version output as WinLDAP and LDAP/1, compared to
OpenLDAP/[version] for the OpenLDAP backend code.

Closes #19808

13 days agoquiche: use client writer
Stefan Eissing [Tue, 2 Dec 2025 12:42:29 +0000 (13:42 +0100)] 
quiche: use client writer

Instead of buffering response body data until it is received by the
transfer loop, write the response data directly to the client.

Use a connection wide scratch buffer to get the response body from
quiche. Eliminates need for maintaining individual buffers for each
stream.

Fixes #19803
Reported-by: Stanislav Fort
Closes #19806

13 days agoDEPRECATE.md: remove OpenSSL-QUIC in January 2026 instead
Daniel Stenberg [Tue, 2 Dec 2025 10:13:49 +0000 (11:13 +0100)] 
DEPRECATE.md: remove OpenSSL-QUIC in January 2026 instead

Move it up two months. It was only ever experimental so this cannot
interfere with any production code so shorten the "quarantine".

Closes #19805

13 days agocurl_gssapi: make sure Curl_gss_log_error() has an initialized buffer
Daniel Stenberg [Tue, 2 Dec 2025 08:53:00 +0000 (09:53 +0100)] 
curl_gssapi: make sure Curl_gss_log_error() has an initialized buffer

Reported-by: Stanislav Fort (Aisle Research)
Closes #19802

13 days agoRELEASE-NOTES: fix typo
Daniel Stenberg [Tue, 2 Dec 2025 09:13:32 +0000 (10:13 +0100)] 
RELEASE-NOTES: fix typo

13 days agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 2 Dec 2025 08:16:20 +0000 (09:16 +0100)] 
RELEASE-NOTES: synced

13 days agomemdebug: log socket close before closing
Stefan Eissing [Mon, 1 Dec 2025 17:08:25 +0000 (18:08 +0100)] 
memdebug: log socket close before closing

To not get a mixup in the memdebug log order.

Closes #19793

13 days agolibssh2: consider strdup() failures OOM and return correctly
Daniel Stenberg [Mon, 1 Dec 2025 15:32:39 +0000 (16:32 +0100)] 
libssh2: consider strdup() failures OOM and return correctly

In the ssh_state_pkey_init function.

Closes #19791

13 days agoruntests: fix Perl warning
Viktor Szakats [Mon, 1 Dec 2025 20:07:56 +0000 (21:07 +0100)] 
runtests: fix Perl warning

```
Use of uninitialized value $cmdhash{"option"} in pattern match (m//) at tests/runtests.pl line 1753.
```
Ref: https://github.com/curl/curl/actions/runs/19833947198/job/56831923295?pr=19794#step:13:3694

Follow-up to 02aa75a8c240af1a8912145497806e8925859a87 #19752
Closes #19797

13 days agomultibyte: limit `curlx_convert_*wchar*()` functions to Unicode builds
Viktor Szakats [Mon, 1 Dec 2025 19:08:09 +0000 (20:08 +0100)] 
multibyte: limit `curlx_convert_*wchar*()` functions to Unicode builds

Follow-up to ccb68d2e3b602b24a8cb52f473b96938ac998db6 #19790

Closes #19796

13 days agomemdebug: replace macro constant with `sizeof()`
Viktor Szakats [Sat, 29 Nov 2025 22:12:47 +0000 (23:12 +0100)] 
memdebug: replace macro constant with `sizeof()`

Closes #19795

13 days agowindows: use `_strdup()` instead of `strdup()` where missing
Viktor Szakats [Mon, 1 Dec 2025 18:49:50 +0000 (19:49 +0100)] 
windows: use `_strdup()` instead of `strdup()` where missing

To replace deprecated `strdup()` CRT calls with the recommended
`_strdup()`.

Refs:
https://learn.microsoft.com/cpp/c-runtime-library/reference/strdup-wcsdup
https://learn.microsoft.com/cpp/c-runtime-library/reference/strdup-wcsdup-mbsdup

Closes #19794

13 days agocurlx: use curlx allocators in non-memdebug builds (Windows)
Viktor Szakats [Mon, 1 Dec 2025 14:25:26 +0000 (15:25 +0100)] 
curlx: use curlx allocators in non-memdebug builds (Windows)

To limit raw allocators to `CURLDEBUG` (memdebug/TrackMemory) Windows
UNICODE builds.

Closes #19788

13 days agoidn: use curlx allocators on Windows
Viktor Szakats [Mon, 1 Dec 2025 14:49:01 +0000 (15:49 +0100)] 
idn: use curlx allocators on Windows

Replace `curlx_convert*()` functions with local copies that always use
the curlx allocator.

Closes #19790

2 weeks agolib: delete unused `curlx/multibyte.h` includes
Viktor Szakats [Mon, 1 Dec 2025 15:36:25 +0000 (16:36 +0100)] 
lib: delete unused `curlx/multibyte.h` includes

Closes #19792

2 weeks agoidn: fix memory leak in `win32_ascii_to_idn()`
Viktor Szakats [Mon, 1 Dec 2025 14:52:10 +0000 (15:52 +0100)] 
idn: fix memory leak in `win32_ascii_to_idn()`

Closes #19789

2 weeks agocmake: verify minimum CMake version in `curl-config.cmake`
Viktor Szakats [Sun, 30 Nov 2025 22:22:59 +0000 (23:22 +0100)] 
cmake: verify minimum CMake version in `curl-config.cmake`

Show a message if the CMake version is lower than that when consuming
libcurl via the CMake config.

The minimum CMake version on consumption is for now the same as
the minimum required (v3.7) to build curl itself.

Ref: https://cmake.org/cmake/help/v3.7/variable/CMAKE_MINIMUM_REQUIRED_VERSION.html
Ref: #18704 (discussion)
Follow-up to 16f073ef49f94412000218c9f6ad04e3fd7e4d01 #16973
Closes #19776

2 weeks agotool_urlglob: acknowledge OOM in peek_ipv6
Daniel Stenberg [Mon, 1 Dec 2025 12:14:17 +0000 (13:14 +0100)] 
tool_urlglob: acknowledge OOM in peek_ipv6

Previously, an OOM error would just imply not an IPv6 address.

Closes #19784

2 weeks agoruntests: enable torture testing with threaded resolver
Daniel Stenberg [Mon, 1 Dec 2025 12:48:12 +0000 (13:48 +0100)] 
runtests: enable torture testing with threaded resolver

Since a7bebd850291 made it possible.
Closes #19786

2 weeks agomemdebug: log before free
Stefan Eissing [Mon, 1 Dec 2025 13:05:39 +0000 (14:05 +0100)] 
memdebug: log before free

add the debug log before freeing the memory, otherwise another thread
might allocate and log it before the free is logged.

Follow-up to a7bebd8502914f1652f423
Closes #19787

2 weeks agomemdebug: add mutex for thread safety
Stefan Eissing [Mon, 1 Dec 2025 12:22:25 +0000 (13:22 +0100)] 
memdebug: add mutex for thread safety

Protect modification to the `membuf` by different threads
via a mutex. This ensure that index updates are correct and
that data gets written in order.

Closes #19785

2 weeks agohttp: acknowledge OOM errors from Curl_input_ntlm
Daniel Stenberg [Mon, 1 Dec 2025 10:00:47 +0000 (11:00 +0100)] 
http: acknowledge OOM errors from Curl_input_ntlm

Closes #19781

2 weeks agoauth: always treat Curl_auth_ntlm_get() returning NULL as OOM
Daniel Stenberg [Mon, 1 Dec 2025 10:04:36 +0000 (11:04 +0100)] 
auth: always treat Curl_auth_ntlm_get() returning NULL as OOM

Closes #19782

2 weeks agokrb5: fix detecting channel binding feature
Viktor Szakats [Sat, 29 Nov 2025 14:23:58 +0000 (15:23 +0100)] 
krb5: fix detecting channel binding feature

Use the already detected `gssapi/gssapi_krb5.h` MIT Kerberos header
to pull in `gssapi_ext.h`, which in turn sets `GSS_C_CHANNEL_BOUND_FLAG`
if supported. Channel binding is present in MIT Kerberos 1.19+.

Also:
- lib: de-duplicate GSS-API header includes.
- vauth: de-duplicate `urldata.h` includes.
- drop interim feature macro in favor of the native GSS one.

Assisted-by: Max Faxälv
Reported-by: Max Faxälv
Bug: https://github.com/curl/curl/pull/19164#issuecomment-3551687025
Follow-up to 8616e5aada9c78fb611c60d913c999c8e78c14ba #19164
Closes #19603
Closes #19760

2 weeks agocmake: namespace all local variables in `curl-config.cmake`
Viktor Szakats [Mon, 1 Dec 2025 00:53:25 +0000 (01:53 +0100)] 
cmake: namespace all local variables in `curl-config.cmake`

Also:
- apply it to the local copy of this code in `lib/CMakeLists.txt`.
- replace 'CURL' with `@PROJECT_NAME@` in a message.

Closes #19777

2 weeks agohttp: handle oom error from Curl_input_digest()
Daniel Stenberg [Mon, 1 Dec 2025 09:24:32 +0000 (10:24 +0100)] 
http: handle oom error from Curl_input_digest()

Closes #19780

2 weeks agourl: fix return code for OOM in parse_proxy()
Daniel Stenberg [Mon, 1 Dec 2025 08:26:28 +0000 (09:26 +0100)] 
url: fix return code for OOM in parse_proxy()

Closes #19779

2 weeks agoimap: make sure Curl_pgrsSetDownloadSize() does not overflow
Daniel Stenberg [Sun, 30 Nov 2025 22:35:25 +0000 (23:35 +0100)] 
imap: make sure Curl_pgrsSetDownloadSize() does not overflow

Follow-up to c1e3a760b. The previous update missed an addition that also
can wrap and cause confusion. Fixing this by calling
Curl_pgrsSetDownloadSize() after the overflow check.

Reported-by: Deniz Parlak
Closes #19774

2 weeks agocmake: narrow scope of custom `CMAKE_MODULE_PATH` in `curl-config.cmake`
Viktor Szakats [Mon, 1 Dec 2025 00:17:41 +0000 (01:17 +0100)] 
cmake: narrow scope of custom `CMAKE_MODULE_PATH` in `curl-config.cmake`

Set it only while using local Find modules, leave it as-is while using
system ones.

Follow-up to 16f073ef49f94412000218c9f6ad04e3fd7e4d01 #16973
Cherry-picked from #19776

2 weeks agocmake: fix `ws2_32` reference in `curl-config.cmake`
Viktor Szakats [Sun, 30 Nov 2025 23:34:33 +0000 (00:34 +0100)] 
cmake: fix `ws2_32` reference in `curl-config.cmake`

Follow-up to 16f073ef49f94412000218c9f6ad04e3fd7e4d01 #16973
Follow-up to 554dfa556886c3d7425f6690f3fc408128bf4744 #17927

Closes #19775

2 weeks agocmakelint: also lint CMake `.in` files, fix a long line
Viktor Szakats [Sun, 30 Nov 2025 22:27:06 +0000 (23:27 +0100)] 
cmakelint: also lint CMake `.in` files, fix a long line

```
CMakeConfigurableFile.in
cmake_uninstall.cmake.in
curl-config.cmake.in
```

Follow-up to 16f073ef49f94412000218c9f6ad04e3fd7e4d01 #16973
Closes #19773

2 weeks agovtls: drop interim ECH feature macros (OpenSSL, wolfSSL)
Viktor Szakats [Sun, 30 Nov 2025 16:31:24 +0000 (17:31 +0100)] 
vtls: drop interim ECH feature macros (OpenSSL, wolfSSL)

Use the macros set by autotools and cmake, to simplify.

Closes #19772

2 weeks agoautotools: delete idle `AM_CFLAGS`, `AM_LDFLAGS` variables
Viktor Szakats [Sun, 30 Nov 2025 16:16:03 +0000 (17:16 +0100)] 
autotools: delete idle `AM_CFLAGS`, `AM_LDFLAGS` variables

Closes #19771

2 weeks agocf-socket: drop feature check for `IPV6_V6ONLY` on Windows
Viktor Szakats [Sun, 30 Nov 2025 11:52:46 +0000 (12:52 +0100)] 
cf-socket: drop feature check for `IPV6_V6ONLY` on Windows

The macro is present in all supported Windows toolchains.

It's present in mingw-w64 v3+, and in MS SDK 6.0A+ (maybe earlier).

Also:
- restrict this logic to `USE_WINSOCK` (was: `_WIN32`), to exclude
  alternate socket libraries (i.e. lwIP). lwIP supports `IPV6_V6ONLY`
  since its 2.0.0 (2016-11-10) release and it's disabled by default,
  unlike in Winsock.
  Ref: https://github.com/lwip-tcpip/lwip/commit/e65202f8257e55b09e6309b1aa405b5e6a017f0d
- delete interim setter function/dummy macro `set_ipv6_v6only()`.

Follow-up to a28f5f68b965119d9dd1ab6c2a2ccc66c6ed5d1f #18010
Follow-up to ca3f6decb927a4c3eb4c10fba09848b626a526d6 #10975

Closes #19769

2 weeks agortmp: stop redefining `setsockopt` system symbol on Windows
Viktor Szakats [Sun, 30 Nov 2025 11:34:02 +0000 (12:34 +0100)] 
rtmp: stop redefining `setsockopt` system symbol on Windows

Before this patch it added Windows-specific casts. In unity builds this
also affected other source files.

`setsockopt()` is called without special casts in other places in
the code, and passing a non-const char ptr to a const char ptr arg also
should work.

Basic compile test with mingw-w64 confirms. In case of issues, a cast to
`curl_socklen_t` can be used, or do the special case in an `#if` branch.

Also: merge Windows-specific guards for `SET_RCVTIMEO()`.

Follow-up to 639d052e4499c663a578d940713e40cd466268fa #3155
Follow-up to 04cb15ae9dc0e863487ee55de2226cf5033311c0

Closes #19768

2 weeks agotests/data: add `%PERL` to postcheck commands where missing
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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 27 Nov 2025 15:14:37 +0000 (16:14 +0100)] 
RELEASE-NOTES: synced

2 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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

2 weeks 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