]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
2 months 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

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

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

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

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

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

2 months agoRELEASE-NOTES: synced
Daniel Stenberg [Sun, 17 Aug 2025 20:56:48 +0000 (22:56 +0200)] 
RELEASE-NOTES: synced

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

3 months 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

3 months 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

3 months 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

3 months 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

3 months 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

3 months 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

3 months 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

3 months 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

3 months 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

3 months 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

3 months 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

3 months 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

3 months agotool_writeout: check strftime() return code
Daniel Stenberg [Thu, 7 Aug 2025 13:43:25 +0000 (15:43 +0200)] 
tool_writeout: check strftime() return code

Because if it fails, the contents of the output buffer is undefined.

Pointed out by CodeSonar

Also polished the documentation

Follow-up to fadc487567

Closes #18220

3 months agocfilters: make Curl_conn_get_socket simpler
Stefan Eissing [Thu, 7 Aug 2025 12:18:59 +0000 (14:18 +0200)] 
cfilters: make Curl_conn_get_socket simpler

Since it is only used for the first socket anyway, simplify the
function.

Closes #18219

3 months agorequest: eliminate request `getheader` bool, reverse `header` default
Stefan Eissing [Thu, 7 Aug 2025 09:29:10 +0000 (11:29 +0200)] 
request: eliminate request `getheader` bool, reverse `header` default

Deduce that the transfer response expects headers by the protocol
handler implementing `write_resp_hd` callback. This eleminates the
`getheader` parameter in the `Curl_xfer_setup_*()` methods.

Add an implementation to RTSP for `write_resp_hd`, joining the HTTP
protocol in the only handlers having it.

Reverse the default of request's `header` bit that signals that headers
are expected. Default is now FALSE, set to TRUE when setting up the
transfer by presence of `write_resp_hd` in the protocol handler.

Closes #18218

3 months agoares: destroy channel on shutdown
Stefan Eissing [Thu, 7 Aug 2025 08:32:14 +0000 (10:32 +0200)] 
ares: destroy channel on shutdown

When we cancel async resolv operations, we have kept an existing ares
channel open. This seems unreliable as reported in #18216.

To get reliable behaviour, always destroy the ares channel on async
shutdown and create a new one on demand.

Fixes #18216
Reported-by: devgs on github
Closes #18217

3 months agocurl: make global truly global
Daniel Stenberg [Wed, 6 Aug 2025 21:18:46 +0000 (23:18 +0200)] 
curl: make global truly global

The GlobalConfig only exists in a single instance and it has worked like
this since the dawn of time. It is about time we stop passing around
pointers to what was already essentially a global object and instead
just use a... global.

It simplifies things.

Closes #18213

3 months agohttp: resurrect addition from 41fe621
Stefan Eissing [Thu, 7 Aug 2025 07:50:34 +0000 (09:50 +0200)] 
http: resurrect addition from 41fe621

For some reason, these lines were unintentionally deleted in 6d5570c.
Thanks to IoannisGS for noticing.

Bug: https://github.com/curl/curl/pull/18179#issuecomment-3162876532
Reported-by: IoannisGS on github
Closes #18215

3 months agocmake: ExternalProject test tidy-ups
Viktor Szakats [Thu, 7 Aug 2025 07:18:30 +0000 (09:18 +0200)] 
cmake: ExternalProject test tidy-ups

Follow-up to b8296d367aa4277ee297d474fe438da687ffc5ec #18208

Closes #18214

3 months agocurl_quiche.c: add include
Karthik Das [Thu, 7 Aug 2025 03:47:04 +0000 (09:17 +0530)] 
curl_quiche.c: add include

Fixes #18211
Closes #18212

3 months agocmake: make the ExternalProject test work
Viktor Szakats [Wed, 6 Aug 2025 17:21:16 +0000 (19:21 +0200)] 
cmake: make the ExternalProject test work

By micromanaging the project dependency and its inclusion into the test
project. It feels like an awkward construct, but perhaps better than
nothing.

It's also fragile because it's a static build with no assistance from
the external project (curl in this case). Mitigated in test by disabling
all dependencies and some features.

Since there is no special core cmake logic to be tested here, in CI
the test is tested really. To keep CI jobs at minimum, only add 3 of
them, taking 42s in total. (All 6 would take 270s.)

Follow-up to e2a23d5d0d566105237acec37a2c22a6f79cee3e #17203

