]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
22 hours agotool_getparam: let --trace-config override -v bagder/trace-verbose 18361/head
Daniel Stenberg [Fri, 22 Aug 2025 14:58:28 +0000 (16:58 +0200)] 
tool_getparam: let --trace-config override -v

If --trace-config is used to set a level before -v is used, don't reset
the state on first -v (to "-all") as it otherwise does. This way,
--trace-config can be used to set specific trace items before -v on the
command line and it still works.

Previously, the first -v use would otherwise reset and undo the earlier
--trace-config items.

Fixes #18346

23 hours agoruntests: show still running tests when nothing has happened for a while
Daniel Stenberg [Fri, 22 Aug 2025 09:44:35 +0000 (11:44 +0200)] 
runtests: show still running tests when nothing has happened for a while

... even if there are tests still pending. To help visualize tests that
might be hanging.

Attempts to set the limit at 10 seconds of silence.

Closes #18349

23 hours agoasyn-thrdd: manage DEFERRED and locks better
Stefan Eissing [Fri, 22 Aug 2025 13:24:04 +0000 (15:24 +0200)] 
asyn-thrdd: manage DEFERRED and locks better

- cancel thread waits until thread start is at least 5ms in the past
  to give it some time to get its cancellation setup in place
- cancel thread without holding the mutex. It's supposed to be an
  async operation, but better be safe
- set DEFERRED cancel state explicitly, should be default in a pthread,
  but better be safe

Closes #18350

23 hours agotop-complexity: maximum accepted set to 72
Daniel Stenberg [Fri, 22 Aug 2025 11:38:57 +0000 (13:38 +0200)] 
top-complexity: maximum accepted set to 72

Down from 80. Show all functions above 60.

Closes #18354

23 hours agotool_urlglob: handle a zero length glob piece
Daniel Stenberg [Fri, 22 Aug 2025 11:30:30 +0000 (13:30 +0200)] 
tool_urlglob: handle a zero length glob piece

Follow-up to 034612cd515f249453a435f3d94b

Add test 759 to verify

Reported-by: Stanislav Osipov
Fixes #18352
Closes #18353

23 hours agoopenssl: remove legacy cruft, document macro guards
Viktor Szakats [Fri, 22 Aug 2025 09:47:50 +0000 (11:47 +0200)] 
openssl: remove legacy cruft, document macro guards

- assume:
  - `BIO_CTRL_EOF`
  - `SSL_CTRL_SET_MSG_CALLBACK`
  - `SSL_CTRL_SET_MSG_CALLBACK`
  - `SSL_CTRL_SET_TLSEXT_HOSTNAME`
  - `SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER`
  - `SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS`
  - `SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG`
  - `SSL_OP_NO_COMPRESSION`
  - `SSL_OP_NO_TICKET`
  - `X509_V_FLAG_PARTIAL_CHAIN`
  - `X509_V_FLAG_TRUSTED_FIRST`
  They are present in all supported OpenSSL (and fork) versions.

- replace `SSL_ERROR_WANT_EARLY` with `SSL_ERROR_WANT_CLIENT_HELLO_CB`.
  The former appeared in OpenSSL 1.1.1-dev, but renamed before
  the stable release.

- document support for macros:
  - `ENGINE_CTRL_GET_CMD_FROM_NAME`
  - `SSL_ERROR_WANT_ASYNC_JOB`
  - `SSL_ERROR_WANT_ASYNC`
  - `SSL2_VERSION_MAJOR`
  - `TLS1_3_VERSION`

- drop legacy fallback for `CONF_MFLAGS_DEFAULT_SECTION`.
  It was there for OpenSSL 0.9.8 support.

- fix `SSL_CTRL_SET_MSG_CALLBACK` accidentally serving as a guard for
  OpenSSL (and forks) as a whole.

Tested OK with OpenSSL 1.0.2 and 1.1.0 in CI.

Closes #18351

23 hours agospelling: file system
Viktor Szakats [Fri, 22 Aug 2025 09:07:50 +0000 (11:07 +0200)] 
spelling: file system

Closes #18348

25 hours agoexamples: make `CURLPIPE_MULTIPLEX` fallback `long`
Viktor Szakats [Fri, 22 Aug 2025 11:50:39 +0000 (13:50 +0200)] 
examples: make `CURLPIPE_MULTIPLEX` fallback `long`

Closes #18356

25 hours agotest1557: pass `long` type to `multi_setopt()`
Viktor Szakats [Fri, 22 Aug 2025 11:45:06 +0000 (13:45 +0200)] 
test1557: pass `long` type to `multi_setopt()`

A wrong type here has seen to manifest in CI failures with gcc-12 macOS.

Ref: https://github.com/curl/curl/pull/18348#issuecomment-3213881790
Ref: https://github.com/curl/curl/actions/runs/17153761944/job/48665734013?pr=18349

Follow-up to b63cce7fee30648e29a0453202f7ba05a01de79c #18339
Follow-up to 88fc6c491f043ed184ea2cf1a17b651427fbbbf5 #18263

Closes #18355

29 hours agoasyn-thrdd: fix --disable-socketpair builds
Stefan Eissing [Fri, 22 Aug 2025 07:58:51 +0000 (09:58 +0200)] 
asyn-thrdd: fix --disable-socketpair builds

Regression from #18339

Reported-by: Marcel Raad
Closes #18347

29 hours agoares: use `ares_strerror()` to retrieve error messages
Stefan Eissing [Mon, 11 Aug 2025 13:58:11 +0000 (15:58 +0200)] 
ares: use `ares_strerror()` to retrieve error messages

Add optional detail to `Curl_resolver_error()` to add to failure message
where available. This makes, for c-ares, the reason for a failed
resource available to the user without extra trace config.

When "dns" tracing enabled, print the c-ares server config at the start
of a resolve.

Closes #18251

30 hours agoasyn-thrdd: remove condition variable
Stefan Eissing [Thu, 21 Aug 2025 19:50:20 +0000 (21:50 +0200)] 
asyn-thrdd: remove condition variable

Add a flag `thrd_don` to assess if the resolving thread has finished and
only destroy the context when *both* ref_count reaches 0 and thrd_done
is true.

Closes #18345

30 hours agoRevert "asyn-thrdd: use condition var more carefully"
Daniel Stenberg [Fri, 22 Aug 2025 07:05:19 +0000 (09:05 +0200)] 
Revert "asyn-thrdd: use condition var more carefully"

This reverts commit bd4622bfaf0929141e6b81653c88ea06e47afe9e.

Not intended for merge!

30 hours agoasyn-thrdd: use condition var more carefully
Stefan Eissing [Thu, 21 Aug 2025 19:19:27 +0000 (21:19 +0200)] 
asyn-thrdd: use condition var more carefully

