]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
5 weeks agombedTLS: cleanup insecure/deprecated code
Wyatt O'Day [Mon, 15 Dec 2025 17:17:13 +0000 (12:17 -0500)] 
mbedTLS: cleanup insecure/deprecated code

1. With `MBEDTLS_SSL_PROTO_TLS1_2` not enabled, the mbedTLS code was not
able to connect to any server due to broken logic in curl's
`mbed_set_ssl_version_min_max()`. Now it correctly sets the minimum
supported TLS version based on what is compiled in the library.

2. If debugging is enabled, move the debugging enabling earlier in the
`mbed_connect_step1()` so that verbose errors are actually displayed if
failures happen (see the previous point -- it would've made debugging
that issue easier).

3. Remove the constant `mbedtls_x509_crt_profile_fr` and instead use
mbedTLS-included profile `mbedtls_x509_crt_profile_next` with
`mbedtls_ssl_conf_cert_profile()`. This will follow the latest standards
as new mbedTLS versions are released (rather than being stuck-in-time
until someone comes along to fix what was hard-coded here). This has the
immediate benefit of no longer supporting SHA1 certs and insecure RSA
key-lengths (1024). This fix immediately prevents previously possible
MITM attacks (SHA1 hashes and RSA-1024 keys can be forged relatively
easily by nation-state actors and criminal organizations with
deep-pockets).