Closes #18208

3 months agolibcurl: reset rewind flag in curl_easy_reset()
Oxan van Leeuwen [Wed, 6 Aug 2025 12:09:32 +0000 (14:09 +0200)] 
libcurl: reset rewind flag in curl_easy_reset()

curl_easy_reset() did not reset the `rewind_read` flag. This caused any
handles that previously had a CURLE_SEND_FAIL_REWIND error to get stuck
with that error, failing any subsequent requests, even if they didn't
have any body at all.

Verified in test 3034

Fixes #18206
Closes #18207

3 months agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 6 Aug 2025 15:19:09 +0000 (17:19 +0200)] 
RELEASE-NOTES: synced

3 months agotool_operate: use the correct config pointer
Daniel Stenberg [Mon, 4 Aug 2025 21:21:14 +0000 (23:21 +0200)] 
tool_operate: use the correct config pointer

Triggered when doing 100+ parallel globbed upload transfers.

Reported-by: letshack9707 on hackerone
Closes #18200

3 months agotests/ech_tests.sh: indent, if/for style, inline ifs
Viktor Szakats [Tue, 5 Aug 2025 13:29:11 +0000 (15:29 +0200)] 
tests/ech_tests.sh: indent, if/for style, inline ifs

Sync with rest of shell scripts.

Follow-up to 2485a2d10054cfc8fce769bd45fa1a26fe070d8e #17001
Closes #18187

3 months agomulti: fix bad splay management
Daniel Stenberg [Wed, 6 Aug 2025 07:03:31 +0000 (09:03 +0200)] 
multi: fix bad splay management

The splay tree is a tree where each easy handle can be added *once*. The
expire time for that node is the closest expire time for that easy
handle.

Easy handles can however have more expire times queued up, so when the
node is removed from the splay tree because it is the next in line to
take care of, we must check if there is another expire time in the queue
and then add the node back into the splay.

Failing to do the later part, the calling of add_next_timeout after
Curl_splaygetbest, would leave the state.expiretime on the previous time
stamp, which when could make the next call to Curl_splaygetbest use the
wrong time stamp and get a wrong node out, causing trouble.

Reported-by: letshack9707 on hackerone
Closes #18201

3 months agolib: xfer_setup simplify
Stefan Eissing [Wed, 6 Aug 2025 09:56:08 +0000 (11:56 +0200)] 
lib: xfer_setup simplify

Make variants for transfers that send/receive or do both with just the
parameters they need. Split out the shutdown setting into a separate
function. Only FTP bothers with that.

Closes #18203

3 months agotool_urlglob: polish, cleanups, improvements
Daniel Stenberg [Tue, 5 Aug 2025 14:00:20 +0000 (16:00 +0200)] 
tool_urlglob: polish, cleanups, improvements

- assert instead of printing "internal error" for unlikely events
- avoid allocating the main struct
- convert globerror() from macro to function
- renames to shorter and clearer names
- malloc + copy => memdup0
- change buffer handling to dynbuf
- realloc to handle more globs, but use less memory for few

Closes #18198

3 months agolib: replace conn [write]sockfd members by index
Stefan Eissing [Tue, 5 Aug 2025 11:11:53 +0000 (13:11 +0200)] 
lib: replace conn [write]sockfd members by index

The `connectdata` members `sockfd` and `writesockfd` needed to by either
CURL_SOCKET_BAD or a copy of one of `conn->sock[2]`. When equal to one,
that index was used to send/recv/poll the proper socket or connection
filter chain.

Replace those with `send_idx` and `recv_idx` which are either -1, 0 or 1
to indicate which socket/filter to send/receive on.

Closes #18179

3 months agosplay: add another assert for detected usage problem
Daniel Stenberg [Wed, 6 Aug 2025 06:12:08 +0000 (08:12 +0200)] 
splay: add another assert for detected usage problem

Closes #18199

3 months agoGHA: update actions/download-artifact action to v5
renovate[bot] [Tue, 5 Aug 2025 22:40:09 +0000 (22:40 +0000)] 
GHA: update actions/download-artifact action to v5

Closes #18193

3 months agoBINDINGS.md: add LibQurl
Qriist [Wed, 6 Aug 2025 00:10:09 +0000 (20:10 -0400)] 
BINDINGS.md: add LibQurl

Add LibQurl to the list of known binding libraries.

Closes #18195