When the thread started is too fast, the signal will come before the
wait. Add an additional check before the wait to catch the thread
having started or already ended.

Closes #18344

31 hours agoschannel: improve handshake procedure
Jay Satiro [Wed, 20 Aug 2025 06:10:53 +0000 (02:10 -0400)] 
schannel: improve handshake procedure

- During handshake, do not require reading more data if unprocessed
  encrypted data that may be a complete TLS record is already available.

- During handshake, check that the socket is writeable before processing
  encrypted data that may require an immediate reply to the server.

These two fixes are for issues that were found during renegotiation
testing but could affect any handshake.

Prior to this change it was possible in some abnormal network conditions
for the Schannel TLS handshake procedure to erroneously wait or error.

Ref: https://github.com/curl/curl/pull/18125

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

45 hours agoappveyor: drop testing with OpenSSL 1.1.0
Viktor Szakats [Thu, 21 Aug 2025 15:47:03 +0000 (17:47 +0200)] 
appveyor: drop testing with OpenSSL 1.1.0

Replace with 1.1.1.

Follow-up to 12a10ca77cedec4bf6f3cebe5c3a883387ccb0d2 #18337
Cherry-picked from #18330
Closes #18341

45 hours agognutls: fix building with older supported GnuTLS versions
Viktor Szakats [Thu, 21 Aug 2025 10:09:17 +0000 (12:09 +0200)] 
gnutls: fix building with older supported GnuTLS versions

Also:
- GHA/linux-old: switch jobs from OpenSSL 1.0.2 to GnuTLS 3.5.8.

Ref: https://gitlab.com/gnutls/gnutls/blob/master/NEWS
Follow-up to fa0ccd9f1fbbbd77bf50b26e3ba231ea6c729474 #15774
Follow-up to 68bd759c2bfe74799c3355ad29265b795a7e6c62 #15667
Cherry-picked from #18330
Closes #18335

46 hours agoappveyor: drop testing with OpenSSL 1.0.2
Viktor Szakats [Thu, 21 Aug 2025 11:40:05 +0000 (13:40 +0200)] 
appveyor: drop testing with OpenSSL 1.0.2

Cherry-picked from #18330
Closes #18337

46 hours agoasyn-thrdd: addressing stalls in ci
Stefan Eissing [Thu, 21 Aug 2025 12:51:29 +0000 (14:51 +0200)] 
asyn-thrdd: addressing stalls in ci

Disable pthread_cancel in pushed cleanup function. Close wakeup socket
when shutting down resolving, since we no longer want wakeups.

Closes #18339

46 hours agoGHA/non-native: drop MS-DOS jobs, requires OpenSSL 1.0.2
Viktor Szakats [Thu, 21 Aug 2025 11:42:32 +0000 (13:42 +0200)] 
GHA/non-native: drop MS-DOS jobs, requires OpenSSL 1.0.2

Cherry-picked from #18330
Closes #18338

2 days agoappveyor: test openssl with clang-cl
Viktor Szakats [Thu, 21 Aug 2025 08:29:41 +0000 (10:29 +0200)] 
appveyor: test openssl with clang-cl

Cherry-picked from #18330
Closes #18334

2 days agoopenssl: drop redundant version check
Viktor Szakats [Thu, 21 Aug 2025 09:34:21 +0000 (11:34 +0200)] 
openssl: drop redundant version check

It had a typo, but it wasn't causing an issue, because `TLS1_3_VERSION`
is enough to detect this feature and the version check remained unused.

Follow-up to 0d3b5937b38817b6fbd2d60cc178c1df4bd59d0d #16477
Cherry-picked from #18330
Closes #18333

2 days agoruntests: replace `--ci` with `--buidinfo`, show OS/Perl version again
Viktor Szakats [Wed, 20 Aug 2025 18:29:20 +0000 (20:29 +0200)] 
runtests: replace `--ci` with `--buidinfo`, show OS/Perl version again

I figure OS/Perl version may be useful to see in local runs,
and also in CI runs where `--ci` was not set:
https://curl.se/dev/log.cgi?id=20250820041228-707387#prob1

Also, only show a message if the `diff` tool is missing.

Follow-up to 985f39c0ce78b546e832c250588c14023123edfb #18147
Closes #18329

2 days agotests: drop unused `BLANK` envs, unset `CURL_NOT_SET`
Viktor Szakats [Wed, 20 Aug 2025 18:18:34 +0000 (20:18 +0200)] 
tests: drop unused `BLANK` envs, unset `CURL_NOT_SET`

Closes #18328

2 days agotest: add `cygwin` feature and use it (test 1056, 1517)
Viktor Szakats [Wed, 20 Aug 2025 18:00:49 +0000 (20:00 +0200)] 
test: add `cygwin` feature and use it (test 1056, 1517)

To replace custom checks with the same effect.

Closes #18327

2 days agoGHA/http3-linux: test non-unity, and more cmake
Viktor Szakats [Wed, 20 Aug 2025 09:04:18 +0000 (11:04 +0200)] 
GHA/http3-linux: test non-unity, and more cmake

Reshuffle HTTP/3 jobs to:
- test all backends with cmake too. Adding 4 jobs.
- build all backends in non-unity mode too.
  Either with autotools or cmake.
- run tests once for each backend
  Either with autotools or cmake, with a preference for cmake to finish
  faster.
- drop building examples. There is nothing HTTP/3-specific in examples,
  and they are already built in GHA/linux.
- de-dupe some shared settings.

Ref: https://github.com/curl/curl/issues/17857#issuecomment-3047999309
Ref: 8cef6b5e6e40a7e91709c8a552b5987c76ec6909 #18321 #18320
Ref: d79269166eae62a87dd7385bc47c5fb770d1cd95 #18211 #18212
Ref: 454395ba1ecc5be74d982bb4778dc4123bbe0554 #17857 #17864
Ref: b270fec68dc66c7a3d37a283cc147ba3c6fa7297 #17857 #17858

Closes #18325

2 days agowebsocket example: cast print values to unsigned int
Stefan Eissing [Wed, 20 Aug 2025 14:13:20 +0000 (16:13 +0200)] 
websocket example: cast print values to unsigned int

To have not compiler warnings on format checks.

Reported By: Gisle Vanem
Closes #18326

2 days agothreaded-resolver: fix shutdown
Stefan Eissing [Wed, 20 Aug 2025 13:48:20 +0000 (15:48 +0200)] 
threaded-resolver: fix shutdown

Changed strategy to start up and terminate resolver thread.

When starting up:

Start the thread with mutex acquired, wait for signal from thread that
it started and has incremented the ref counter. Thread set
pthread_cancel() to disabled before that and only enables cancelling
during resolving itself. This assure that the ref counter is correct and
the unlinking of the resolve context always happens.