4. Added [predictive
resistance](https://mbed-tls.readthedocs.io/en/latest/kb/how-to/add-a-random-generator/#enabling-prediction-resistance)
to the random number generator (adding more entropy to the RNG).

5. Split the random number generator into initialization, the actual
random generation, and the "freeing" of the resources. This
significantly reduces the overhead of using the RNG.

6. Removed the separate RNG function in the TLS connect stage (instead
use the "main" one) and remove the ad-hoc threading support. Instead
properly document how to enable threading in mbedTLS. As it was, other
internals of mbedTLS could have race conditions (in the RSA module in
particular) if `MBEDTLS_THREADING_C` was *not* enabled. And if it is
enabled, then these race-conditions cannot happen. And also, if
MBEDTLS_THREADING_C is enabled then the RNG functions [are fully
thread-safe](https://mbed-tls.readthedocs.io/en/latest/kb/development/thread-safety-and-multi-threading/).

   So, the previous ad-hoc threading support was both partial and broken.

7. Enable support for disabling `MBEDTLS_PEM_PARSE_C`.

8. Add support for `CURLOPT_SSLCERTTYPE` so user can specify `PEM` or
`DER` and get faster execution.

Closes #19983

5 weeks agomulti-notify: add check macro
Stefan Eissing [Fri, 19 Dec 2025 11:52:30 +0000 (12:52 +0100)] 
multi-notify: add check macro

Since Curl_mntfy_dispatch_all() is called with high frequency and
mostly unnecessary, add a check macro to avoid the call when not
needed.

Closes #20034

5 weeks agohttp: minor cleanup after the unfold rework
Daniel Stenberg [Fri, 19 Dec 2025 13:21:19 +0000 (14:21 +0100)] 
http: minor cleanup after the unfold rework

Closes #20037

5 weeks agocurlx: add `curlx_rename()`, fix to support long filenames on Windows
Viktor Szakats [Sat, 20 Dec 2025 00:44:46 +0000 (01:44 +0100)] 
curlx: add `curlx_rename()`, fix to support long filenames on Windows

Move existing `Curl_rename()` `rename()` wrapper from lib to
curlx/fopen, and make it a curlx macro/function. To allow using
the local worker function to fixup long filenames on Windows.

Then fix the Windows-specific rename implementation to support long
filenames. This operation may happen when using a cookie jar, HSTS cache
or alt-svc cache, via libcurl or the curl tool.

Before this patch, when passing a long filename to the above options,
a `<random>.tmp` file was left on the disk without renaming it to the
filename passed to curl. There was also 1 second delay for each
attempted rename operation.

Also:
- checksrc: ban raw `rename()` and `MoveFileEx*()` functions.
- Note: `Curl_rename()` returned 1 on failure before this patch, while
  `curlx_rename()` returns -1 after, to match POSIX `rename()`.

Refs:
https://learn.microsoft.com/windows/win32/api/winbase/nf-winbase-movefileexa
https://learn.microsoft.com/windows/win32/fileio/maximum-file-path-limitation

Ref: #20040

Closes #20042

5 weeks agoGHA/http3-linux: set minimum number of runtest tests
Viktor Szakats [Sat, 20 Dec 2025 14:00:49 +0000 (15:00 +0100)] 
GHA/http3-linux: set minimum number of runtest tests

Tailored for each job with a relatively tight limits. Also with no
tolerance in valgrind tests: 4 of the 4 has to be run.

Based on Test Clutch feature matrix which displays the minimum and
actual number of tests:
https://testclutch.curl.se/static/reports/feature-matrix.html

Also:
- runtests.pl: include total number of tests in the error message shown
  when the limit was not met.

Assisted-by: Dan Fandrich
Follow-up to 3f1cd809eeae05f39fec72fe780f3a69d21972fb #19942

Closes #20050

5 weeks agowindows: fix `CreateFile()` calls to support long filenames
Viktor Szakats [Fri, 19 Dec 2025 22:26:10 +0000 (23:26 +0100)] 
windows: fix `CreateFile()` calls to support long filenames

It makes them work in Schannel's CA bundle loader, and curl tool's
set/get file timestamp operations (e.g. in `-R`/`--remote-time`). Also
to match file open operations, that already support long filenames.

E.g. when using `--remote-time`, fixing:
```
Warning: Failed to set filetime 1741363917 on outfile: CreateFile failed:
Warning: GetLastError 0x00000003
```

The special long filename logic is necessary to support Windows releases
prior to Windows 10 v1607. With the latter, it's possible to opt-in to
this behavior via a manifest setting. Note that Windows itself also needs
to opt-in to support this. Finally note that curl itself needs passing
`--globoff` to let long filenames through, pending #20044 and #20046.

Refs:
https://learn.microsoft.com/windows/win32/api/fileapi/nf-fileapi-createfilea
https://learn.microsoft.com/windows/win32/fileio/maximum-file-path-limitation

Ref: #8361
Inspired by: #19286
Inspired-by: Mathesh V
Closes #19286
Closes #20040

5 weeks agoopenssl: drop includes unused or duplicate
Viktor Szakats [Sat, 20 Dec 2025 11:38:19 +0000 (12:38 +0100)] 
openssl: drop includes unused or duplicate

Also:
- vquic-tls.h: do not include unused headers for non-H3 builds.
- autotools: stop looking for `openssl/x509.h` header.
- cmp-config.pl: delete exception for `openssl/x509.h`.
- examples: format/comment sync between the two touched files.
- openssl: drop unused `curlx/wait.h` include.

Closes #20049

5 weeks agolib: drop unused `rand.h` includes
Viktor Szakats [Sat, 20 Dec 2025 11:18:34 +0000 (12:18 +0100)] 
lib: drop unused `rand.h` includes

Closes #20047

5 weeks agocurl_ntlm_core: drop unused OpenSSL/wolfSSL headers
Viktor Szakats [Sat, 20 Dec 2025 11:23:21 +0000 (12:23 +0100)] 
curl_ntlm_core: drop unused OpenSSL/wolfSSL headers

`openssl/rand.h` and `openssl/ssl.h`.

Closes #20048

5 weeks agocurlx: use curl alloc in `curlx_win32_stat()` (Windows)
Viktor Szakats [Sat, 20 Dec 2025 00:54:35 +0000 (01:54 +0100)] 
curlx: use curl alloc in `curlx_win32_stat()` (Windows)

It's safe because we do not call `curlx_win32_stat()` from memdebug.c.

Closes #20043

5 weeks agotool_urlglob: constify an argument
Viktor Szakats [Sat, 20 Dec 2025 03:41:02 +0000 (04:41 +0100)] 
tool_urlglob: constify an argument

Also: add argument names to prototypes.

Closes #20045

5 weeks agocmake: match filename suffixes with file content
Viktor Szakats [Fri, 19 Dec 2025 13:57:10 +0000 (14:57 +0100)] 
cmake: match filename suffixes with file content

To:
- simplify recognizing CMake sources.
- ensure syntax highlighters use the correct file type.
- sync .h template filename with its autotools counterpart.

Also:
- cmakelint.sh: simplify, alpha sort the filelist.
- perlcheck.sh: simplify.

Closes #20039

6 weeks agocmake: delete unused file `CMake/CMakeConfigurableFile.in`
Viktor Szakats [Fri, 19 Dec 2025 14:10:15 +0000 (15:10 +0100)] 
cmake: delete unused file `CMake/CMakeConfigurableFile.in`

Follow-up to 8cb010144964019b865fa224e166eb37f4e1d169

Closes #20038

6 weeks agoscorecard: more upload options
Stefan Eissing [Fri, 19 Dec 2025 12:06:34 +0000 (13:06 +0100)] 
scorecard: more upload options

`--upload-no-cl` for uploads without "Content-Length:"
`--upload-parallel=1` for testing only serial uploads

Closes #20035

6 weeks agongtcp2: retune window sizes
Stefan Eissing [Fri, 19 Dec 2025 10:53:51 +0000 (11:53 +0100)] 
ngtcp2: retune window sizes

With 24b36fd stream flow control window sizes have been set too
restrictive, crippling transfer rates when no rate limit is in effect.

Disable ngtcp3 stream window auto-tuning and extend the stream window
from the small initial size to the effective rate limit. If no rate
limit is configured, extend stream window to maximum value right away.

This cannot shrink the stream window later, however. But growing the
limit or removing it, will work mid download.

Fixes #20030
Reported-by: koujaz on github
Closes #20033

6 weeks agohttp: more unfold fixing
Daniel Stenberg [Fri, 19 Dec 2025 12:22:29 +0000 (13:22 +0100)] 
http: more unfold fixing

Extended test 798 with some mini-sleeps to better trigger a problem that
was

Reported-by: Stefan Eissing
Closes #20036

6 weeks agosocketpair: drop redundant `_WIN32` branch and include
Viktor Szakats [Fri, 19 Dec 2025 10:00:53 +0000 (11:00 +0100)] 
socketpair: drop redundant `_WIN32` branch and include

`io.h` already included via `curl_setup.h`, the other headers are
already guarded off for Windows. `INADDR_LOOPBACK` fallback remains
a no-op on Windows.

Closes #20032

6 weeks agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 19 Dec 2025 10:07:40 +0000 (11:07 +0100)] 
RELEASE-NOTES: synced

6 weeks agocontributors.sh: only check -by: lines for names
Daniel Stenberg [Fri, 19 Dec 2025 10:06:41 +0000 (11:06 +0100)] 
contributors.sh: only check -by: lines for names

Avoid catching lines that otherwise just says "by:" something.

6 weeks agobuild: drop duplicate include `curl/curl.h` and others
Viktor Szakats [Fri, 19 Dec 2025 01:09:15 +0000 (02:09 +0100)] 
build: drop duplicate include `curl/curl.h` and others

- curl_range: replace `sendf.h` with direct header dependency
  `curl_trc.h`.
- drop `curl/curl.h` includes from internal sourcees in favor of the
  include made from `curl_setup.h`. Replace it with the latter where
  it's the only include.
- include `curl_setup.h` before using macros, where missing.
- drop redundant `stdlib.h`, `string.h` includes, in favor of
  `curl_setup_once.h` including them.
- drop redundant `limits.h` in favor of `curl_setup.h` including it.
- fake_addrinfo.h: fix typo in comment.
- curl_setup_once.h: drop `stdio.h` in favor of earlier include in
  `curl_setup.h`.
- drop stray, unused, `stddef.h` includes.
- memdebug.h: add missing `stddef.h` include. (relying on accidental
  includes via other headers before this patch.)
- stddef.h: document why it's included.
- strerr: drop `curl/mprintf.h` in favor of `curl/curl.h` including it
  via `curl_setup.h`.

Closes #20027

6 weeks agohttp: fix for unfolding line starting with TAB
Daniel Stenberg [Fri, 19 Dec 2025 08:15:40 +0000 (09:15 +0100)] 
http: fix for unfolding line starting with TAB

It should still insert a (single) space when unfolding

Follow-up to 9941e7c95bf26f00fd87888a3 following up to 67ae101666f10232.

Updated test 1274 and 1940 accordingly.

Closes #20029

6 weeks agoCURLOPT_ACCEPT_ENCODING.md: warn about the expansion
Daniel Stenberg [Fri, 19 Dec 2025 09:14:14 +0000 (10:14 +0100)] 
CURLOPT_ACCEPT_ENCODING.md: warn about the expansion

also mention it in KNOWN_RISKS.md

Closes #20031

6 weeks agocompressed.md: might generate a huge amount of bytes
Daniel Stenberg [Fri, 19 Dec 2025 08:04:16 +0000 (09:04 +0100)] 
compressed.md: might generate a huge amount of bytes

Make sure this is not a surprise

Closes #20028

6 weeks agobuild: drop unused includes
Viktor Szakats [Thu, 18 Dec 2025 23:56:34 +0000 (00:56 +0100)] 
build: drop unused includes

`curl_endian.h`, `easyif.h`, `llist.h`, `progress.h`, `slist.h`.

Also:
- multi_ev.h: delete unused include, add a missing direct one.

Closes #20025

6 weeks agobuild: drop unused `multiif.h` includes
Viktor Szakats [Thu, 18 Dec 2025 23:37:13 +0000 (00:37 +0100)] 
build: drop unused `multiif.h` includes

Closes #20023

6 weeks agocurl_trc: delete unused DoH remains
Viktor Szakats [Fri, 19 Dec 2025 00:09:45 +0000 (01:09 +0100)] 
curl_trc: delete unused DoH remains

Closes #20026

6 weeks agobuild: drop unused `curlx/inet_pton.h` includes
Viktor Szakats [Thu, 18 Dec 2025 23:48:39 +0000 (00:48 +0100)] 
build: drop unused `curlx/inet_pton.h` includes

Closes #20024

6 weeks agobuild: drop unused `curl_share.h` includes
Viktor Szakats [Thu, 18 Dec 2025 23:27:59 +0000 (00:27 +0100)] 
build: drop unused `curl_share.h` includes

Closes #20022

6 weeks agotimeval: scope a variable, merge two PP branches
Viktor Szakats [Thu, 18 Dec 2025 22:14:27 +0000 (23:14 +0100)] 
timeval: scope a variable, merge two PP branches

Closes #20021

6 weeks agoTIME-KEEPING.md: fold long lines
Viktor Szakats [Thu, 18 Dec 2025 22:00:06 +0000 (23:00 +0100)] 
TIME-KEEPING.md: fold long lines

6 weeks agotime-keeping: keep timestamp in multi, always update
Stefan Eissing [Thu, 18 Dec 2025 12:55:07 +0000 (13:55 +0100)] 
time-keeping: keep timestamp in multi, always update

Always use curlx_now() when calling Curl_pgrs_now(data). Tests with the
"manual" updates to now proved differ more then 100ms in parallel testing.

Add `curlx_nowp()` to set current time into a struct curltime.
Add `curlx_ptimediff_ms() and friends, passing pointers.

Update documentation.

Closes #19998

6 weeks agotidy-up: miscellaneous
Viktor Szakats [Fri, 12 Dec 2025 19:51:52 +0000 (20:51 +0100)] 
tidy-up: miscellaneous

- apply more clang-format.
- lib/version: use `CURL_ARRAYSIZE()`.
- INSTALL-CMAKE.md: sync-up an option description with others.
- examples: delete unused main args.
- examples/ftpgetinfo: document `_CRT_SECURE_NO_WARNINGS` symbol.
- delete remaining stray duplicate lines.
- acinclude.m4: drop an unnecessary x-hack.
- vtls/mbedtls: join a URL split into two lines.
- src/tool_cb_see: add parentheses around macro expressions.
- src/tool_operate: move literals to the right side of comparisons.
- libtests: sync up fopen/fstat error messages between tests.
- curl_setup.h: replace `if ! defined __LP64` with `ifndef __LP64`.
  I assume it makes no difference on Tandem systems, as the latter form
  is already used in `include/curl/system.h`.

Closes #20018

6 weeks agoINSTALL-CMAKE.md: add recently added targets
Viktor Szakats [Thu, 18 Dec 2025 20:14:31 +0000 (21:14 +0100)] 
INSTALL-CMAKE.md: add recently added targets

Follow-up to d7bde803ee839eb438c95a1142411ceff2a11672 #20014

Closes #20020

6 weeks agohttp: when unfolding, leave single-space for new header line
Daniel Stenberg [Thu, 18 Dec 2025 12:58:22 +0000 (13:58 +0100)] 
http: when unfolding, leave single-space for new header line

Restore the unfolding behavior from before 67ae101666f10232. This change
(leaving more whitespace in the delivered headers) turned out causing
some friction in the git project so presumably others might also find it
a little surprising.

Reported-by: Jeff King
Ref: https://marc.info/?l=git&m=176606332701171&w=2
Closes #20016

6 weeks agocmake/FindRustls: merge two `if`s
Viktor Szakats [Thu, 18 Dec 2025 13:31:05 +0000 (14:31 +0100)] 
cmake/FindRustls: merge two `if`s

Closes #20017

6 weeks agocmake: add `curl-optiontable`, `curl-listhelp`, `curl-listcats` targets
Viktor Szakats [Thu, 18 Dec 2025 01:33:31 +0000 (02:33 +0100)] 
cmake: add `curl-optiontable`, `curl-listhelp`, `curl-listcats` targets

To match autotools `optiontable`, `listhelp`, `listcats` targets.

Closes #20014

6 weeks agobuild: replace `-pedantic` with `-Wpedantic` when supported
Viktor Szakats [Wed, 17 Dec 2025 14:13:12 +0000 (15:13 +0100)] 
build: replace `-pedantic` with `-Wpedantic` when supported

To use the modern form when possible. The modern option also allows
using the `no-` prefix to disable.

Supported by: gcc 4.8+, clang 3.2+ (= appleclang 4.2+)

This also automatically changes `-clang:-pedantic` to `-Wpedantic` in
clang-cl builds.

Refs:
https://github.com/llvm/llvm-project/commit/9877f689f282b19ca697aa8c6fecd752a84dbddd
https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcc/Warning-Options.html

Closes #20010

6 weeks agocmake: replace deprecated `OPENSSL_FOUND` with `OpenSSL_FOUND`
Viktor Szakats [Wed, 17 Dec 2025 14:57:10 +0000 (15:57 +0100)] 
cmake: replace deprecated `OPENSSL_FOUND` with `OpenSSL_FOUND`

Used in `CMake/FindLibrtmp.cmake`.

`OpenSSL_FOUND` available since CMake v3.3.
`OPENSSL_FOUND` deprecated since v4.2.

Ref: https://cmake.org/cmake/help/v4.2/module/FindOpenSSL.html

Closes #20012

6 weeks agocmake: replace deprecated `PERL_FOUND` with `Perl_FOUND`
Viktor Szakats [Wed, 17 Dec 2025 14:51:24 +0000 (15:51 +0100)] 
cmake: replace deprecated `PERL_FOUND` with `Perl_FOUND`

`Perl_FOUND` available since CMake v3.3.
`PERL_FOUND` deprecated since v4.2.

Ref: https://cmake.org/cmake/help/v4.2/module/FindPerl.html

Closes #20011

6 weeks agoopenssl: toggling CURLSSLOPT_NO_PARTIALCHAIN makes a different CA cache
Daniel Stenberg [Wed, 17 Dec 2025 09:54:16 +0000 (10:54 +0100)] 
openssl: toggling CURLSSLOPT_NO_PARTIALCHAIN makes a different CA cache

Reported-by: Stanislav Fort
Closes #20009

6 weeks agowolfssl: proof use of wolfSSL_i2d_SSL_SESSION
Stefan Eissing [Wed, 17 Dec 2025 10:20:42 +0000 (11:20 +0100)] 
wolfssl: proof use of wolfSSL_i2d_SSL_SESSION

While wolfSSL_i2d_SSL_SESSION() does not change the passed pointer, like
OpenSSL does, it may one day decide to do so. Pass a copy instead to be
future-proof to such a change in wolfSSL's implementation.

Closes #20008

6 weeks agomulti: remove useless assignment
Daniel Stenberg [Wed, 17 Dec 2025 06:51:08 +0000 (07:51 +0100)] 
multi: remove useless assignment

Pointed out by CodeSonar

Closes #20006

6 weeks agodocs: rename CURLcode variables to 'result'
Daniel Stenberg [Tue, 16 Dec 2025 14:54:06 +0000 (15:54 +0100)] 
docs: rename CURLcode variables to 'result'

6 weeks agodocs: use mresult as variable name for CURLMcode
Daniel Stenberg [Tue, 16 Dec 2025 12:47:45 +0000 (13:47 +0100)] 
docs: use mresult as variable name for CURLMcode

6 weeks agotests: rename CURLMcode variables to mresult
Daniel Stenberg [Tue, 16 Dec 2025 12:40:02 +0000 (13:40 +0100)] 
tests: rename CURLMcode variables to mresult

6 weeks agolib: name the main CURLMcode variable 'mresult'
Daniel Stenberg [Tue, 16 Dec 2025 12:06:20 +0000 (13:06 +0100)] 
lib: name the main CURLMcode variable 'mresult'

To make it distinctly different from 'result' and keep consistency
betwen functions.

Closes #19997

6 weeks agoGHA: bump pip-dependencies
dependabot[bot] [Tue, 16 Dec 2025 23:37:45 +0000 (23:37 +0000)] 
GHA: bump pip-dependencies

- update `filelock` from 3.20.0 to 3.20.1 (CVE-2025-68146) (used in pytests)
- update `pytest` from 9.0.1 to 9.0.2
- update `ruff` from 0.14.8 to 0.14.9

Closes #20004

6 weeks agoexamples/threaded-ssl: delete in favor of `examples/threaded`
Viktor Szakats [Tue, 16 Dec 2025 20:32:29 +0000 (21:32 +0100)] 
examples/threaded-ssl: delete in favor of `examples/threaded`

After applying a recent fix made to `threaded.c` (formerly
`multithread.c`) to `threaded-ssl.c`, syncing and updating comments,
the two examples turned out to be identical except their test URLs.

Delete one of them to avoid duplication.

Also:
- examples/threaded: scope a variable.
- examples/threaded: merge comments from its deleted sibling.

Follow-up to 61273f58125c41a84febe90a50238ee7fb12a9ad #20001
Follow-up to 971e8d661c68ce8859885c3ae865ff9441b62f0e #19526 #19524

Closes #20002

6 weeks agoHISTORY: add current website stats
Daniel Stenberg [Tue, 16 Dec 2025 22:33:54 +0000 (23:33 +0100)] 
HISTORY: add current website stats

6 weeks agotests: add a standard log line for alloc failures 19995/head
Dan Fandrich [Tue, 16 Dec 2025 08:26:25 +0000 (00:26 -0800)] 
tests: add a standard log line for alloc failures

This type of test failure requires a test status line in order to be
consistent with other failures and to be parsed properly by Test Clutch.
This is the same style as an exit or postcheck failure.

Closes #19995

6 weeks agobadwords: catch and fix threading-related words
Viktor Szakats [Tue, 16 Dec 2025 19:01:16 +0000 (20:01 +0100)] 
badwords: catch and fix threading-related words

Also:
- sync newlines between the two threaded examples.

Closes #20001

6 weeks agoschannel: use Win8 `CERT_NAME_SEARCH_ALL_NAMES_FLAG` with old SDKs
Viktor Szakats [Tue, 16 Dec 2025 16:26:46 +0000 (17:26 +0100)] 
schannel: use Win8 `CERT_NAME_SEARCH_ALL_NAMES_FLAG` with old SDKs

Define `CERT_NAME_SEARCH_ALL_NAMES_FLAG` macro if missing.
To allow using a runtime branch regardless of build-time SDK version,
when running on Windows 8+.

In practice it enables this branch for builds using mingw-w64 v3, and
MSVC with Windows SDK <8.

Also reducing build variations.

Follow-up to 29e40a6d8a70630dd8eaa15beded205792342d08 #4761 #3711
Follow-up to 899630021153b2a26a43008cccc6620b6c3f9bbf #1325
Follow-up to 172b2beba6b89b632c09be7a88645e3a0607cfe9 #264 (comment)

Closes #20000

6 weeks agolib: create unitprotos.h in the builddir, not srcdir
Dan Fandrich [Tue, 16 Dec 2025 07:32:59 +0000 (23:32 -0800)] 
lib: create unitprotos.h in the builddir, not srcdir

The make rule confused automake by changing directories before creating
the file, causing unitprotos.h to be created in the srcdir instead of
the builddir. This results in a stale file and confusing compile errors
in out-of-tree builds.

Fixes #19966
Closes #19993

6 weeks agocf-socket: enable Win10 `TCP_KEEP*` options with old SDKs
Viktor Szakats [Tue, 16 Dec 2025 15:41:05 +0000 (16:41 +0100)] 
cf-socket: enable Win10 `TCP_KEEP*` options with old SDKs

Define `TCP_KEEP*` macros if they are missing in Windows builds.
To allow using these runtime `setsockopt()` options regardless of
build-time SDK version, when running on Windows 10.0.16299+.

In practice in enables them for builds using mingw-w64 <12, and
MSVC with Windows SDK <10.

Before this patch these runtime options required building curl with
a recent toolchain.

Follow-up to f0de14168a4d1c3a4ed43a04af92c5755c84b9fc #19559

Closes #19999

6 weeks agoidn: clarify null-termination on Windows
Viktor Szakats [Mon, 15 Dec 2025 15:49:04 +0000 (16:49 +0100)] 
idn: clarify null-termination on Windows

Add comments to clarify that a terminating null is always present in
the buffers returned to the caller.

The curl APIs `win32_idn_to_ascii()` or `win32_ascii_to_idn()` receive
a null-terminated UTF-8 string as input. They first convert it to wide
chars by first asking `MultiByteToWideChar()` to calculate the length,
by passing -1. This API returns the length with the null char included
(= `strlen() + 1`), does the conversion, with the output also
null-terminated. `IdnTo*()` preserve this null character as documented.
Then we pass this null-terminated, fixed-length buffer ito
`WideCharToMultiByte()`, which keeps preserving the null, ending up in
the buffer returned to the caller.

Refs:
https://learn.microsoft.com/windows/win32/api/stringapiset/nf-stringapiset-multibytetowidechar
https://learn.microsoft.com/windows/win32/api/stringapiset/nf-stringapiset-widechartomultibyte
https://learn.microsoft.com/windows/win32/api/winnls/nf-winnls-idntoascii
https://learn.microsoft.com/windows/win32/api/winnls/nf-winnls-idntounicode

WINE source code:
https://gitlab.winehq.org/wine/wine/-/blob/wine-10.20/dlls/kernelbase/locale.c
https://gitlab.winehq.org/wine/wine/-/blob/wine-10.20/dlls/ntdll/locale.c
https://gitlab.winehq.org/wine/wine/-/blob/wine-10.20/dlls/ntdll/locale_private.h

Ref: https://github.com/curl/curl/pull/19976#issuecomment-3656005765
Follow-up to 6694a42aa0e820a6fe1e59d85ff8597b6d768d8d #19798

Closes #19980

6 weeks agolocaltime: detect thread-safe alternatives and use them
Viktor Szakats [Sat, 13 Dec 2025 03:27:41 +0000 (04:27 +0100)] 
localtime: detect thread-safe alternatives and use them

- add local API `toolx_localtime()` to wrap the banned function
  `localtime()`. Used from libcurl, libtests and test servers.
- auto-detect and use `localtime_r()` where available (e.g. Linux).
  Also to support multi-threading.
- use `localtime_s()` on Windows. It requires MSVC or mingw-w64 v4+.
  Also to support multi-threading.
  Use local workaround to also support mingw-w64 v3.
- add `src/toolx` to keep internal APIs used by the curl tool and tests,
  but not by libcurl. `toolx_localtime()` is the first API in it.
- replace `localtime()` calls with `toolx_localtime()`.
  Except in examples.
- note Windows XP's default `msvcrt.dll` doesn't offer secure CRT APIs.
  XP likely needs a newer version of this DLL, or may not run.
- note that `localtime()` mirrors `gmtime()`, with the difference that
  `gmtime()`'s internal wrapper lives in curlx.

Also:
- drop redundant `int` casts.

Refs:
https://learn.microsoft.com/cpp/c-runtime-library/reference/localtime-localtime32-localtime64
https://learn.microsoft.com/cpp/c-runtime-library/reference/localtime-s-localtime32-s-localtime64-s
https://pubs.opengroup.org/onlinepubs/9799919799/functions/localtime.html
https://linux.die.net/man/3/localtime_r

Ref: #19955 (for `gmtime_r()`)
Follow-up to 54d9f060b4b0a8fb5fa006813e4db1ca5c1a07e8
Closes #19957

6 weeks agocurlx: move `Curl_gmtime()`, use `gmtime_s()` on Windows
Viktor Szakats [Fri, 12 Dec 2025 23:16:58 +0000 (00:16 +0100)] 
curlx: move `Curl_gmtime()`, use `gmtime_s()` on Windows

Move `Curl_gmtime()` to curlx and rename to `curlx_gmtime()`. Then call
the internal wrapper also from the curl tool, to avoid using the banned
`gmtime()` directly, and using better, thread-safe alternatives when
available.

Windows `gmtime_s()` requires mingw-w64 v4+ or MSVC. Use local
workaround to also support mingw-w64 v3. `gmtime_s()` also makes
defining `_CRT_SECURE_NO_WARNINGS` unnecessary.

Also:
- lib: drop unused `parsedate.h` includes.
- drop redundant cast from `gmtime_r()` result.
- autotools: reverse condition in the proto detection to avoid
  misleading readers. (the condition plays no role in detection.)
- note Windows XP's default `msvcrt.dll` doesn't offer secure CRT APIs.
  XP likely needs a newer version of this DLL, or may not run.

Refs:
https://learn.microsoft.com/cpp/c-runtime-library/reference/gmtime-gmtime32-gmtime64
https://learn.microsoft.com/cpp/c-runtime-library/reference/gmtime-s-gmtime32-s-gmtime64-s
https://pubs.opengroup.org/onlinepubs/9799919799/functions/gmtime.html
https://linux.die.net/man/3/gmtime_r

Ref: #19957 (for `localtime_r()`)
Follow-up to 54d9f060b4b0a8fb5fa006813e4db1ca5c1a07e8
Closes #19955

6 weeks agoruntests: log the required minimum number of tests in CI
Viktor Szakats [Mon, 15 Dec 2025 22:26:34 +0000 (23:26 +0100)] 
runtests: log the required minimum number of tests in CI

For Test Clutch.

If set (via env or tflags), include the minimum number of tests required
in runtests' log output:
```
* Min tests: 1750
```

Follow-up to 3f1cd809eeae05f39fec72fe780f3a69d21972fb #19942

Closes #19987

6 weeks agobuild: unix socket tidy-ups
Viktor Szakats [Tue, 16 Dec 2025 00:37:10 +0000 (01:37 +0100)] 
build: unix socket tidy-ups

- lib: delete two unused `<sys/un.h>` includes.

- lib: drop interim macro `WIN32_SOCKADDR_UN`.
  Follow-up to 0fe9018e1a1af0d906dfe934efe2f2b1ba48f060 #7737
  Also fixing a potential issue of leaving unix socket support disabled
  if any header would include Windows' `afunix.h`, and define
  `UNIX_PATH_MAX` on its own.

- connect: honor unix socket disable option.

- connect: simplify unix socket PP condition.
  `USE_UNIX_SOCKETS` already means the necessary header/type are
  available, guaranteed by configure. `AF_UNIX` is already used
  elsewhere in the code without explicit checks.

- curl_setup.h: document availability of `afunix.h` on Windows more.
  It requires mingw-w64 10+ or MS SDK 10.17763.0 VS2017 15.8+.

- curl_setup.h: use `afunix.h` with mingw-w64 v10+ to start avoiding
  the local workaround if possible.

- GHA/windows: test disable unix socket option on Windows.

Ref: https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/

Closes #19989

6 weeks agopytest: do not ignore server issues
Stefan Eissing [Tue, 16 Dec 2025 09:12:07 +0000 (10:12 +0100)] 
pytest: do not ignore server issues

When a test server is found or configured, do not silently ignore
errors to start and disable them when checking their version.

This forces pytest to fail when a server is not operating
as it should.

Closes #19996

6 weeks agocookie. return proper error on OOM
Daniel Stenberg [Tue, 16 Dec 2025 08:11:22 +0000 (09:11 +0100)] 
cookie. return proper error on OOM

Follow-up to a78a07d3a9dc808a51

Closes #19992

6 weeks agolib: keep timestamp in easy handle
Stefan Eissing [Mon, 15 Dec 2025 13:28:09 +0000 (14:28 +0100)] 
lib: keep timestamp in easy handle

Use `data->progress.now` as the timestamp of proecssing a transfer.
Update it on significant events and refrain from calling `curlx_now()`
in many places.

The problem this addresses is
a) calling curlx_now() has costs, depending on platform. Calling it
   every time results in 25% increase `./runtest` duration on macOS.
b) we used to pass a `struct curltime *` around to save on calls, but
   when some method directly use `curx_now()` and some use the passed
   pointer, the transfer experienes non-linear time. This results in
   timeline checks to report events in the wrong order.

By keeping a timestamp in the easy handle and updating it there, no
longer invoking `curlx_now()` in the "lower" methods, the transfer
can observer a steady clock progression.

Add documentation in docs/internals/TIME-KEEPING.md

Reported-by: Viktor Szakats
Fixes #19935
Closes #19961

6 weeks agocurl_sasl: username cleanups
Daniel Stenberg [Mon, 15 Dec 2025 16:16:54 +0000 (17:16 +0100)] 
curl_sasl: username cleanups

Remove 'user' from the sasl_ctx struct and instead refer to conn->user.

conn->user is always non-NULL, so remove the checks for that.

Closes #19981

6 weeks agoGHA/non-native: fix passing some envs to the VMs
Viktor Szakats [Mon, 15 Dec 2025 22:42:39 +0000 (23:42 +0100)] 
GHA/non-native: fix passing some envs to the VMs

Also increase the minimum for FreeBSD.

Ref: #19987
Follow-up to 3f1cd809eeae05f39fec72fe780f3a69d21972fb #19942
Closes #19988

6 weeks agogetenv: drop internal 1-to-1 wrapper
Viktor Szakats [Mon, 15 Dec 2025 12:19:30 +0000 (13:19 +0100)] 
getenv: drop internal 1-to-1 wrapper

Closes #19984

6 weeks agodocs: fix time_posttransfer output unit as seconds
Sergey Katsubo [Mon, 15 Dec 2025 21:04:14 +0000 (00:04 +0300)] 
docs: fix time_posttransfer output unit as seconds

Closes #19986

6 weeks agovquic: ignore 0-length UDP packets
Stefan Eissing [Mon, 15 Dec 2025 10:15:38 +0000 (11:15 +0100)] 
vquic: ignore 0-length UDP packets

When someone gives us 0-length UDP packets, ignore
them as they cannot be valid QUIC packets. This also
prevents us from messing up any GSO calculations.

Reported-by: Stanislav Fort
Closes #19978

6 weeks agoGHA/linux: update dependency pizlonator/fil-c to v0.677
renovate[bot] [Mon, 15 Dec 2025 05:13:42 +0000 (05:13 +0000)] 
GHA/linux: update dependency pizlonator/fil-c to v0.677

Closes #19974

6 weeks agoTODO: consider a multi-threaded curl tool
Daniel Stenberg [Sun, 14 Dec 2025 10:58:01 +0000 (11:58 +0100)] 
TODO: consider a multi-threaded curl tool

Closes #19971

6 weeks agoRELEASE-NOTES: synced rc-8_18_0-2
Daniel Stenberg [Mon, 15 Dec 2025 06:50:51 +0000 (07:50 +0100)] 
RELEASE-NOTES: synced

6 weeks agotests/server: fix initialization on Windows Vista+
Viktor Szakats [Sun, 14 Dec 2025 23:05:15 +0000 (00:05 +0100)] 
tests/server: fix initialization on Windows Vista+

Make sure to call `curlx_now_init()` before the first call to
`curlx_now()`.

Before this patch the first `curlx_now()` used the non-Vista code path
calling `GetTickCount()` on Vista+. This is harmless, but the upcoming
PR #18009 is going to drop the non-Vista code path, causing a division
by zero at startup in test servers, without this fix.

Bug: https://github.com/curl/curl/pull/18009#issuecomment-3652154307

Closes #19973

6 weeks agotidy-up: replace banned `printf()` with `puts()`
Viktor Szakats [Sun, 14 Dec 2025 18:16:57 +0000 (19:16 +0100)] 
tidy-up: replace banned `printf()` with `puts()`

In `curlinfo` and CMake integration test app.

Closes #19972

6 weeks agorenovate: try bumping Fil-C on releases, not tags
Viktor Szakats [Mon, 15 Dec 2025 00:53:16 +0000 (01:53 +0100)] 
renovate: try bumping Fil-C on releases, not tags

CI needs the binary packages attached to the release, which appears some
time after tagging. Hopefully this patch helps getting a clean build
by the time Renovate opens its PR.

Ref: https://docs.renovatebot.com/modules/datasource/github-releases/
Ref: #19905, #19974
Closes #19975

6 weeks agoeasy: fix debug ev poll builds
Gabriel Marin [Sat, 13 Dec 2025 21:09:04 +0000 (22:09 +0100)] 
easy: fix debug ev poll builds

Prior to this change the wrong variable name was used for one of the
debug messages.

Closes https://github.com/curl/curl/pull/19963

6 weeks agoruntests: improve XML prolog check, enable `-w` permanently, fix two tests
Viktor Szakats [Sun, 14 Dec 2025 08:42:59 +0000 (09:42 +0100)] 
runtests: improve XML prolog check, enable `-w` permanently, fix two tests

To really verify the presence of the XML prolog, also in CI.

- move the prolog check from `loadtest` to `checktest`.
  (load did a soft error, silently skipping the test instead of failing)
- runtests: enable `-w` functionality permanently for all test targets,
  drop the option. It has no measurable performance impact.
- test 798, 1665: add XML prolog.
  Follow-up to f0d277cb0e3712ae4edf8f51822ffa99e9b3ec54

Follow-up to b5ea0736bbeeae717925d8eccbdb15057d8e88e9 #19946
Follow-up to 904e7ecb66519951681377758fe6b07dde28ce36 #19347

Closes #19970

6 weeks agosynctime: tidy up, make it work on all platforms
Viktor Szakats [Sun, 14 Dec 2025 07:12:01 +0000 (08:12 +0100)] 
synctime: tidy up, make it work on all platforms

The `--synctime` option remains non-UWP-Windows-specific.

Also:
- replace default URL with `ntp.org`.
- delete unused example URL.

Closes #19965

6 weeks agoGHA: update actions
renovate[bot] [Sat, 13 Dec 2025 19:51:34 +0000 (19:51 +0000)] 
GHA: update actions

- update actions/checkout action to v6.0.1
- update github/codeql-action action to v4.31.8
- update msys2/setup-msys2 action to v2.30.0

Closes #19962
Closes #19967
Closes #19968

6 weeks agorenovate: try to disable GitHub Actions updates differently
Viktor Szakats [Sun, 14 Dec 2025 08:10:58 +0000 (09:10 +0100)] 
renovate: try to disable GitHub Actions updates differently

Follow-up to a9b1be555a26aeca623721b0826ea66d6b8c0929 #19954

Closes #19969

6 weeks agoexamples: delete unresponsive example URL
Viktor Szakats [Sat, 13 Dec 2025 11:45:09 +0000 (12:45 +0100)] 
examples: delete unresponsive example URL

Also:
- sync header layout with rest of examples.
- replace rest of arbitrary website links with example ones.

Closes #19959

6 weeks agorenovate: leave bumping GitHub Actions to Dependabot
Viktor Szakats [Fri, 12 Dec 2025 22:30:45 +0000 (23:30 +0100)] 
renovate: leave bumping GitHub Actions to Dependabot

To avoid update noise. Renovate bumps everything instantly, meaning
a major version a couple hours after release, then all minor bugfix
releases throughout the next 1-2 days. Also putting major versions in
a different group than the bugfix release, and there is no support for
a cooldown period.

After this patch GitHub's Dependabot remains the single tool responsible
to bump GitHub Actions, once a month, grouped, with a cooldown period.
In sync with most other curl repos.

Both Renovate and Dependabot keep bumping pinned pips for now. Also
Renovate keeps updating C dependencies and Dockerfile.

Closes #19954

6 weeks agoschannel: cap the maximum allowed size for loading cert
Daniel Stenberg [Sat, 13 Dec 2025 23:13:27 +0000 (00:13 +0100)] 
schannel: cap the maximum allowed size for loading cert

To avoid problems with mistakes or abuse, cap the largest allowed
certificate size to load to CURL_MAX_INPUT_LENGTH bytes (8MB).

Closes #19964

6 weeks agotests: verify new header undfolder
Daniel Stenberg [Thu, 11 Dec 2025 22:28:51 +0000 (23:28 +0100)] 
tests: verify new header undfolder

test 798 - incoming cookie header in a folded line

test 1665 - verify HTTP headers without final CRLF. Make sure all complete
headers are delivered even if the reponse is partial

6 weeks agohttp: unfold response headers earlier
Daniel Stenberg [Fri, 12 Dec 2025 15:36:08 +0000 (16:36 +0100)] 
http: unfold response headers earlier

Make the low-level HTTP header "builder" unfold headers so that
everything else can keep pretending folding does not exist.

This code no longer tries to reduce repeated leading whitespace (in the
continued folded header) to a single one. To avoid having to have a
special state for that.

Adjusted two test cases accordingly

Closes #19949

6 weeks agoGHA/checksrc: fix `-z` position, also use `--output` with `xmllint`
Viktor Szakats [Sat, 13 Dec 2025 11:35:36 +0000 (12:35 +0100)] 
GHA/checksrc: fix `-z` position, also use `--output` with `xmllint`

Fixing:
```
fatal: option '-z' must come before non-option arguments
```
Ref: https://github.com/curl/curl/actions/runs/20183280533/job/57948203944#step:4:5

Follow-up to b5ea0736bbeeae717925d8eccbdb15057d8e88e9 #19946
Closes #19958

6 weeks agotool_urlglob: support globs as long as config line lengths
Daniel Stenberg [Sat, 13 Dec 2025 12:48:59 +0000 (13:48 +0100)] 
tool_urlglob: support globs as long as config line lengths

libcurl supports up to 8MB string inputs, the config file accepts up to
10MB line lengths. It did not make sense to limit the globs to a maximum
of one megabyte.

Closes #19960

7 weeks agotests: fix perl scalar warning
Dan Fandrich [Fri, 12 Dec 2025 23:36:40 +0000 (15:36 -0800)] 
tests: fix perl scalar warning

Fixes the warning "Scalar value @xml[0] better written as $xml[0]"

Follow-up to b5ea0736bbeeae717925d8eccbdb15057d8e88e9

Ref: #19946

7 weeks agoGHA: update actions
renovate[bot] [Fri, 12 Dec 2025 22:02:09 +0000 (22:02 +0000)] 
GHA: update actions

- actions/cache action to v5.0.1
- actions/download-artifact to v7.0.0
- actions/upload-artifact to v6.0.0

Closes #19952
Closes #19953

7 weeks agoGHA: enable libssh and libssh2 in 10 more Linux jobs
Viktor Szakats [Fri, 12 Dec 2025 02:59:21 +0000 (03:59 +0100)] 
GHA: enable libssh and libssh2 in 10 more Linux jobs

To run more pytest sshd tests, and for more static analysis.

Also:
- drop redundant option from `openssl libssh2 ...` config.
- GHA/linux: enable pytest in the LTO job (to test libssh2).
- avoid both with local builds of OpenSSL-forks, due to crypto lib
  mixups causing a mixture of build error, crashes, test failures.

Follow-up to eb39fee40be6a8e68be2551e36b6fcb94170aaed #19934

Closes #19943

7 weeks agotests/data: delete stray comments
Viktor Szakats [Fri, 12 Dec 2025 16:16:56 +0000 (17:16 +0100)] 
tests/data: delete stray comments

Closes #19950

7 weeks agotests/data: add XML prolog to test files
Viktor Szakats [Fri, 12 Dec 2025 12:43:55 +0000 (13:43 +0100)] 
tests/data: add XML prolog to test files

To formalize they are now XML-compliant (with some asterisks.)

Also to help syntax highlighters work on them to make their content more
readable.

Also:
- Delete empty comment decorations.
- GHA/checksrc: simplify XML check.
- runtests: fail to load test data with XML prolog missing.

Follow-up to bfe6eb1c06f295a45c4d2c9c7aa8f09895706313 #19927
Follow-up to 87ba80a6df1dfd7ceaaa52352c9f23afff0ed513

Closes #19946

7 weeks agotest567: add a header separating CRLF
Daniel Stenberg [Fri, 12 Dec 2025 15:37:27 +0000 (16:37 +0100)] 
test567: add a header separating CRLF

To make it a valid response.

Closes #19948

7 weeks agoGHA/windows: move dl-mingw tests from 9.5.0 to 15.1.0
Viktor Szakats [Fri, 12 Dec 2025 13:04:37 +0000 (14:04 +0100)] 
GHA/windows: move dl-mingw tests from 9.5.0 to 15.1.0

To see if it's less flaky. Also to finish 1m faster due to faster builds.

Closes #19947

7 weeks agotest568: fix codespell, catch it next time early in CI
Viktor Szakats [Fri, 12 Dec 2025 11:30:51 +0000 (12:30 +0100)] 
test568: fix codespell, catch it next time early in CI

Also:
- GHA/checksrc: do not exclude `tests/data/*` changes.

Follow-up to 407d2f3d574f68bfe986b621282a61016ca45c63 #19944

Closes #19945

7 weeks agocmake: update a comment
Viktor Szakats [Fri, 12 Dec 2025 12:09:37 +0000 (13:09 +0100)] 
cmake: update a comment

7 weeks agobuild: disable typecheck for analyzers and Fil-C
Viktor Szakats [Fri, 12 Dec 2025 00:05:21 +0000 (01:05 +0100)] 
build: disable typecheck for analyzers and Fil-C

- cmake: automatically disable typecheck when running clang-tidy,
  to avoid possible interference, and to improve performance.

- INSTALL-CMAKE: document both this, and unity=off for clang-tidy.

- GHA/linux: disable for some static analyzers CI jobs to avoid possible
  interference.

- GHA/linux: disable in Fil-C job to improve build performance.

Follow-up to 9e6f1c5efb7a70e1f33e467a738f3e3f652f3174 #19637
Follow-up to fd2ca2399e79e0b821af34c7c164c830c9c6574d #17955

Closes #19941

7 weeks agoruntests: add options to set minimum number of tests, use them
Viktor Szakats [Fri, 12 Dec 2025 00:55:30 +0000 (01:55 +0100)] 
runtests: add options to set minimum number of tests, use them

To detect mistakes made in the runtests framework that reduce
the number of test runs. Before this patch it could go undetected with
a green CI.

The minimum thresholds will need light maintenance going forward (either
bumping them periodically, or adjust if some may fell below minimums for
justified reasons). We may also make minimums tighter or looser, or more
job-specific.

Latest number of test runs for each job can be seen at Test Clutch:
https://testclutch.curl.se/static/reports/feature-matrix.html

Also:
- GHA: set minimums.

Assisted-by: Dan Fandrich
Follow-up to f2a75a14dd95e06cf9121c7d3bd5dc559748f350
Follow-up to bb1391f94394e635c1a5c58253e7a3d3b36bde57 #19510

Closes #19942

7 weeks agopytest: add tests using sshd
Stefan Eissing [Thu, 11 Dec 2025 15:02:41 +0000 (16:02 +0100)] 
pytest: add tests using sshd

With either /usr/sbin/sshd found or configured via --with-test-sshd=path
add tests for SCP down- and uploads, insecure, with known hosts or not,
with authorized user key or unauthorized one.

Working now with libssh and libssh2, using a hashed known_hosts file.

Closes #19934

7 weeks agotest568: remove what looks like an email and a URL
Daniel Stenberg [Fri, 12 Dec 2025 10:04:23 +0000 (11:04 +0100)] 
test568: remove what looks like an email and a URL

Closes #19944

7 weeks agotidy-up: miscellaneous
Viktor Szakats [Sun, 7 Dec 2025 15:49:55 +0000 (16:49 +0100)] 
tidy-up: miscellaneous

- drop stray duplicate empty lines in docs, scripts, test data, include,
  examples, tests.
- drop duplicate PP parenthesis.
- curl-functions.m4: move literals to the right side in if expressions,
  to match rest of the source code.
- FAQ.md: delete language designator from an URL.
- packages: apply clang-format (OS400, VMS).
- scripts/schemetable.c: apply clang-format.
- data320: delete duplicate empty line that doesn't change the outcome.
- spacecheck: extend to check for duplicate empty lines
  (with exceptions.)
- fix whitespace nits

Closes #19936

7 weeks agoGHA: update actions/cache action to v5
renovate[bot] [Thu, 11 Dec 2025 22:24:51 +0000 (22:24 +0000)] 
GHA: update actions/cache action to v5

Closes #19940