3 months agoconfig2setopts: avoid curlx_dyn_addf(..., "%s"
Daniel Stenberg [Wed, 6 Aug 2025 06:02:39 +0000 (08:02 +0200)] 
config2setopts: avoid curlx_dyn_addf(..., "%s"

Closes #18194

3 months agodynbuf: assert on curlx_dyn_addf use with just "%s"
Daniel Stenberg [Tue, 5 Aug 2025 22:52:04 +0000 (00:52 +0200)] 
dynbuf: assert on curlx_dyn_addf use with just "%s"

Because it is wasteful and should be done better.

Closes #18194

3 months agoGHA/curl-for-win: include CPU archs in job names
Viktor Szakats [Tue, 5 Aug 2025 22:22:53 +0000 (00:22 +0200)] 
GHA/curl-for-win: include CPU archs in job names

Closes #18191

3 months agovtls: set seen http version on successful ALPN
Stefan Eissing [Tue, 5 Aug 2025 11:37:12 +0000 (13:37 +0200)] 
vtls: set seen http version on successful ALPN

When a HTTP version has been negotiated via ALPN, set the member
`conn->httpversion_seen` accordingly. This allows pending transfers to
reuse multiplexed http connections before the response to the first
transfer has arrived.

Fixes #18177
Reported-by: IoannisGS on github
Closes #18181

3 months agotool_cb_hrd: remove global pointer from 'struct HdrCbData'
Daniel Stenberg [Tue, 5 Aug 2025 12:14:10 +0000 (14:14 +0200)] 
tool_cb_hrd: remove global pointer from 'struct HdrCbData'

It is not necessary

Closes #18184

3 months agotool: replace three malloc + copy with memdup0
Daniel Stenberg [Tue, 5 Aug 2025 12:24:15 +0000 (14:24 +0200)] 
tool: replace three malloc + copy with memdup0

The function already existed for private use in var.c

Closes #18185

3 months agoci: update openssl/openssl to v3.5.2
renovate[bot] [Tue, 5 Aug 2025 12:27:08 +0000 (12:27 +0000)] 
ci: update openssl/openssl to v3.5.2

Closes #18186

3 months agotool_cb_wrt: use dynbuf instead of "manual" malloc
Daniel Stenberg [Tue, 5 Aug 2025 11:43:49 +0000 (13:43 +0200)] 
tool_cb_wrt: use dynbuf instead of "manual" malloc

When creating new file names for no-clobber

Closes #18182

3 months agotool_cb_wrt: split out win_console() from tool_write_cb()
Daniel Stenberg [Tue, 5 Aug 2025 11:26:44 +0000 (13:26 +0200)] 
tool_cb_wrt: split out win_console() from tool_write_cb()

Closes #18180

3 months agosetopt: add helper functions to setopt_long()
Daniel Stenberg [Tue, 5 Aug 2025 06:47:31 +0000 (08:47 +0200)] 
setopt: add helper functions to setopt_long()

- Consistently keep options within ranges
- Reduce the maximum maxredirs value to fit a signed short
- Removed comments as the place to document the options is not here

Closes #18174

3 months agoGHA: pin jobs to windows-2022
Viktor Szakats [Tue, 5 Aug 2025 10:55:59 +0000 (12:55 +0200)] 
GHA: pin jobs to windows-2022

To avoid being bumped to windows-2025 in September, and to stay with
the superior performance offered by windows-2022 runners.

Ref: #18140
Closes #18178

3 months agovquic: use curl_getenv
David Zhuang [Mon, 4 Aug 2025 23:56:15 +0000 (16:56 -0700)] 
vquic: use curl_getenv

getenv isn't defined on all platforms, which prevents vquic from
building. I specifically ran into this issue building on PlayStation.

Closes #18170

3 months agoopenssl: output unescaped utf8 x509 issuer/subject DNs
Roberto Hidalgo [Tue, 5 Aug 2025 02:29:00 +0000 (20:29 -0600)] 
openssl: output unescaped utf8 x509 issuer/subject DNs

Closes #18171

3 months agomulti: change prefix for the network change bits to CURLMNWC_
Daniel Stenberg [Tue, 5 Aug 2025 09:39:32 +0000 (11:39 +0200)] 
multi: change prefix for the network change bits to CURLMNWC_

Because "CURLM_" is used for curl multi error codes and it is convenient
to use the prefix to identify the number family.

Closes #18176

3 months agocurl_multi_get_offt: language fix
Daniel Stenberg [Tue, 5 Aug 2025 09:32:21 +0000 (11:32 +0200)] 
curl_multi_get_offt: language fix

Closes #18175

3 months agocurl_multi_get_offt: add separate man pages for the options
Daniel Stenberg [Mon, 4 Aug 2025 22:09:18 +0000 (00:09 +0200)] 
curl_multi_get_offt: add separate man pages for the options

Follow-up to 1ad2009ad63478ace18977ec5314f597f45ad084

Closes #18168

3 months agowolfssl: rename ML-KEM hybrids to match IETF draft
Anthony Hu [Fri, 25 Jul 2025 17:27:33 +0000 (13:27 -0400)] 
wolfssl: rename ML-KEM hybrids to match IETF draft

Closes #18123

3 months agourldata: reduce two long struct fields to unsigned short
Daniel Stenberg [Mon, 4 Aug 2025 20:25:29 +0000 (22:25 +0200)] 
urldata: reduce two long struct fields to unsigned short

Closes #18173

3 months agohostip: cache negative name resolves
Daniel Stenberg [Sun, 3 Aug 2025 22:06:03 +0000 (00:06 +0200)] 
hostip: cache negative name resolves

Hold them for half the normal lifetime. Helps when told to transfer N
URLs in quick succession that all use the same non-resolving hostname.

Done by storing a DNS entry with a NULL pointer for 'addr'.

Previously an attempt was made in #12406 by Björn Stenberg that was
ultimately never merged.

Closes #18157

3 months agobuild: disable `TCP_NODELAY` for emscripten
Viktor Szakats [Sun, 3 Aug 2025 21:48:53 +0000 (23:48 +0200)] 
build: disable `TCP_NODELAY` for emscripten

In WebAssembly, using `TCP_NODELAY` fails with:
```
* Could not set TCP_NODELAY: Protocol not available
```

Add a new feature macro in `curl_setup.h` telling whether `TCP_NODELAY`
is known to be supported at runtime, when defined at compile-time.

Keep `TCP_NODELAY` guards at their current positions to ensure the
necessary headers (e.g. `netinet/tcp.h` and `netinet/in.h`) define it.

Reported-by: Jeroen Ooms
Fixes #17974
Closes #18155

3 months agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 4 Aug 2025 21:53:16 +0000 (23:53 +0200)] 
RELEASE-NOTES: synced

3 months agomulti: add new information extraction method
Stefan Eissing [Wed, 23 Jul 2025 07:18:59 +0000 (09:18 +0200)] 
multi: add new information extraction method

Adds `curl_off_t curl_multi_get_offt(CURLM *multi_handle, CURLMinfo_offt
info)` to the multi interface with enums:

* CURLMINFO_XFERS_CURRENT: current number of transfers
* CURLMINFO_XFERS_RUNNING: number of running transfers
* CURLMINFO_XFERS_PENDING: number of pending transfers
* CURLMINFO_XFERS_DONE: number of finished transfers to read
* CURLMINFO_XFERS_ADDED: total number of transfers added, ever

Add documentation for functions and info enums.

Add use in the curl command line tool to replace two static
variables counting the same "from the outside".

refs #17870
Closes #17992

3 months agowriteout: add %time{}
Daniel Stenberg [Thu, 31 Jul 2025 14:41:36 +0000 (16:41 +0200)] 
writeout: add %time{}

Output the current UTC time using strftime format. %f is an extra curl
specific flag to output the microsecond fraction of the current second.

Verified by test 1981

Closes #18119

3 months agolib: replace `getsock()` logic with pollsets
Stefan Eissing [Mon, 4 Aug 2025 14:17:37 +0000 (16:17 +0200)] 
lib: replace `getsock()` logic with pollsets

`getsock()` calls operated on a global limit that could
not be configure beyond 16 sockets. This is no longer adequate
with the new happy eyeballing strategy.

Instead, do the following:
- make `struct easy_pollset` dynamic. Starting with
  a minimal room for two sockets, the very common case,
  allow it to grow on demand.
- replace all protocol handler getsock() calls with pollsets
  and a CURLcode to return failures
- add CURLcode return for all connection filter `adjust_pollset()`
  callbacks, since they too can now fail.
- use appropriately in multi.c and multi_ev.c
- fix unit2600 to trigger pollset growth

Closes #18164