When shutting down resolving:

If ref counting shows thread has finished, join it, free everything. If
thread has not finished, try pthread_cancel() (non Windows), but keep
the thread handle around.

When destroying resolving:

Shutdown first, then, if the thread is still there and 'quick_exit' is
not set, join it and free everything. This might occur a delay if
getaddrinfo() hangs and cannot be interrupted by pthread_cancel().

Destroying resolving happens when another resolve is started on an
easy handle or when the easy handle is closed.

Add test795 to check that connect timeout triggers correctly
when resolving is delayed. Add debug env var `CURL_DNS_DELAY_MS`
to simulate delays in resolving.

Fix test1557 to set `quick_exit` and use `xxx.invalid` as domain
instead of `nothing` that was leading to hangers in CI.

Closes #18263

2 days agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 21 Aug 2025 07:10:41 +0000 (09:10 +0200)] 
RELEASE-NOTES: synced

2 days agoeasy: add 'poll_fds' function to reduce size of 'wait_or_timeout'
Gabriel Marin [Mon, 18 Aug 2025 16:18:31 +0000 (19:18 +0300)] 
easy: add 'poll_fds' function to reduce size of 'wait_or_timeout'

Closes #18313

3 days agotests: delete unused commands
Viktor Szakats [Tue, 19 Aug 2025 14:09:04 +0000 (16:09 +0200)] 
tests: delete unused commands

`runtests.pl` defaults to `-` if a command is not set, since
c43ad0f97283a7e25d61a81b9f9f238432ec494b.

Also:
- drop a stray `</file>`.
- replace a `nothing` with a guaranteed invalid hostname.
  Ref: https://github.com/curl/curl/pull/18263/commits/4334033b43acca9b01ba43e08e611c8654feb84d
- replace unused URLs with `-`.

Closes #18319

3 days agovquic: add header for native-QUIC OpenSSL, non-unity builds
Karthik Das [Wed, 20 Aug 2025 05:51:19 +0000 (11:21 +0530)] 
vquic: add header for native-QUIC OpenSSL, non-unity builds

Follow-up to 7dafe10db2f0b104317e6640670b4cd973a4e3da #18196
Fixes #18320
Closes #18321

3 days agovquic: change some curl_ prefixes
Daniel Stenberg [Wed, 20 Aug 2025 08:15:47 +0000 (10:15 +0200)] 
vquic: change some curl_ prefixes

curl_ and Curl_ are reserved prefixes with special meaning so avoid
using them for file private symbols.

Follow-up to 7dafe10
Closes #18324

3 days agobufq: removed "Useless Assignment"
Daniel Stenberg [Wed, 20 Aug 2025 06:38:57 +0000 (08:38 +0200)] 
bufq: removed "Useless Assignment"

Pointed out by CodeSonar. Made a comment instead.

Closes #18322

3 days agoares: handle channel being destroyed early
Stefan Eissing [Tue, 19 Aug 2025 13:46:34 +0000 (15:46 +0200)] 
ares: handle channel being destroyed early

We are destroying the ares channel already when we shutdown
resolving. Querying the pollset afterwards is still happening,
especially in event based processing and needs to work in the
absence of a channel.

Fixes #18317
Reported-by: Natris on github
Closes #18318

4 days agoGHA/windows: install `Win32::Process*` perl modules
Viktor Szakats [Fri, 15 Aug 2025 17:46:28 +0000 (19:46 +0200)] 
GHA/windows: install `Win32::Process*` perl modules

To make the CI jobs use native Win32 API calls instead of calling
external tools to look up and kill PIDs of native Windows test server
processes.

Follow-up to 2388b0e5878da030fac0e9d1ad490bc5447e37e0 #18308
Closes #18296

4 days agoGHA/non-native: delete OmniOS job
Viktor Szakats [Mon, 18 Aug 2025 22:22:14 +0000 (00:22 +0200)] 
GHA/non-native: delete OmniOS job

It's somewhat flaky, slow (6-8 minutes), needs maintenance, and did not
turn up real issues to justify keeping.

Notably it did not help catch a regression seen on Solaris OS: #16915

Follow-up to 90e644f944969bb11c6448bf50c6d441b5c0b1e6 #13583
Closes #18314

4 days agolibssh2: fix sftp_statemachine busyloop when *block=true
sunriseL [Mon, 18 Aug 2025 11:34:43 +0000 (19:34 +0800)] 
libssh2: fix sftp_statemachine busyloop when *block=true

Closes #18311

4 days agoftp: store dir components as start+len instead of memdup'ing
Daniel Stenberg [Mon, 18 Aug 2025 12:52:13 +0000 (14:52 +0200)] 
ftp: store dir components as start+len instead of memdup'ing

- Avoids allocating every path segment separately
- Improved directory handling in connection reuse

Closes #18312

4 days agoftp: keep the "raw" URL decoded version of the path around
Daniel Stenberg [Mon, 18 Aug 2025 12:11:33 +0000 (14:11 +0200)] 
ftp: keep the "raw" URL decoded version of the path around

Instead of doing temporary decodes in three different places.

Closes #18312

4 days agoprocesshelp.pm: use `Win32::Process*` perl modules if available
Viktor Szakats [Mon, 18 Aug 2025 08:28:42 +0000 (10:28 +0200)] 
processhelp.pm: use `Win32::Process*` perl modules if available

`Win32::Process::List` and `Win32::Process`.

To replace external calls to `tasklist.exe` and `taskkill.exe`.

The perl modules are wrappers/binding to Win32 API calls. They avoid
launching external processes with a command shell (including MSYS2),
the external tool, and creating command-lines and parsing tool output.

According to local tests and the CI, one test session calls
`tasklist.exe` 350-400 times. `taskkill.exe` is rarely called:
https://github.com/curl/curl/actions/runs/17012376726?pr=18296

It's hard to predict any possible side-effect of dynamically loading
the two necessary, module DLLs into the Perl process. The MSYS2 runtime
if prone to fail when doing this in fork operations, as seen earlier
with the Win32.DLL module. But, is looks like a symptom, not the root
cause for these failures, because the failures are present with or
without perl.exe loading the Win32.DLL.
Ref: be01b60ce532af6eb18c11fbd565355dbb570a2e #18287

Cherry-picked from #18296
Closes #18308

4 days agoasyn-thrdd: silence unused parameter warning
Marcel Raad [Mon, 18 Aug 2025 07:48:12 +0000 (09:48 +0200)] 
asyn-thrdd: silence unused parameter warning

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

4 days agoGHA: update vmactions/omnios-vm digest to c31844c
renovate[bot] [Sun, 17 Aug 2025 11:31:33 +0000 (11:31 +0000)] 
GHA: update vmactions/omnios-vm digest to c31844c

