]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
6 days agoIPFS.md: wrap long lines
Viktor Szakats [Mon, 8 Dec 2025 16:02:26 +0000 (17:02 +0100)] 
IPFS.md: wrap long lines

Closes #19880

6 days agoGHA: bump pip-dependencies ruff, psutil, pytest
dependabot[bot] [Mon, 8 Dec 2025 14:20:54 +0000 (14:20 +0000)] 
GHA: bump pip-dependencies ruff, psutil, pytest

- update `ruff` from 0.14.5 to 0.14.8
- update `psutil` from 7.1.2 to 7.1.3
- update `pytest` from 8.4.2 to 9.0.1

Closes #19876

7 days agoCI/windows: add torture tests with Schannel
Viktor Szakats [Sun, 7 Dec 2025 16:36:54 +0000 (17:36 +0100)] 
CI/windows: add torture tests with Schannel

With Schannel and Unicode, `-shallow=13`. It finishes in 12 minutes,
making it the slowest Windows job. It's still on par with torture jobs
on other platforms (though they manage to fit `-shallow=25`).

Also `-shallow=13` still caught leaks in multiple tests.

Also:
- test2300: exclude from CI Windows torture tests.
- experimental.

The downside of going with deeper torture tests, is that it requires
increasing the job timeout. This in turns means that a hung job takes
more minutes to be killed (due to GitHub bugs where a hung step does not
honor the per-step timeout on Windows, another bug where a hung job gets
killed +5 minutes above the workflow timeout, and another bug (or
feature?) where other failed/hung jobs in the the workflow cannot be
restarted till the last job finishes or gets killed. And all this
probably related to a Perl bug which makes it hang on fork errors, which
is turn related to Cygwin/MSYS2 runtime bugs which breaks fork in case
of curl's mixed MSYS2-Perl/native-curl-binaries environment.)
The end result in longer forced waits before being able to restart flaky
jobs, which slows down iterations and annoying.

Also tried:
- non-c-ares job: detected known issues much less often.
- replaced libidn2 with WinIDN: detected known issues much less often.
- runtests -j9-j20 values: did not make a difference.
- other `-shallow` values: 20 is the max feasible, but comes with the
  downside described above.

Ref: #19675 (reboot of)
Follow-up to f08417c4259a3b9a2e4d72a48fa02ce6502cb587 #19863

Closes #19865

7 days agodocs: switch more URLs to https://
Daniel Stenberg [Mon, 8 Dec 2025 10:11:02 +0000 (11:11 +0100)] 
docs: switch more URLs to https://

Normalize using https:// almost everywhere instead of http://

Closes #19872

7 days agomdlinkcheck: ignore IP numbers, allow '@' in raw URLs
Daniel Stenberg [Mon, 8 Dec 2025 10:16:18 +0000 (11:16 +0100)] 
mdlinkcheck: ignore IP numbers, allow '@' in raw URLs

7 days agoGHA/linux: update dependency pizlonator/fil-c to v0.675
renovate[bot] [Mon, 8 Dec 2025 11:07:26 +0000 (11:07 +0000)] 
GHA/linux: update dependency pizlonator/fil-c to v0.675

Closes #19873

7 days agoGHA/linux: blind try to make Renovate detect Fil-C releases
Viktor Szakats [Mon, 8 Dec 2025 10:06:49 +0000 (11:06 +0100)] 
GHA/linux: blind try to make Renovate detect Fil-C releases

0.675 has been out for 2 weeks, Renovate did not detect it with
`semver-partial`. Try with `semver-coerced`.

Refs:
https://docs.renovatebot.com/modules/versioning/semver-coerced/
https://docs.renovatebot.com/modules/versioning/semver-partial/

Follow-up to 16c6ea36cca6684aacbcb33578af61b28e3fee0d #19391

7 days agoDISTROS: fix a Mageia URL
Daniel Stenberg [Mon, 8 Dec 2025 10:43:12 +0000 (11:43 +0100)] 
DISTROS: fix a Mageia URL

Since we check the provided URLs now, use the direct, working URL.

7 days agognutls: add PROFILE_MEDIUM as default
Stefan Eissing [Fri, 5 Dec 2025 14:38:12 +0000 (15:38 +0100)] 
gnutls: add PROFILE_MEDIUM as default

Raise the default GnuTLS priority settings by adding PROFILE_MEDIUM for
more secure connection handling.

Reported-by: Harry Sintonen
Closes #19853

7 days agotest1475: consistently use %CR in headers
Fabian Keil [Sun, 7 Dec 2025 14:23:00 +0000 (15:23 +0100)] 
test1475: consistently use %CR in headers

Gets the test working when using Privoxy as proxy.

Closes #19870

7 days agohostcheck: fail wildcard match if host starts with a dot
Daniel Stenberg [Mon, 8 Dec 2025 09:20:04 +0000 (10:20 +0100)] 
hostcheck: fail wildcard match if host starts with a dot

A hostname cannot start with a dot when DNS is used, but there are other
ways.

Amend unit test 1397

Closes #19869

7 days agosspi: fix memory leaks on error paths in `Curl_create_sspi_identity()`
Viktor Szakats [Sun, 7 Dec 2025 19:03:38 +0000 (20:03 +0100)] 
sspi: fix memory leaks on error paths in `Curl_create_sspi_identity()`

Detected by Windows torture test 1072 (with `-shallow=20/13`),
test 579 (with `-shallow=18/14/13`), and test 1286 (with `-shallow=15`).

```
** MEMORY FAILURE
Leak detected: memory still allocated: 20 bytes
At 1a1e8136328, there is 18 bytes.
 allocated by D:/a/curl/curl/lib/curl_sspi.c:133
At 1a1e8139368, there is 2 bytes.
 allocated by D:/a/curl/curl/lib/curl_sspi.c:143
 1072: torture FAILED: function number 207 in test.
 invoke with "-t207" to repeat this single case.
Warning: http2 server unexpectedly alive
```
Ref: https://github.com/curl/curl/actions/runs/20008523913/job/57374427439?pr=19865

Also simplify the code a little.

Cherry-picked from #19865
Closes #19866

7 days agocookie: cleanups and improvements
Daniel Stenberg [Sun, 7 Dec 2025 22:44:31 +0000 (23:44 +0100)] 
cookie: cleanups and improvements

- Stricter cookie validation with earlier rejection of empty/invalid
  cookie names

- secure and httponly attributes no longer accept = with empty values
  (only bare keywords)

- Validation checks (length, TAB, prefixes) moved into the first
  name/value pair block for better code organization

- Deferred time(NULL) calls for better performance when expires/max-age
  aren't used

- Simplified loop control flow by removing done flag

- The cookie size restriction now only applies to name + value, not other
  parts of the header line.

- Fixed a gcc 4.8.1 quirk

Closes #19868

7 days agocookie: only keep and use the canonical cleaned up path
Daniel Stenberg [Sun, 7 Dec 2025 15:09:13 +0000 (16:09 +0100)] 
cookie: only keep and use the canonical cleaned up path

Instead of keeping both versions around.

Closes #19864

7 days agocookie: when parsing a cookie header, delay all allocations until okay
Daniel Stenberg [Sun, 7 Dec 2025 12:49:33 +0000 (13:49 +0100)] 
cookie: when parsing a cookie header, delay all allocations until okay

To avoid wasting time allocating data for incoming cookies that are
discarded for one reason or another, delay allocations until after
verifications are done.

Closes #19864

7 days agocookie: allocate the main struct once cookie is fine
Daniel Stenberg [Sun, 7 Dec 2025 12:17:24 +0000 (13:17 +0100)] 
cookie: allocate the main struct once cookie is fine

This delays the allocating of the cookie struct until after all the
checks have been done, as many cookies are received and discarded
instead of accepted and this then saves one allocation for every
discarded cookie.

Closes #19864

7 days agorunner.pm: run memanalyzer as a Perl module
Viktor Szakats [Sun, 7 Dec 2025 15:58:34 +0000 (16:58 +0100)] 
runner.pm: run memanalyzer as a Perl module

To improve performance of torture tests.

Also on Windows, where this patch may make those viable for CI.

Linux   !FTP    4m47 ->  4m24 (-shallow=25)
Linux    FTP    2m30 ->  2m23 (-shallow=25)
macOS   !FTP   14m30 -> 13m07 (-shallow=25)
macOS    FTP    3m57 ->  3m59 (-shallow=25)
Windows !FTP  >25m   ->  4m47 to 14m45 (-shallow=5 to 25) (not in CI)

Linux
Before: https://github.com/curl/curl/actions/runs/20006771767/job/57370205514
After: https://github.com/curl/curl/actions/runs/20006783210/job/57370236911?pr=19863

macOS:
Before: https://github.com/curl/curl/actions/runs/20006771786/job/57370205769
After: https://github.com/curl/curl/actions/runs/20006783177/job/57370236995?pr=19863

Windows:
Before: https://github.com/curl/curl/actions/runs/19667198537/job/56326962912?pr=19675
After: https://github.com/curl/curl/actions/runs/20007175773/job/57371768734?pr=19863
After shallow=25: https://github.com/curl/curl/actions/runs/20008523913/job/57374427449?pr=19865

Ref: #19675
Follow-up to 472bc9032374f98f48f7a2df6c644cff91fe142c #19821
Closes #19863

7 days agowolfssl: fix possible assert with `!HAVE_NO_EX` wolfSSL builds
Viktor Szakats [Fri, 5 Dec 2025 13:53:35 +0000 (14:53 +0100)] 
wolfssl: fix possible assert with `!HAVE_NO_EX` wolfSSL builds

Without this option `wolfSSL_get_app_data()` always returns NULL.
Disable codepaths using it (and its `set` pair) when curl is built
against a wolfSSL library with this option missing.

Fixing:
```
curl: ../../lib/vtls/wolfssl.c:486: wssl_vtls_new_session_cb: Assertion `cf != ((void *)0)' failed.
```

wolfSSL can be built with the `--enable-context-extra-user-data` or
`-DWOLFSSL_EX_DATA` option to enable this feature. Some higher-level
features also enable it automatically like QUIC, ASIO.

Reported-by: Yedaya Katsman
Bug: https://github.com/curl/curl/pull/19816#issuecomment-3606447845
Ref: https://github.com/curl/curl/actions/runs/19871780796/job/56949160740

Closes #19852

8 days agohttp: return OOM errors from hsts properly
Daniel Stenberg [Sun, 7 Dec 2025 11:35:42 +0000 (12:35 +0100)] 
http: return OOM errors from hsts properly

When Curl_hsts_parse() fails with out of memory, return it to parent.

Closes #19862

8 days agohsts: use one malloc instead of two per entry
Daniel Stenberg [Sun, 7 Dec 2025 11:24:33 +0000 (12:24 +0100)] 
hsts: use one malloc instead of two per entry

Closes #19861

8 days agonoproxy: fix build on systems without IPv6
Daniel Stenberg [Sat, 6 Dec 2025 23:03:56 +0000 (00:03 +0100)] 
noproxy: fix build on systems without IPv6

Follow-up to ff2aaed9ba6f186feb57f89fc6854
Reported-by: Harry Sintonen
Closes #19860

8 days agoasyn-thrdd: fix Curl_async_getaddrinfo() on systems without getaddrinfo
Daniel Stenberg [Sat, 6 Dec 2025 22:45:06 +0000 (23:45 +0100)] 
asyn-thrdd: fix Curl_async_getaddrinfo() on systems without getaddrinfo

Follow-up to ce06fe77710525
Bug: https://github.com/curl/curl/commit/ce06fe7771052549ff430c86173b2eaca91f8a9c#r172215567
Reported-by: Harry Sintonen
Closes #19859

8 days agoaltsvc: make it one malloc instead of three per entry
Daniel Stenberg [Sat, 6 Dec 2025 17:01:09 +0000 (18:01 +0100)] 
altsvc: make it one malloc instead of three per entry

Also return OOM correctly.

Closes #19857

8 days agoformdata: validate callback is non-NULL before use
Robert W. Van Kirk [Sat, 6 Dec 2025 18:00:00 +0000 (12:00 -0600)] 
formdata: validate callback is non-NULL before use

curl_formget() accepts a user-provided callback function but does not
validate it is non-NULL before calling it. If a caller passes NULL,
the function will crash with SIGSEGV.

Add NULL check at the start of the function to return an appropriate
error code instead of crashing.

Signed-off-by: Robert W. Van Kirk <robert@rwvk.tech>
Closes #19858

8 days agoftp: make EPRT connections non-blocking
Stefan Eissing [Fri, 5 Dec 2025 13:12:47 +0000 (14:12 +0100)] 
ftp: make EPRT connections non-blocking

On platforms where neither accept4 nor fcntl was available, an
EPRT connection did not send the accepted socket as non-blocking.

This became apparent when TLS was in use and the test receive
on shutdown did simply hang.

Reported-by: Denis Goleshchikhin
Fixes #19753
Closes #19851

9 days agoRELEASE-NOTES: synced rc-8_18_0-1
Daniel Stenberg [Fri, 5 Dec 2025 22:51:47 +0000 (23:51 +0100)] 
RELEASE-NOTES: synced

9 days agomdlinkcheck: detect and check "raw" links
Daniel Stenberg [Fri, 5 Dec 2025 10:45:35 +0000 (11:45 +0100)] 
mdlinkcheck: detect and check "raw" links

- URLs specified outside of the markdown []() are now extracted and
  checked

- also check TODO, FAQ and KNOWN_BUGS

- more aggressive avoiding to check github.com/curl/curl, all uses of
  example domains and some more established URLs on the curl.se site

- list all errors in the end to make them easier to spot in CI logs

Closes #19848

9 days agoDISTROS: remove broken URLs for buildroot
Daniel Stenberg [Fri, 5 Dec 2025 13:11:39 +0000 (14:11 +0100)] 
DISTROS: remove broken URLs for buildroot

9 days agoFAQ: fix hackerone URL
Daniel Stenberg [Fri, 5 Dec 2025 13:04:25 +0000 (14:04 +0100)] 
FAQ: fix hackerone URL

9 days agodocs: use .example URLs for proxies
Daniel Stenberg [Fri, 5 Dec 2025 12:33:02 +0000 (13:33 +0100)] 
docs: use .example URLs for proxies

9 days agodocs: remove dead URLs
Daniel Stenberg [Fri, 5 Dec 2025 12:17:11 +0000 (13:17 +0100)] 
docs: remove dead URLs

- KNOWN_BUGS: remove dead URL
- ECH: remove two dead URLs
- MAIL-ETIQUETTE: remove dead URL

9 days agotest1498: disable 'HTTP PUT from stdin' test on Windows
Viktor Szakats [Fri, 5 Dec 2025 15:14:19 +0000 (16:14 +0100)] 
test1498: disable 'HTTP PUT from stdin' test on Windows

Test became flaky with memanalyze errors after merging #19845,
in a TrackMemory Windows Unicode c-ares openssl-quic build:
GHA/windows: mingw, AM x86_64 c-ares U.

Disable it until further investigation.

This test uses the Windows-specific multi-threaded stdin code
that caused issues in the past. It's also using `TerminateThread()`,
that apps aren't supposed to.

Examples:
https://github.com/curl/curl/pull/19845#issuecomment-3614921298
https://github.com/curl/curl/actions/runs/19948992659/job/57205061260?pr=19845#step:13:3028
https://github.com/curl/curl/actions/runs/19966429786/job/57259325027?pr=19852#step:13:3030

Also seen to fail earlier while testing torture tests on Windows:
https://github.com/curl/curl/pull/19675#issuecomment-3573154110

Ref: 4e051ff5506319ee87e3656be8f76b01de217103 #19845

Closes #19855

9 days agotidy-up: avoid `(())`, clang-format fixes and more
Viktor Szakats [Thu, 4 Dec 2025 21:48:20 +0000 (22:48 +0100)] 
tidy-up: avoid `(())`, clang-format fixes and more

- drop redundant parentheses from macro definitions.
- apply clang-format in some places missed earlier.
- wolfssl: fix a macro guard comment.
- curl_setup.h: drop empty lines
- FAQ: fix C formatting.

Closes #19854

9 days agocurlx: limit use of system allocators to the minimum possible
Viktor Szakats [Thu, 4 Dec 2025 22:54:25 +0000 (23:54 +0100)] 
curlx: limit use of system allocators to the minimum possible

Clone a multibye conversion function into curlx/fopen, and use that
local copy from curlx/fopen functions. Adjust allocators in curlx/fopen
to use curl's in normal builds, and system allocators in TrackMemory
builds to avoid recursion.

This allows to switch curlx/multibyte functions to curl allocators in
all configurations, as they are no longer called by curlx/fopen, and
a recursive call can no longer happen.

After this patch the system allocator is only used in TrackMemory
Windows builds, within curlx `fopen`, `freopen`, `stat` and `open`
functions.

Also:
- test 1, 440, 767: raise allocation limitsto fit the extra allocations
  in Windows Unicode builds.
- replace all uses of `curlx_unicodefree()` macro with `curlx_free()`
  across the codebase.
- curlx/multibyte: delete `curlx_unicodefree()`.
- ldap: join Windows and non-Windows codepaths that became
  identical after moving from `curlx_unicodefree()` to `curlx_free()`.
- vauth: drop a strdup from standard to curl allocator since
  the original allocation is now already done by curl's.
- tool_doswin: drop now superfluous strdup from `FindWin32CACert()`.
- memanalyzer.pm: sync weirdo `calloc` log message with `malloc`'s.

Fixes #19748
Closes #19845

10 days agoldap: improve detection of Apple LDAP
Viktor Szakats [Fri, 5 Dec 2025 11:43:37 +0000 (12:43 +0100)] 
ldap: improve detection of Apple LDAP

When detecting the Apple fork of "legacy" LDAP, replace the `__APPLE__`
macro (which can be present also when using an old mainline OpenLDAP
while building for an Apple platform) with `LDAP_OPT_X_TLS_PASSPHRASE`
which is an Apple-specific macro, merged by Apple in 2007, later adding
the comment 'Apple Specific code'. This macro hasn't been retrofitted
to OpenLDAP since then, and unlikely to happen in the future.

Refs:
https://github.com/apple-oss-distributions/OpenLDAP/commit/c4d990a6cfa0cb71d6dffe6f6aeeb722fd7c627b#diff-0f7a5f85bae4de860b70aabf34aa12b0ecc37e748cd96e203e2d8ddb30a207c3R145
https://github.com/apple-oss-distributions/OpenLDAP/commit/49ac28a486d72f36cd9713b41180b41d34f18ef6#diff-0f7a5f85bae4de860b70aabf34aa12b0ecc37e748cd96e203e2d8ddb30a207c3R166

Follow-up to 859ce48de12986f5bf846c2800dacab893ff12c1 #19832
Closes #19849

10 days agotests/servers: put unix-domain-path inside LOGDIR
Stefan Eissing [Tue, 2 Dec 2025 14:53:29 +0000 (15:53 +0100)] 
tests/servers: put unix-domain-path inside LOGDIR

Change Unix domain socket paths from `/tmp/curl-socksd-<random>` to
`/drive/path/to/LOGDIR/PIDDIR/*-uds` to avoid having to create and
delete them before use. Also to use a path which remains an absolute one
while passed from MSYS2 Perl to native Windows curl tool and test server
via the command-line, and keep pointing to the same location, fixing:
```
=== Start of file commands.log
../src/curl.exe -q --output log/3/curl1468.out --include --trace-ascii log/3/trace1468
  --trace-time http://this.is.a.host.name:64405/1468
  --proxy socks5h://localhost/tmp/curl-socksd-YnbvRo98 [...]
=== End of file commands.log
=== Start of file socks2_server.log
[...]
14:11:54.597968 Listening on Unix socket D:/a/_temp/msys64/tmp/curl-socksd-YnbvRo98
```
Ref: https://github.com/curl/curl/actions/runs/19896583933/job/57028545111?pr=19812

The curl tool is pending #19825 to fix accepting an absolute unix domain
socket path on Windows.

Assisted-by: Viktor Szakats
Closes #19810

10 days agoTODO: remove a mandriva.com reference
Daniel Stenberg [Fri, 5 Dec 2025 07:51:11 +0000 (08:51 +0100)] 
TODO: remove a mandriva.com reference

It's a casino now

10 days agoldap: detect version of "legacy" LDAP
Viktor Szakats [Thu, 4 Dec 2025 14:32:44 +0000 (15:32 +0100)] 
ldap: detect version of "legacy" LDAP

Legacy LDAP means an OpenLDAP-compatible implementation
without the private API `ldap_init_fd()` introduced in OpenLDAP
2.4.6+ (2007-10-31), and not WinLDAP.

One known example is Apple's LDAP build, which is based on
OpenLDAP 2.4.28 (2011-11-25), without providing this private API.

The version query API was introduced around 1998-1999, before
the minimum (2.0 2000-08-01) required by curl.

Follow-up to 3e2a946926853608d67805bd9f4a58345fff364a #19808
Closes #19832

10 days agourl: if curl_url_get() fails due to OOM, error out properly
Daniel Stenberg [Thu, 4 Dec 2025 18:01:02 +0000 (19:01 +0100)] 
url: if curl_url_get() fails due to OOM, error out properly

Even if the scheme is "file"!

Closes #19838

10 days agoCURLMOPT_SOCKETFUNCTION.md: fix the callback argument use
Daniel Stenberg [Thu, 4 Dec 2025 18:57:44 +0000 (19:57 +0100)] 
CURLMOPT_SOCKETFUNCTION.md: fix the callback argument use

The example code does not use curl_multi_assign(), but its callback
function used socketp (called sockp in the function) to get the struct
priv pointer instead of the correct clientp (cbp).

Reported-by: Greg Hudson
Fixes #19840
Closes #19841

10 days agodocs/libcurl: fix C formatting nits
Viktor Szakats [Thu, 4 Dec 2025 19:11:45 +0000 (20:11 +0100)] 
docs/libcurl: fix C formatting nits

Closes #19844

10 days agoopenssl: simplify `HAVE_KEYLOG_CALLBACK` guard
Viktor Szakats [Thu, 4 Dec 2025 19:28:34 +0000 (20:28 +0100)] 
openssl: simplify `HAVE_KEYLOG_CALLBACK` guard

non-LibreSSL always includes BoringSSL and AWS-LC, no need to check for
them explicitly.

Follow-up to 69c89bf3d3137fcbb2b8bc57233182adcf1e2817 #18330
Closes #19843

10 days agombedtls: sync format across log messages
Viktor Szakats [Sat, 29 Nov 2025 09:54:28 +0000 (10:54 +0100)] 
mbedtls: sync format across log messages

Closes #19842

10 days agosws: fix binding to unix socket on Windows
Viktor Szakats [Tue, 2 Dec 2025 16:45:18 +0000 (17:45 +0100)] 
sws: fix binding to unix socket on Windows

Windows 10.17063+ (having unix socket support) fails to set for unix
sockets the `SO_REUSEADDR` option, with error 10045 (`WSAEOPNOTSUPP`),
and also fails to set `SO_KEEPALIVE` with error 10042 (`WSAENOPROTOOPT`).

Fix by not enabling these socket options on Windows for unix sockets.

Also:
- fixing test 1435, 1436 to run in CI.
- fixing the `socksd` test server for test 1467, 1468, 1470. But, also
  disable these for now due to another Windows issue: #19825

Ref: https://stackoverflow.com/questions/68791319/unix-domain-socket-bind-failed-in-windows/68794755#68794755
Ref: #19810
Closes #19812

10 days agotidy-up: miscellaneous
Viktor Szakats [Fri, 21 Nov 2025 11:34:02 +0000 (12:34 +0100)] 
tidy-up: miscellaneous

- gnutls, mbedtls: fix casing in log messages.
- src/tool_cfgable.h: drop unused header.
- appveyor.sh: variable style.
- cmakelint.sh: sync with libssh2, catch `.cmake.in` explicitly.
- examples: drop obsolete comments, exclamation marks.
- fix comment typos, casing.

Closes #19839

10 days agotidy-up: one more round of formatting nits
Viktor Szakats [Sat, 29 Nov 2025 22:11:52 +0000 (23:11 +0100)] 
tidy-up: one more round of formatting nits

Closes #19835

10 days agobadwords: check FAQ with allowlisted 'will', fix a typo
Viktor Szakats [Thu, 4 Dec 2025 16:44:46 +0000 (17:44 +0100)] 
badwords: check FAQ with allowlisted 'will', fix a typo

Also:
- badwords.pl: add support for filename:word exceptions.
- badwords.pl: handle `-w` file open errors.

Ref: https://github.com/curl/curl/pull/19817#issuecomment-3612386568
Closes #19837

10 days agobufref: add Curl_bufref_dup that returns a strdup()ed version
Daniel Stenberg [Thu, 4 Dec 2025 15:39:22 +0000 (16:39 +0100)] 
bufref: add Curl_bufref_dup that returns a strdup()ed version

Cleans up a common pattern somewhat. Implemented as a macro.

Closes #19834

10 days agoconnection: attached transfer count
Stefan Eissing [Thu, 4 Dec 2025 16:15:33 +0000 (17:15 +0100)] 
connection: attached transfer count

Since we no longer traverse the transfers attached to a connection,
change the sparse bitset to just a `uint32_t` counter.

This makes multi_ev the single user of sparse bitsets for transfers
using a socket and allocation failures are handled there correctly.

Refs #19818
Closes #19836

10 days agobufref: rename *memdup() to *memdup0()
Daniel Stenberg [Thu, 4 Dec 2025 15:20:25 +0000 (16:20 +0100)] 
bufref: rename *memdup() to *memdup0()

To make it clearer to readers of the code that the resulting dup also
has a null terminator. Something a "normal" memdup() does not provide.

Closes #19833

10 days agoformdata: use struct bufref for maybe-dynamic fields.
Patrick Monnerat [Wed, 3 Dec 2025 20:52:33 +0000 (21:52 +0100)] 
formdata: use struct bufref for maybe-dynamic fields.

Lengths are not stored in the structures, as they may be given before
the data locations.

Closes #19827

10 days agolib: turn state.referer into a struct bufref
Patrick Monnerat [Wed, 3 Dec 2025 20:13:52 +0000 (21:13 +0100)] 
lib: turn state.referer into a struct bufref

Closes #19827

10 days agolib: turn state.url into a struct bufref
Patrick Monnerat [Wed, 3 Dec 2025 22:15:18 +0000 (23:15 +0100)] 
lib: turn state.url into a struct bufref

Closes #19827

10 days agolib: add a Curl_bufref_uptr() function and use it
Patrick Monnerat [Wed, 3 Dec 2025 17:36:03 +0000 (18:36 +0100)] 
lib: add a Curl_bufref_uptr() function and use it

Function Curl_bufref_ptr() now returns a const char *.
New function Curl_bufref_uptr() returns a const unsigned char *.

Usage and doc updated.

Closes #19827

10 days agoldap: call ldap_init() before setting the options
Daniel Stenberg [Wed, 3 Dec 2025 23:14:20 +0000 (00:14 +0100)] 
ldap: call ldap_init() before setting the options

Closes #19830

10 days agovtls: do not reach into ASN1_STRING
Theo Buehler [Thu, 4 Dec 2025 13:43:18 +0000 (14:43 +0100)] 
vtls: do not reach into ASN1_STRING

OpenSSL 4 has plans to make ASN1_STRING opaque, which will break the
build, so convert the code to use accessors. ASN1_STRING_length() and
ASN1_STRING_type() go way back to SSLeay and ASN1_STRING_get0_data() is
OpenSSL 1.1 API present in BoringSSL since foreer and also available
since LibreSSL 2.7, so this should not cause compat issues with any
libcrypto in a supported version of the fork family.

https://github.com/openssl/openssl/issues/29117

Closes #19831

11 days agoruntests: make memanalyzer a Perl module (for 1.1-2x speed-up per test run)
Viktor Szakats [Wed, 3 Dec 2025 03:42:02 +0000 (04:42 +0100)] 
runtests: make memanalyzer a Perl module (for 1.1-2x speed-up per test run)

Patch #19786 removed an exception, which caused many more CI jobs to run
`memanalyze.pl`. It resulted in a 10-30% (Linux), 15% (macOS), 100% (2x,
on Windows) slowdown of runtest steps. It also made some jobs exceed
their time limits and fail (seen with the Windows ARM64 job.)

Turns out the overhead was caused by calling `memanalyze.pl` as
an external process (twice per test), which in turn had to load a full
Perl stack from scratch each time.

Fix by converting memanalyze to a Perl modul, loaded as part of
`runtests.pl`, which eliminated the overhead completely.

It also sped up existing jobs where memanalyze was run for a long time,
e.g. two c-ares Windows jobs, saving 4.5m per CI run.

Supersedes #19819
Bug: https://github.com/curl/curl/pull/19786#issuecomment-3598679397
Follow-up to fb7033d7600dfb59de06e7af8a0d6ab2a4163578 #19786
Closes #19821

11 days agonoproxy: fix ipv6 handling
Georg Schulz-Allgaier [Wed, 3 Dec 2025 21:49:05 +0000 (22:49 +0100)] 
noproxy: fix ipv6 handling

Closes #19828

11 days agodocs: clarify how to do unix domain sockets with SOCKS proxy
Daniel Stenberg [Thu, 4 Dec 2025 07:45:55 +0000 (08:45 +0100)] 
docs: clarify how to do unix domain sockets with SOCKS proxy

Ref: #19825
Closes #19829

11 days agotest787: fix possible typo `&` -> `%` in curl option
Viktor Szakats [Wed, 3 Dec 2025 16:22:37 +0000 (17:22 +0100)] 
test787: fix possible typo `&` -> `%` in curl option

They are close on the keyboard and don't affect test results.

To make this test XML-compliant.

Ref: #14479
Follow-up to 40c264db617d025ca5053bc0964a185d11101301 #15739
Closes #19826

11 days agotests: add `%AMP` macro, use it in two tests
Viktor Szakats [Tue, 2 Dec 2025 04:05:36 +0000 (05:05 +0100)] 
tests: add `%AMP` macro, use it in two tests

To allow replacing `&` characters in `tests/data/test*` files for
XML-compliance.

Also:
- document `%GT`, `%LT`
  Follow-up to de49cc89abc917cb4f273ebea8c6fb584d097de2 #19470

Closes #19824

11 days agosrc: fix formatting nits
Viktor Szakats [Wed, 3 Dec 2025 14:53:46 +0000 (15:53 +0100)] 
src: fix formatting nits

Closes #19823

11 days agoGHA/checksrc: give more time for slow Azure servers [ci skip]
Viktor Szakats [Wed, 3 Dec 2025 15:32:07 +0000 (16:32 +0100)] 
GHA/checksrc: give more time for slow Azure servers [ci skip]

Sometimes 1 minutes is too short to install 39.4 kB of archives.

Ref: https://github.com/curl/curl/actions/runs/19898949860/job/57036965452

11 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

11 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

12 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

12 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

12 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

12 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

12 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

13 days 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

13 days 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