Commit Graph

35946 Commits

Author SHA1 Message Date
Daniel Stenberg
c83fa990bd
Revert "asyn-thrdd: use condition var more carefully"
This reverts commit bd4622bfaf.

Not intended for merge!
2025-08-22 09:05:19 +02:00
Stefan Eissing
bd4622bfaf
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
2025-08-22 08:40:40 +02:00
Jay Satiro
b6a5f67259 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
2025-08-22 01:50:28 -04:00
Viktor Szakats
7d5f535ca7
appveyor: drop testing with OpenSSL 1.1.0
Replace with 1.1.1.

Follow-up to 12a10ca77c #18337
Cherry-picked from #18330
Closes #18341
2025-08-21 18:30:40 +02:00
Viktor Szakats
7956a2a756
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 fa0ccd9f1f #15774
Follow-up to 68bd759c2b #15667
Cherry-picked from #18330
Closes #18335
2025-08-21 18:04:25 +02:00
Viktor Szakats
12a10ca77c
appveyor: drop testing with OpenSSL 1.0.2
Cherry-picked from #18330
Closes #18337
2025-08-21 17:04:29 +02:00
Stefan Eissing
b63cce7fee
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
2025-08-21 17:00:45 +02:00
Viktor Szakats
0630e66cb4
GHA/non-native: drop MS-DOS jobs, requires OpenSSL 1.0.2
Cherry-picked from #18330
Closes #18338
2025-08-21 16:58:55 +02:00
Viktor Szakats
b3167ef841
appveyor: test openssl with clang-cl
Cherry-picked from #18330
Closes #18334
2025-08-21 13:11:32 +02:00
Viktor Szakats
1d7fddde42
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 0d3b5937b3 #16477
Cherry-picked from #18330
Closes #18333
2025-08-21 13:11:32 +02:00
Viktor Szakats
696150b752
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 985f39c0ce #18147
Closes #18329
2025-08-21 13:11:32 +02:00
Viktor Szakats
8f9d73bcaf
tests: drop unused BLANK envs, unset CURL_NOT_SET
Closes #18328
2025-08-21 13:11:32 +02:00
Viktor Szakats
8fac255fc1
test: add cygwin feature and use it (test 1056, 1517)
To replace custom checks with the same effect.

Closes #18327
2025-08-21 13:11:32 +02:00
Viktor Szakats
29608d694e
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: 8cef6b5e6e #18321 #18320
Ref: d79269166e #18211 #18212
Ref: 454395ba1e #17857 #17864
Ref: b270fec68d #17857 #17858

Closes #18325
2025-08-21 13:11:31 +02:00
Stefan Eissing
8515424df4
websocket example: cast print values to unsigned int
To have not compiler warnings on format checks.

Reported By: Gisle Vanem
Closes #18326
2025-08-21 09:29:59 +02:00
Stefan Eissing
88fc6c491f
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
2025-08-21 09:26:49 +02:00
Daniel Stenberg
f3488ee3a3
RELEASE-NOTES: synced 2025-08-21 09:10:41 +02:00
Gabriel Marin
9a37dd3494
easy: add 'poll_fds' function to reduce size of 'wait_or_timeout'
Closes #18313
2025-08-20 22:55:45 +02:00
Viktor Szakats
2b2d8b7756
tests: delete unused commands
`runtests.pl` defaults to `-` if a command is not set, since
c43ad0f972.

Also:
- drop a stray `</file>`.
- replace a `nothing` with a guaranteed invalid hostname.
  Ref: 4334033b43
- replace unused URLs with `-`.

Closes #18319
2025-08-20 15:31:22 +02:00
Karthik Das
8cef6b5e6e
vquic: add header for native-QUIC OpenSSL, non-unity builds
Follow-up to 7dafe10db2 #18196
Fixes #18320
Closes #18321
2025-08-20 11:31:04 +02:00
Daniel Stenberg
27e61f9767
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
2025-08-20 11:01:21 +02:00
Daniel Stenberg
74432bbe6e
bufq: removed "Useless Assignment"
Pointed out by CodeSonar. Made a comment instead.