Closes #18302

5 days agoGHA/windows: switch from MSBuild to Ninja for MSVC jobs running tests
Viktor Szakats [Sun, 17 Aug 2025 08:46:22 +0000 (10:46 +0200)] 
GHA/windows: switch from MSBuild to Ninja for MSVC jobs running tests

This patch fixes flakiness caused by MSBuild scanning the runtests.pl
output for regex patterns. When finding a hit, it returns an error code
to cmake, making the build test CI step fail. This happens rarely after
an earlier mitigation tweaking outputs, but, as expected, it did not
resolve it completely.

MSBuild doesn't have an option to disable this behavior. To fix, this
patch migrates the two affected jobs from MSBuild to Ninja. To align
with existing multi-config logic, it uses the `Ninja Multi-Config`
generator, which hasn't been tested before in CI.

Switching to Ninja was not trivial. Visual Studio to this day relies on
an MS-DOS batch file stored at an unstable location (containing spaces
and parenthesis), to initialize its environment. Without this env,
`cl.exe` is unable to find its own components. GHA does not initialize
it (even if it did, it could only default to a single specific target).
CMake helps with this when using a Visual Studio generator, but doesn't
when using Ninja. (On local machines the VS installer adds a couple
of Start menu items for launching pre-configured command prompts.)

Ref: https://learn.microsoft.com/cpp/build/building-on-the-command-line

The MS-DOS batches don't integrate well with CI envs and even less so
with shell scripts. To avoid it, this patch uses manual configuration.
Also without using environment variables, to make it easy to use and
easy to debug and trace in logs. Configuring Visual Studio is relatively
stable across releases and hasn't changed a whole lot in the last 2
decades, but still may need more maintenance compared to llvm, or pretty
much any other toolchain out there. On the upside, it allows to manually
select compiler version, SDK version, cross-combinations, and allows
choosing clang-cl. The configuration aims to find the latest of these
automatically.

Some traps that had to be avoided:
- need to switch to MS-DOS short names to avoid spaces in the VS
  component paths.
- need to switch to forward slashes to avoid confusing downstream tools
  with backslashes.
- need to pass either MSYS2 for Windows-style path depending on setting.
- need to use a trick to retrieve the oddly named `ProgramFiles(x86)`
  Windows env from shell script.
- need to match VS version (2022) and edition (Enterprise), found on GHA
  runners.
- need to pass the CMake generator via env so that the space in the name
  doesn't trip the shell when passed via a variable.
- trash and unexpected dirs when detecting SDK/toolchain versions.
- need to pass `-external:W0` to the C compiler to avoid MSVC warning:
  `D9007: '/external:I' requires '/external:W'; option ignored`
- using cmake options only, to make it run without relying on envs and
  work out-of-the-box when running subsequent cmake sessions.
- some others discovered while making work clang-cl locally in
  cross-builds.

Ninja also improves performance in most cases (though wasn't a goal
here). After this patch configure is significantly faster (1.5-2x),
builds are a tiny bit faster, except examples which was twice as fast
with MSBuild. Disk space use is 10% lower.

MSBuild builds remain tested in AppVeyor CI and the UWP job.

Before: https://github.com/curl/curl/actions/runs/17025737223/job/48260856051
After: https://github.com/curl/curl/actions/runs/17027981486/job/48266133301

Fixes:
```
  === Start of file stderr1635
     % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                    Dload  Upload   Total   Spent    Left  Speed

     0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
   100     4  100     4    0     0    449      0 --:--:-- --:--:-- --:--:--   500
curl : (22) The requested URL returned error : 429 [D:\a\curl\curl\bld\tests\test-ci.vcxproj]
CUSTOMBUILD : warning : Problem : HTTP error. Will retry in 1 second. 1 retry left. [D:\a\curl\curl\bld\tests\test-ci.vcxproj]
[...]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'D:\a\curl\curl\bld\CMakeFiles\621f80ddbb0fa48179f056ca77842ff0\test-ci.rule;D:\a\curl\curl\tests\CMakeLists.txt' exited with code -1. [D:\a\curl\curl\bld\tests\test-ci.vcxproj]
Error: Process completed with exit code 1.
```
Ref: https://github.com/curl/curl/actions/runs/16966304797/job/48091058271?pr=18287#step:13:3471

Bug: https://github.com/curl/curl/discussions/14854#discussioncomment-14104166
Ref: a19bd4321030c6ea18e3bbec411dfd49961a1f71 #18307
Follow-up to 9463769f2e2dba9eeff554a88e5df5195d2c774b #16583

Closes #18301

5 days agongtcp2: use custom mem funcs
David Zhuang [Wed, 6 Aug 2025 00:45:06 +0000 (17:45 -0700)] 
ngtcp2: use custom mem funcs

Pass curl's memory functions to the nghttp3 and ngtcp2 functions that
allow them. This allows custom memory functions passed by the curl user
to be used in nghttp3 and ngtcp2.

Closes #18196

5 days agoasyn-thrdd: fix Curl_async_pollset without socketpair
Daniel Stenberg [Mon, 18 Aug 2025 07:54:50 +0000 (09:54 +0200)] 
asyn-thrdd: fix Curl_async_pollset without socketpair

- remove a superfluous if()
- edit the #ifdef to only do the timeout checks when socketpair support
  is missing, as that code flow could not be reached otherways anyway

CodeSonar pointed out possible issue that led me to see this.

Closes #18306

5 days agoGHA/windows: tidy up running find in two build steps
Viktor Szakats [Mon, 18 Aug 2025 09:18:09 +0000 (11:18 +0200)] 
GHA/windows: tidy up running find in two build steps

Cherry-picked from #18301

5 days agocmake: honor `CMAKE_C_FLAGS` in test 1119 and 1167
Viktor Szakats [Mon, 18 Aug 2025 08:19:45 +0000 (10:19 +0200)] 
cmake: honor `CMAKE_C_FLAGS` in test 1119 and 1167

`CMAKE_C_FLAGS` is not set by curl, but may contain custom options
required for a successful compiler run, when invoked by these tests.

One such case is when configuring Visual Studio or clang-cl via compiler
options, instead of envs.

Cherry-picked from #18301
Closes #18307

5 days agobufq: simplify condition
Daniel Stenberg [Mon, 18 Aug 2025 07:41:00 +0000 (09:41 +0200)] 
bufq: simplify condition

'result' is always CURLE_AGAIN here

Pointed out by CodeSonar

Closes #18305

5 days agoftp: use 'conn' instead of 'data->conn'
Daniel Stenberg [Mon, 18 Aug 2025 07:32:21 +0000 (09:32 +0200)] 
ftp: use 'conn' instead of 'data->conn'

In the ftp_state_use_port function, as we already use that local
variable for all other conn accesses.

Closes #18304

5 days agoRELEASE-NOTES: synced rc-8_16_0-1
Daniel Stenberg [Sun, 17 Aug 2025 20:56:48 +0000 (22:56 +0200)] 
RELEASE-NOTES: synced

5 days agotest1549: verify CURLOPT_COOKIEFILE after expired cookies
Daniel Stenberg [Sun, 17 Aug 2025 20:24:10 +0000 (22:24 +0200)] 
test1549: verify CURLOPT_COOKIEFILE after expired cookies

Verifies #18299 (de89b86046ee)
Closes #18303

5 days agocookie: remove expired cookies before listing
xfangfang [Sat, 16 Aug 2025 10:15:42 +0000 (18:15 +0800)] 
cookie: remove expired cookies before listing

Closes #18299

8 days agoopenssl: auto-pause on verify callback retry
Stefan Eissing [Thu, 14 Aug 2025 12:12:54 +0000 (14:12 +0200)] 
openssl: auto-pause on verify callback retry

When an application install its own OpenSSL verify callback and that
callback invokes `SSL_set_retry_verify()`, the transfer is automatically
paused and does not progress the connect attempt any further until
unpaused via `curl_easy_pause().

Added test758 to verify.

Ref: #18284
Original PR by @Natris
Bug: https://curl.se/mail/lib-2025-08/0012.html
Closes #18288

8 days agosendf: getting less data than "max allowed" is okay
Daniel Stenberg [Fri, 15 Aug 2025 07:23:33 +0000 (09:23 +0200)] 
sendf: getting less data than "max allowed" is okay

Easily triggered when doing an FTP ranged download with the end range
larger than the file size.

A regression since 30de937bda0 (shipped in curl 8.9.0)

Add test 2307 to verify.

Reported-by: kupavcevdenis on github
Fixes #18283
Closes #18295

8 days agoCURLOPT_SSL_CTX_*: replace the base64 with XXXX
Daniel Stenberg [Tue, 12 Aug 2025 09:24:32 +0000 (11:24 +0200)] 
CURLOPT_SSL_CTX_*: replace the base64 with XXXX

- they are fake anyway
- these ones look more obvious fake and in need of replacement
- avoids the risk that they might decode to something of value

Closes #18261

8 days agodocs/examples: remove spurious trailing backslashes
Daniel Stenberg [Thu, 14 Aug 2025 14:27:06 +0000 (16:27 +0200)] 
docs/examples: remove spurious trailing backslashes

Unnecessary clutter

Follow-up to d06b49d8b2d42d477f7e785960

Closes #18289

8 days agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 15 Aug 2025 07:29:47 +0000 (09:29 +0200)] 
RELEASE-NOTES: synced

8 days agoGHA/linux: skip building examples in valgrind jobs
Viktor Szakats [Thu, 14 Aug 2025 18:28:14 +0000 (20:28 +0200)] 
GHA/linux: skip building examples in valgrind jobs

To make these long jobs finish a little bit faster.

10s in total for 5 cmake jobs, 11s for 1 autotools job.

Closes #18291

8 days agoGHA/linux: try improving valgrind job times with cmake
Viktor Szakats [Thu, 14 Aug 2025 14:45:15 +0000 (16:45 +0200)] 
GHA/linux: try improving valgrind job times with cmake

Make the:
- mbedTLS valgrind job finish under 14m, vs 15m before.
- OpenSSL -O3 valgrind job finish in 14m30, vs 16m17.
- OpenSSL libssh2 valgrind job finish in 16m, vs 17m30.
- long valgrind rustls job finish 1 minute earlier, in return
  for spending 30s more on the other rustls job.

Keep using autotools for the less slow valgrind job to test this combo.

Closes #18290

8 days agoruntests: assume `Time::HiRes`, drop Perl Win32 dependency
Viktor Szakats [Thu, 14 Aug 2025 11:36:04 +0000 (13:36 +0200)] 
runtests: assume `Time::HiRes`, drop Perl Win32 dependency

`Time::HiRes` was already used unconditionally before this patch in
`servers.pm`. This package, and functions used by runtests (`sleep` and
`gettimeofday`) are supported by the minimum Perl version required for
curl:

https://perldoc.perl.org/5.8.0/Time::HiRes

- Drop the `portable_sleep()` wrapper in favor of `Time::HiRes::sleep()`.
- Use `Time::HiRes` unconditionally in `serverhelp.pm`.
- Stop using the `Win32` package where available. It was included
  to provide a Windows fallback for `Time::HiRes::sleep()`. It was never
  actually called, but the dependency may have loaded `Win32.dll`, which
  often appears in failed fork operations in GHA logs.
  Ref: a6fed41f6f12f3b71cfe85609f02a294b972d3d3 #5054 #5034
  Ref: https://github.com/curl/curl/discussions/14854

Closes #18287

9 days agoprocesshelp.pm: fix to use the correct null device on Windows
Viktor Szakats [Thu, 14 Aug 2025 08:44:43 +0000 (10:44 +0200)] 
processhelp.pm: fix to use the correct null device on Windows

To not create a file named `nul` in the `tests` directory when running
tests with MSYS2/Cygwin Perl (the only supported Perl for Windows).

I imagine this may cause issues when being written in parallel. Also
`nul` is a reserved filename on Windows.

Closes #18282

9 days agombedtls: check for feature macros instead of version
Viktor Szakats [Wed, 13 Aug 2025 08:20:10 +0000 (10:20 +0200)] 
mbedtls: check for feature macros instead of version

Drop three interim macros and mbedTLS version checks in favor of feature
macros defined by mbedTLS itself.

These mbedTLS features require mbedTLS 3.6.0/3.6.1 for production.
Earlier versions may have partial/experimental support for them,
disabled by default and (AFAICS) without documented build options
to enable them.

One feature guard already used the native macro instead of the interim
one before this patch. (`MBEDTLS_SSL_SESSION_TICKETS`)

Ref: https://github.com/curl/curl/pull/18254#issuecomment-3182668817

Closes #18271

9 days agoDockerfile: update debian:bookworm-slim Docker digest to b1a7414
renovate[bot] [Wed, 13 Aug 2025 13:05:56 +0000 (13:05 +0000)] 
Dockerfile: update debian:bookworm-slim Docker digest to b1a7414

Closes #18270

9 days agowolfssh: move the sftp upload init out of the state machine
Daniel Stenberg [Wed, 13 Aug 2025 21:44:31 +0000 (23:44 +0200)] 
wolfssh: move the sftp upload init out of the state machine

Into its own function to reduce complexity. Takes complexity down from
72 to 50.

Closes #18278

9 days agosocks5: split out two functions from the SOCKS5 state machine
Daniel Stenberg [Wed, 13 Aug 2025 21:26:57 +0000 (23:26 +0200)] 
socks5: split out two functions from the SOCKS5 state machine

Complexity down from 74 to 59

Closes #18277

9 days agoopenssl: save and restore OpenSSL error queue in two functions
Viktor Szakats [Fri, 8 Aug 2025 22:45:34 +0000 (00:45 +0200)] 
openssl: save and restore OpenSSL error queue in two functions

After merging #18228, I reviewed whether the clearing of the error queue
may interfere with preceding code. Turns out there may be a preceding
`SSL_Connect()` call.

This patch replaces the previous fix of clearing the error queue with
saving and restoring it in two functions which may be called between
the connect call and the `SSL_get_error()` call following it:
- `ossl_log_tls12_secret()`
- `Curl_ssl_setup_x509_store()`

The `ERR_set_mark()`, `ERR_pop_to_mark()` functions are present in all
supported OpenSSL and LibreSSL versions. Also in BoringSSL since its
initial commit.

OpenSSL may modify its error queue in all API calls that can fail.

Thanks-to: Viktor Dukhovni
Ref: https://github.com/curl/curl/issues/18190#issuecomment-3167702142
Ref: https://github.com/curl/curl/issues/18190#issuecomment-3169211739
Ref: https://github.com/curl/curl/issues/18190#issuecomment-3169988050

Follow-up to 8ec241bc990bc88c4f4f7275d81f9fb75b562a7a #18228 #18190
Ref: e8b00fcd6a0c7ff179cebb3615ccebf1f6790b69 #10432 #10389
Fixes #18190
Closes #18234

9 days agoGHA/linux: fix thread sanitizer error output
Viktor Szakats [Wed, 13 Aug 2025 13:14:31 +0000 (15:14 +0200)] 
GHA/linux: fix thread sanitizer error output

Replace autotools with cmake to avoid libtool wrappers that are changing
`LD_LIBRARY_PATH` in a way incompatible with the thread sanitizer.

To fix the output when the sanitizier is finding something:
```
==51718==WARNING: Can't write to symbolizer at fd 7
 /usr/bin/llvm-symbolizer-18: /home/runner/work/curl/curl/bld/lib/.libs/libcurl.so.4: no version information available (required by /usr/bin/llvm-symbolizer-18)
 /usr/bin/llvm-symbolizer-18: symbol lookup error: /home/runner/openssl/lib/libcrypto.so.3: undefined symbol: __tsan_func_entry