Closes #18322
2025-08-20 09:05:57 +02:00
Stefan Eissing
faa2db202b
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
2025-08-19 17:43:33 +02:00
Viktor Szakats
52775a7fb4
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 2388b0e587 #18308
Closes #18296
2025-08-19 10:07:25 +02:00
Viktor Szakats
b48997ba7b
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 90e644f944 #13583
Closes #18314
2025-08-19 09:47:33 +02:00
sunriseL
c294d0abc5
libssh2: fix sftp_statemachine busyloop when *block=true
Closes #18311
2025-08-19 08:07:33 +02:00
Daniel Stenberg
b9e3ea4edb
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
2025-08-19 07:59:50 +02:00
Daniel Stenberg
79eb66f2a6
ftp: keep the "raw" URL decoded version of the path around
Instead of doing temporary decodes in three different places.

Closes #18312
2025-08-19 07:59:50 +02:00
Viktor Szakats
2388b0e587
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: be01b60ce5 #18287

Cherry-picked from #18296
Closes #18308
2025-08-18 23:46:56 +02:00
Marcel Raad
a559f94321
asyn-thrdd: silence unused parameter warning
Closes https://github.com/curl/curl/pull/18310
2025-08-18 20:04:53 +02:00
renovate[bot]
0ea1e50d00
GHA: update vmactions/omnios-vm digest to c31844c
Closes #18302
2025-08-18 16:02:40 +02:00
Viktor Szakats
a477789c43
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: a19bd43210 #18307
Follow-up to 9463769f2e #16583

Closes #18301
2025-08-18 13:56:35 +02:00
David Zhuang
7dafe10db2
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
2025-08-18 13:25:52 +02:00
Daniel Stenberg
fc4ae23cc2
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
2025-08-18 13:03:51 +02:00
Viktor Szakats
11bb681ce8
GHA/windows: tidy up running find in two build steps
Cherry-picked from #18301
2025-08-18 11:19:50 +02:00
Viktor Szakats
a19bd43210
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
2025-08-18 11:08:53 +02:00
Daniel Stenberg
294ebba565
bufq: simplify condition
'result' is always CURLE_AGAIN here

Pointed out by CodeSonar

Closes #18305
2025-08-18 09:58:31 +02:00
Daniel Stenberg
e440686034
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
2025-08-18 09:57:45 +02:00
Daniel Stenberg
435069fcd9
RELEASE-NOTES: synced 2025-08-17 22:56:48 +02:00
Daniel Stenberg
0ba8e7f9db
test1549: verify CURLOPT_COOKIEFILE after expired cookies
Verifies #18299 (de89b86046)
Closes #18303
2025-08-17 22:52:18 +02:00
xfangfang
de89b86046
cookie: remove expired cookies before listing
Closes #18299
2025-08-17 22:25:25 +02:00
Stefan Eissing
a5f0ab7995
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
2025-08-15 13:50:28 +02:00
Daniel Stenberg
c5f76b8096
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 30de937bda (shipped in curl 8.9.0)

Add test 2307 to verify.

Reported-by: kupavcevdenis on github
Fixes #18283
Closes #18295
2025-08-15 13:35:04 +02:00
Daniel Stenberg
b2294996b6
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
2025-08-15 09:39:44 +02:00
Daniel Stenberg
ecf12d4464
docs/examples: remove spurious trailing backslashes
Unnecessary clutter

Follow-up to d06b49d8b2

Closes #18289
2025-08-15 09:37:14 +02:00
Daniel Stenberg
9fc30567bf
RELEASE-NOTES: synced 2025-08-15 09:29:47 +02:00
Viktor Szakats
35a3b256f3
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
2025-08-14 21:02:33 +02:00
Viktor Szakats
596383ca71
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
2025-08-14 20:10:16 +02:00
Viktor Szakats
be01b60ce5
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: a6fed41f6f #5054 #5034
  Ref: https://github.com/curl/curl/discussions/14854

Closes #18287
2025-08-14 16:34:06 +02:00
Viktor Szakats
c24d4be057
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
2025-08-14 12:25:15 +02:00