```
Ref: https://github.com/curl/curl/actions/runs/16911402500/job/47913783729#step:39:4466

After:
```
 13:50:04.117885 == Info:ThreadSanitizer: thread T1  finished with ignores enabled, created at:
  closing connection #0
     #0 pthread_create <null> (libtests+0x6bc0f) (BuildId: 4fe889446291259934205ac03931c397aa0210d3)
     #1 Curl_thread_create /home/runner/work/curl/curl/lib/curl_threads.c:73:6 (libcurl.so.4+0x55a76) (BuildId: cb0f14ba2ad68c9cab0c980d9a5d7a53cc0782da)
     #2 async_thrdd_init /home/runner/work/curl/curl/lib/asyn-thrdd.c:500:26 (libcurl.so.4+0x1c153) (BuildId: cb0f14ba2ad68c9cab0c980d9a5d7a53cc0782da)
[...]
```
Ref: https://github.com/curl/curl/actions/runs/16939193922/job/48003405272?pr=18274#step:39:4018

Also:
- disable memory tracker which turned out to be incompatible with
  the thread sanitizer and detaching threads.
  Ref: #18263 and #curl IRC.
- the job is ~30 seconds faster after this patch.

Reported-by: Stefan Eissing
Bug: https://github.com/curl/curl/pull/18263#issuecomment-3179279440
Follow-up to a2bcec0ee0895c23b98aea8e72ad4e9278fa67c8 #14751
Closes #18274

10 days agoCURLOPT_HTTP_VERSION: mention new default value
Jelle Raaijmakers [Wed, 13 Aug 2025 10:18:38 +0000 (12:18 +0200)] 
CURLOPT_HTTP_VERSION: mention new default value

Fixes #18272
Cloes #18273

10 days agombedtls: bump minimum version required to 3.2.0
Viktor Szakats [Mon, 11 Aug 2025 16:31:30 +0000 (18:31 +0200)] 
mbedtls: bump minimum version required to 3.2.0

3.2.0 was released on July 11, 2022.

Ref: #18161
Closes #18254

10 days agoGHA: update awslabs/aws-lc to v1.58.0
renovate[bot] [Tue, 12 Aug 2025 23:01:50 +0000 (23:01 +0000)] 
GHA: update awslabs/aws-lc to v1.58.0

Closes #18269

10 days agoDockerfile: update debian:bookworm-slim Docker digest to 135c31f
renovate[bot] [Tue, 12 Aug 2025 23:01:46 +0000 (23:01 +0000)] 
Dockerfile: update debian:bookworm-slim Docker digest to 135c31f

Closes #18268

10 days agocookie: don't treat the leading slash as trailing
Daniel Stenberg [Mon, 11 Aug 2025 18:23:05 +0000 (20:23 +0200)] 
cookie: don't treat the leading slash as trailing

If there is only a leading slash in the path, keep that. Also add an
assert to make sure the path is never blank.

Reported-by: Google Big Sleep
Closes #18266

11 days agoexamples: remove href_extractor.c
Daniel Stenberg [Tue, 12 Aug 2025 11:45:10 +0000 (13:45 +0200)] 
examples: remove href_extractor.c

The library this seems to refer to is no longer there.

Closes #18264

11 days agocmake: improve error message for invalid HTTP/3 MultiSSL configs
Viktor Szakats [Mon, 11 Aug 2025 21:47:03 +0000 (23:47 +0200)] 
cmake: improve error message for invalid HTTP/3 MultiSSL configs

Error out for these combinations before trying to detect HTTP/3
dependencies, for a clearer error message.

Reported-by: Daniel Engberg
Fixes https://github.com/curl/curl/issues/18246
Closes https://github.com/curl/curl/issues/18256

11 days agoGHA: update actions/checkout action to v5
renovate[bot] [Mon, 11 Aug 2025 22:39:24 +0000 (22:39 +0000)] 
GHA: update actions/checkout action to v5

Closes https://github.com/curl/curl/issues/18250

11 days agoexamples: remove base64 encoded chunks from examples
Daniel Stenberg [Tue, 12 Aug 2025 08:56:23 +0000 (10:56 +0200)] 
examples: remove base64 encoded chunks from examples

Replace them with dummy XXXX sequences instead, as they were not working
anyway.

Closes #18260

11 days agoURL-SYNTAX.md: drop link to codepoints.net to pass linkcheck
Viktor Szakats [Tue, 12 Aug 2025 07:58:13 +0000 (09:58 +0200)] 
URL-SYNTAX.md: drop link to codepoints.net to pass linkcheck

The link works in a browser, but started failing the `mdlinkcheck` test:
```
check https://codepoints.net/U+00DF
FAIL
docs/URL-SYNTAX.md:199 ERROR links to missing URL https://codepoints.net/U+00DF
```
Ref: https://github.com/curl/curl/actions/runs/16902543407/job/47884625446?pr=18254#step:3:22

Closes #18259

11 days agoCI: update libstdc++ for linux-old build
Dan Fandrich [Mon, 11 Aug 2025 20:36:22 +0000 (13:36 -0700)] 
CI: update libstdc++ for linux-old build

actions/checkout@v5 requires a newer libstdc++ than the container
contains. Update it to a backwards-compatible version just like we
already do for libc6.

Ref: #18250
Closes #18255

11 days agoGHA/curl-for-win: libssh.org is down, switch to libssh2
Viktor Szakats [Mon, 11 Aug 2025 21:58:18 +0000 (23:58 +0200)] 
GHA/curl-for-win: libssh.org is down, switch to libssh2

Closes #18257

11 days agowebsocket: support CURLOPT_READFUNCTION
Stefan Eissing [Tue, 8 Jul 2025 07:15:43 +0000 (09:15 +0200)] 
websocket: support CURLOPT_READFUNCTION

Add support for CURLOPT_READFUNCTION with WebSocket urls when *not* in
connect-only mode, e.g. when using curl_multi_perform.

Install the callback function and set CURLOPT_UPLOAD. Return
CURL_READFUNC_PAUSE when having nothing more to send and unpause the
transfer when more data is ready.

This will send the read bytes in a WebSocket BINARY frame.

Add support for this mode in the pytest "ws_data" client and have all
tests run in 'curl_ws_send/recv' and 'peform' mode as well.

Add `curl_ws_start_frame()`. Document, cover in libcurl-ws.md and
explain the READFUNCTION mode for websockets.

Add example `websocket-updown` for this.

Closes #17683

11 days agoTODO: remove session export item
Dan Fandrich [Sun, 10 Aug 2025 05:27:41 +0000 (22:27 -0700)] 
TODO: remove session export item

This was implemented in #15924

Ref: #15924
Closes #18243

12 days agoGHA: update actions/checkout digest to 08eba0b
renovate[bot] [Mon, 11 Aug 2025 12:36:00 +0000 (12:36 +0000)] 
GHA: update actions/checkout digest to 08eba0b

Closes #18249

12 days agoresolving: dns error tracing
Stefan Eissing [Mon, 11 Aug 2025 09:39:03 +0000 (11:39 +0200)] 
resolving: dns error tracing

* Add more tracing information to c-ares errors.
* remove CURL_ASYNC_SUCCESS, rename `ares->last_status` to
  `ares->ares_status`. Give trace explanation for "common"
  errors
* add ares "csv" information to tracing on failure
* DoH: invoke `Curl_resolver_error()` on failure to populate
  error buf

Closes #18247

12 days agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 11 Aug 2025 07:40:44 +0000 (09:40 +0200)] 
RELEASE-NOTES: synced

12 days agotool_cb_wrt: stop alloc/free for every chunk windows console output
Daniel Stenberg [Fri, 8 Aug 2025 20:56:47 +0000 (22:56 +0200)] 
tool_cb_wrt: stop alloc/free for every chunk windows console output

Instead realloc to the largest buffer and keep that for reuse during the
entire lifetime.

Co-authored-by: Jay Satiro <raysatiro@yahoo.com>
Closes #18233

13 days agotest436: fix running on Windows with `_curlrc` present
Viktor Szakats [Sat, 9 Aug 2025 18:28:15 +0000 (20:28 +0200)] 
test436: fix running on Windows with `_curlrc` present

in the user home directory.

Before this patch, the curl tool found the system curlrc first, ignoring
the custom one set by the test via `CURL_HOME`.

Closes #18242

13 days agocmake: set `CURL_DIRSUFFIX` automatically in multi-config builds
Viktor Szakats [Sat, 9 Aug 2025 15:36:40 +0000 (17:36 +0200)] 
cmake: set `CURL_DIRSUFFIX` automatically in multi-config builds

To make it easier to run tests when using the Visual Studio generator,
also perhaps Xcode.

Also drop manual settings from CI.

Closes #18241

2 weeks agocmake: drop redundant unity mode for `curlinfo`
Viktor Szakats [Sat, 9 Aug 2025 11:20:23 +0000 (13:20 +0200)] 
cmake: drop redundant unity mode for `curlinfo`

Unity mode adds nothing besides some overhead and log noise for
targets built from a single source file.

I wish cmake disabled unity automatically in this case.

Closes #18238

2 weeks agocmake: optimize building examples in CI
Viktor Szakats [Wed, 6 Aug 2025 20:17:50 +0000 (22:17 +0200)] 
cmake: optimize building examples in CI

In CI we want to ensure that examples build cleanly, but we don't want
to actually run them there. Meaning it's enough to just compile, but not
link them in CI. Saving time up to 2-4x (MSVC), and disk space up
to 1.2GB (or 8-70x).

Add a new cmake target that compiles all examples without linking them
into runnable binaries. Keep a full build for a single example to test
if it links correctly.

Also:
- CI: switch over all `curl-examples` targets to `curl-examples-build`
- GHA/linux-old: build examples in one of the cmake builds.

Result highlights:

Job                 | Bef. |  Bef. | Aft. | Aft. |
:------------------ | ---: | ----: | ---: |----: |
cygwin              |  15s |   9MB |  10s |  1MB |
msys                |  13s |   8MB |   7s |  1MB |
dl-mingw 15         |  39s |  113M |  34s |  2MB |
dl-mingw 9.5.0      |  49s | 115MB |  42s |  2MB |
dl-mingw 7.3.0      |  19s | 113MB |  14s |  2MB |
dl-mingw 6.4.0      |   9s |  12MB |   7s |  4MB |
Linux cross         |  19s |  28MB |  19s |  2MB |
MSVC UWP            |  65s | 374MB |   9s | 17MB |
MSVC x64            |  22s | 846MB |   9s | 17MB |
VS2010              |  48s | 105MB |  15s |  9MB |
VS2022 clang-cl     | 195s | 1.2GB |  51s | 20MB |
iOS Xcode           |   8s |       |   5s |      |
macOS LibreSSL      |  16s |       |  11s |      |
Linux aws-lc        |   3s |       |   1s |      |

Follow-up to dda251ef1020da07dc4640a225e01051cb977535 #18232

Closes #18209

2 weeks agoappveyor: show disk space used in each job
Viktor Szakats [Fri, 8 Aug 2025 23:27:51 +0000 (01:27 +0200)] 
appveyor: show disk space used in each job

Also bump minimum dir size in GHA, to reduce details.

Follow-up to be71475b1313ff017acc1efab16e0fea84cd32f5 #18150
Closes #18235

2 weeks agocmake: define `WIN32_LEAN_AND_MEAN` for examples
Viktor Szakats [Fri, 8 Aug 2025 20:25:01 +0000 (22:25 +0200)] 
cmake: define `WIN32_LEAN_AND_MEAN` for examples

To build faster. Also syncing with autotools.

Job                 | Before | After |
:------------------ | -----: | ----: |
dl-mingw 15         |    45s |   39s |
dl-mingw 9.5.0      |    72s |   49s |
dl-mingw 7.3.0      |    29s |   19s |
dl-mingw 6.4.0      |    20s |    9s |
Linux cross         |    30s |   19s |
MSVC UWP            |    77s |   65s |
MSVC x64            |    27s |   22s |
VS2010              |    61s |   48s |
VS2022 clang-cl     |   226s |  195s |

It also happens to fix what looks like a Windows SDK header bug seen
with VS2019 on AppVeyor CI:
```
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\winscard.h(1422,1): error C2220: the following warning is treated as an error (compiling source file C:\projects\curl\docs\examples\block_ip.c)
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\winscard.h(1422,1): warning C5031: #pragma warning(pop): likely mismatch, popping warning state pushed in different file (compiling source file C:\projects\curl\docs\examples\block_ip.c)
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\winioctl.h : message : #pragma warning(push) (compiling source file C:\projects\curl\docs\examples\block_ip.c)
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\windows.h(254,17): warning C5031: #pragma warning(pop): likely mismatch, popping warning state pushed in different file (compiling source file C:\projects\curl\docs\examples\block_ip.c)
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\winscard.h : message : #pragma warning(push) (compiling source file C:\projects\curl\docs\examples\block_ip.c)
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\winsock2.h(4221,1): warning C5031: #pragma warning(pop): likely mismatch, popping warning state pushed in different file (compiling source file C:\projects\curl\docs\examples\block_ip.c)
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\windows.h : message : #pragma warning(push) (compiling source file C:\projects\curl\docs\examples\block_ip.c)
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\winsock2.h : warning C5032: detected #pragma warning(push) with no corresponding #pragma warning(pop) (compiling source file C:\projects\curl\docs\examples\block_ip.c)
```
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/52531106/job/66b6r098pll2le70#L312

Closes #18232

2 weeks agoopenssl: clear errors after a failed `d2i_X509()`
Viktor Szakats [Fri, 8 Aug 2025 11:07:34 +0000 (13:07 +0200)] 
openssl: clear errors after a failed `d2i_X509()`

Without it, subsequent OpenSSL API calls may fail with an error caught
within the OpenSSL `d2i_X509()` (decode) call.

It was seen to happen when importing from the Windows certificate store
(e.g. with `--ca-native`), and any one of the certificates failed while
decoding, then skipped.

Behind the scene (and undocumented), the failed decode call is adding
an error to an internal OpenSSL error queue. This error is picked up
later, at the connect phase, by another OpenSSL API call, which happens
to check the error queue, without clearing it first. It made the connect
fail with the error collected earlier, while decoding the malformed and
discarded certificate.

Fix by explicitly clearing the error queue if the decode call fails.

Ref: https://docs.openssl.org/3.5/man3/d2i_X509/

`-vvvv` output before this patch:
```
[0-0] == Info: successfully imported Windows ROOT store
[0-0] == Info: successfully imported Windows CA store
[0-0] == Info: [SSL] SSL_connect() -> err=-1, detail=1
[0-0] == Info: TLS connect error: error:068000DD:asn1 encoding routines::illegal padding
[0-0] == Info: [SSL] cf_connect() -> 35, done=0
```

Mainline OpenSSL (as of 3.5.2) and quictls (as of 3.3.0) are affected.

LibreSSL is not affected. (I did not test BoringSSL and AWS-LC)

Assisted-by: Stefan Eissing
Reported-by: MichaƂ Petryka
Fixes #18190

Closes #18228

2 weeks agotool_parsecfg: use dynbuf for quoted arguments
Daniel Stenberg [Fri, 8 Aug 2025 15:41:30 +0000 (17:41 +0200)] 
tool_parsecfg: use dynbuf for quoted arguments

Instead of doing malloc/free every time and "manual" buffer population.
This reuses the dynbuf for this purpose for the duration of parsing the
file.

Closes #18230

2 weeks agotool_operate: cleanups
Daniel Stenberg [Thu, 7 Aug 2025 21:11:10 +0000 (23:11 +0200)] 
tool_operate: cleanups

- move the state struct from config to global. It is used as a single
  instance anyway so might as well be a single one to save memory.
- simplify and combine several conditions
- set default retry delay inititally
- use better struct field names to make it easier to understand their
  purposes
- remove the state->outfiles field as it was not necessary
- remove superfluous glob cleanup call
- move conditions around to remove an indent level
- move the ->url NULL check

Takes single_transfer()'s complexity score down from 78 to 68.

Closes #18226

2 weeks agotool_writeout: check gmtime return code too
Daniel Stenberg [Fri, 8 Aug 2025 07:24:46 +0000 (09:24 +0200)] 
tool_writeout: check gmtime return code too

If the unlikely event happen that it fails, it returns NULL.
CodeSonar is not happy unless we check for it.

Closes #18225

2 weeks agoschannel: add an error message for client cert not found
Jay Satiro [Thu, 31 Jul 2025 19:13:23 +0000 (15:13 -0400)] 
schannel: add an error message for client cert not found

Prior to this change curl would show the generic error message
"curl: (58) Problem with the local SSL certificate".

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

2 weeks agoGHA: update cloudflare/quiche to v0.24.5
renovate[bot] [Thu, 7 Aug 2025 21:02:40 +0000 (21:02 +0000)] 
GHA: update cloudflare/quiche to v0.24.5

Closes #18224

2 weeks agoGHA: update actions/cache digest to 0400d5f
renovate[bot] [Thu, 7 Aug 2025 14:22:00 +0000 (14:22 +0000)] 
GHA: update actions/cache digest to 0400d5f

Closes #18222

2 weeks agocurl: remove first argument from helpf()
Daniel Stenberg [Thu, 7 Aug 2025 14:12:44 +0000 (16:12 +0200)] 
curl: remove first argument from helpf()

It was always the same and it is a global already!

Closes #18221