Commit graph

39499 commits

Author SHA1 Message Date
Viktor Szakats
e090cf59ad
build: drop dirent.h and opendir() detections on Windows
`opendir()` was used previously with mingw-w64 for `file://` directory
listing support. This was replaced by a native Win32 solution on all
Windows platforms, leaving `opendir()` no longer used. Drop related
feature detections.

Follow-up to c7c42afab9 #22577

Closes #22588
2026-08-16 12:15:54 +02:00
Viktor Szakats
bf594226d6
GHA/non-native: BSD build improvements
- show binary sizes and file types in 'curl -V' step, like rest of
  workflows.
- make `build tests` step verbose.
- disable typecheck on emulated CPUs.
  It results in 3-4x speed-up for riscv64, and ~2x for ARM64 when
  building tests (in particular the libtests binary.)
  Ref: 9e6f1c5efb #19637
- enable building tests in an ARM64 job.
- move examples build test from ARM64 to riscv64 (to spread job times).

Closes #22601
2026-08-16 10:08:33 +02:00
Viktor Szakats
1db93bdb7c
config-win32.h: limit use to MSVC IDE Project builds
This is the only purpose it's maintained for.

Drop mingw-w64 and other logic falling outside of VS2010-2013 needs.

mingw-w64/MSVC platform differences keep being maintained/documented as
part of the CMake pre-fill logic in `CMake/win32-cache.cmake`.

Follow-up to ba8752e556 #12224

Closes #22595
2026-08-16 10:08:33 +02:00
Viktor Szakats
0c72958a67
GHA/windows: bump stunnel to 5.80
Ref: https://www.stunnel.org/NEWS.html

Closes #22600
2026-08-15 23:14:00 +02:00
Stefan Eissing
787cbd2033
multi: shrink expire timer indices
The enum `exire_id` fits easily into a uint8_t. Use that type for
storing expire timeout list indices.

Closes #22591
2026-08-15 22:35:20 +02:00
Viktor Szakats
fa21937ab0
GHA/non-native: sync BSD test exclusion logic with rest of workflows
Stop auto-skipping tests on emulated CPUs, replace it with explicit
`skipall` tags instead. To make it easier to enable tests on emulated
CPUs and to align with rest of workflows.

Closes #22599
2026-08-15 22:24:17 +02:00
Viktor Szakats
26dadd9ea3
GHA/windows: log preinstalled MSYS2 packages
CI jobs rely on defaults, sometimes to reduce log noise (possibly
improve performance a bit) or simplify, sometimes by accident. List them
to help debug or optimize on changes.

Refs:
https://github.com/actions/runner-images/issues/14562#issuecomment-5301777198
636489312c
https://github.com/msys2/MSYS2-packages/pull/6491
https://github.com/msys2/MSYS2-packages/pull/6479

Follow-up to d854ab4673 #22580
Follow-up to c349bd668c #14097

Closes #22589
2026-08-15 15:45:01 +02:00
hunterinvariants
c7c42afab9
file: support directory listing on Windows
Closes #22577
2026-08-15 11:56:25 +02:00
Stefan Eissing
ebc0fbc0e8
connect: only set connect timer on first socket
Only collect connect/appconnect timer stats on the first socket.

Fixes #22587
Closes #22592
Reported-by: GLaDOS-418 on github
2026-08-15 11:55:38 +02:00
Viktor Szakats
91323de7f3
GHA/non-native: bump cross-build-actions, NetBSD 11.0, FreeBSD riscv64
New riscv64 job takes 4.5 minutes.

Also:
- use prefill on riscv64 to save 2 minutes configure time.
- disable manuals/perl on riscv64 to save ~1 minute (install, build).
- cmake: fix `HAVE_GETHOSTBYNAME_R_6` prefill for FreeBSD.

Ref: https://github.com/cross-platform-actions/action/releases/tag/v1.4.0

Closes #22590
2026-08-15 11:21:11 +02:00
Stefan Eissing
3d6d93a6be
multi: timeout improvements
- Move expire timeout code from multi into splay.c
- keep a "time_base" timestamp to calculate timediff_t for
  actual timeout values. Unfortunately this means our
  timeouts will go wrong after ~500,000 years of continuous
  operations...
- use timediff_t as key in splay instead of curltime
- use timediff_t in transfers expire times instead of curltime
- re-comment splay.c for better understanding how it works
- replace splay nodes double-linked "same" list with a single link,
  we almost never have duplicate keys
- keep transfer `mid` in splay nodes instead of the transfer pointer
- keep registered bit in splay node for tracking instead of separate
  bit in transfer
- adapt unit1309.c to changes in timediff_t and mid

Closes #22584
2026-08-14 22:39:41 +02:00
Viktor Szakats
d854ab4673
GHA/windows: install MSYS2 Perl manually on Windows 2025 runner
In GitHub runner image windows-2025-vs2026 v20260810.198.2, the default
Perl binary changed from MSYS2 to Strawberry. The reason is that the MSYS2
installation not longer has Perl preinstalled.

As seen in CMake configuration:
```diff
- -- Found Perl: C:/a/_temp/msys64/usr/bin/perl.exe (found version "5.42.2")
+ -- Found Perl: C:/Strawberry/perl/bin/perl.exe (found version "5.42.0")
```

curl's Perl scripts require an MSYS2 Perl. Fix by installing it manually
in this one job.

Symptom was `gencert.pl` no longer finding openssl.exe:
```
Missing or broken 'openssl' tool. openssl 1.0.2+ is required.
```
Then the script hanging while trying to trace it.

Also:
- add distinct error message and list PATH elements if openssl is not
  found via `gencert.pl`.
- tried falling back to Git for Windows Perl, which caused the test step
  to either hang or run too slowly to fit the time slot.

Refs:
https://github.com/actions/runner-images/pull/14541
https://github.com/actions/runner-images/releases/tag/win25-vs2026%2F20260810.198

Bug: https://github.com/curl/curl/pull/22577#issuecomment-5286533641
Bug: https://github.com/curl/curl/pull/22577#issuecomment-5291468024

Closes #22580
2026-08-14 16:15:18 +02:00
Daniel Stenberg
fe703df949
lib: optimize struct layouts for reduced memory usage
struct SingleRequest tweaks

- 'upgr101' from enum upgrade101 => 'unsigned char', saves three bytes
- made some 'unsigned char' => uint8_t
- moved 'io_flags' to fill a hole on 64-bit arch

struct UserDefined tweaks

- Sort the fields by size. Larger to smaller. Helps avoding holes.
- httpsig_algorithm moved
- FTP uint8_t fields moved
- new_file_perms moved
- rtspreq moved
- sort fields on size

- urldata: drop 'struct Curl_data_priority'

  It only had a single struct member 'weight'. Use that directly instead
  to save indirections and struct alignments. Move field for size order.

- urldata: move the RTSP fields in the UrlState struct to be ordered by
  size

struct PureInfo tweaks

- make 'pxcode' a uint8_t
- move 'conn_protocol' to fill a hole
- sort 'struct PureInfo' fields by size

Closes #22585
2026-08-14 16:14:24 +02:00
Stefan Eissing
7103a93b05
connections: use admin handles only for maintenance
Maintenance tasks like connection upkeep, liveliness checks and cache
eviction must only run on an admin handle, not the application transfer
from the calling context.

Then application transfers will get only attached to the connections
they actually work on. This makes `data->state.recent_conn_id`
meaningful for checks if a subsequent address is finding the previous
connection again.

One thing led to another:
- add Curl_get_admin(data), to obtain an admin handle for
  an application handle, inheriting some properties for
  connection operation.
- rename `Curl_easy *data` parameter to `Curl_easy *admin`
  where only admin handles should be passed. Add DEBUGASSERTs
  in the called function.
- rename `Curl_conn_terminate()` to `Curl_conn_close()`
  because this makes connections enter the shutdown close
  where possible.
- rename `Curl_cshutdn_terminate()` to `Curl_conn_terminate()`
  since this definitely kills the connection and does not
  involve a `cshutdn` instance.
- add Curl_share_lock_share(), Curl_share_unlock_share()
  so it possible to operate on a share without the passed
  easy handle having the share set.
  This catches a case where a shared needed to be locked
  but was not before. Adjust test1554 results.

Fixes #22567
Reported-by: cybertron10 on github
Closes #22572
2026-08-14 14:01:21 +02:00
Stefan Eissing
6e9880366f
Revert "uint-bset: add slot0 member"
This reverts commit 743096a496.

Closes #22581
2026-08-14 13:41:03 +02:00
Daniel Stenberg
554efab7f6
multi: drop the assert from large expires
Triggers the fuzzers

Closes #22582
2026-08-14 13:39:42 +02:00
Daniel Stenberg
a3aaca10d9
multi: cap expire times to INT_MAX internally
When the time-out value is passed to the outside world it needs to fit
in a signed 32-bit variable (on Windows and 32-bit architectures)
anyway. Also, this is 3.5 weeks and we should not knowingly set timeouts
that long anyway.

The previous cap introduced in 3089e7eec8 was only partial.

Closes #22579
2026-08-14 10:39:47 +02:00
Daniel Stenberg
e825e55867
RELEASE-NOTES: synced 2026-08-14 10:36:39 +02:00
Thomas Chauchefoin
68b5e60138
dict: avoid busy-loop in sendf() when the socket is not writable
Curl_xfer_send() reports CURLE_AGAIN as a successful zero-byte send, so
the retry loop spun at 100% CPU and ignored the timeout when the peer
stopped draining. Wait for writability and check the remaining time
between retries.

Closes #22576
2026-08-14 10:12:30 +02:00
Stefan Eissing
82b289c952
test_20_11: more leniency
Loosen the RSS increase check slightly to make the test less flaky.
Also use 'rss-max' stat.

Closes #22574
2026-08-14 09:36:29 +02:00
Dan Fandrich
bec8012214 libcurl.pc: Add Copyright tag to the pkgconf file
Follow-up to 3f1c033afe #22519
2026-08-13 10:11:41 -07:00
Daniel Stenberg
5510e44fcc
tool_operate: refactor schannel checks and move win32 cert checks to function
Follow-up to 9d034539ec

Closes #22570
2026-08-13 16:13:55 +02:00
Daniel Stenberg
ca26e728a6
conncache: don't assume curl_off_t increment wrap-around
In the totally unlikely event that next_easy_id would ever wrap, avoid
undefined behavior. It is a signed type.

Also: update the related comment in urldata.h that mentioned LONG_MAX
but is nowadays CURL_OFF_T_MAX

Closes #22569
2026-08-13 14:43:08 +02:00
Viktor Szakats
9d034539ec
tool_operate: limit is_using_schannel() call to Windows
Follow-up to cd238bb7ad #22552

Closes #22568
2026-08-13 11:22:51 +02:00
Viktor Szakats
dea00a6d73
cmake: use built-in variable and target property dump functions with CMake 4.5+
Their output is nearly identical to curl's implementations. Minor
differences: it goes to stdout (curl: stderr), marks cache variables,
but doesn't mark 'advanced' ones.

Also:
- indent curl's output to match CMake's.
- replace single quotes with double to match CMake output.
- alpha-sort target properties to match CMake.
- alpha-sort config types to match CMake.
- tested OK with cmake-4.4.20260811-g567ed0e and 4.4.20260812-g760e4fb.

Refs:
f723293c7f
https://gitlab.kitware.com/cmake/cmake/-/merge_requests/11834
https://gitlab.kitware.com/cmake/cmake/-/work_items/27513
https://cmake.org/cmake/help/git-master/command/cmake_language.html#command:cmake_language

Follow-up to 855acb3bb0 #17701
Follow-up to f58342ae21 #15562
Follow-up to cd51bb503a #14439

Closes #22566
2026-08-13 10:15:06 +02:00
Daniel Stenberg
6a6edec2c6
multihandle: move two struct fields
To avoid holes on 64-bit architectures.

Closes #22565
2026-08-13 08:28:23 +02:00
Daniel Stenberg
3089e7eec8
multi: hold timeout values in 'int' instead of 'long'
Since this code needs to work (identically) on systems with 32 bit longs
anyway, this might just as well always use 32 bit to save space and make
the code work the same everywhere.

Closes #22564
2026-08-13 00:00:47 +02:00
Stefan Eissing
e9b291cf9b
header api: add guards
Add API guards for curl_easy_header and curl_easy_nextheader.

urldata.h: remove prevhead member as not used

Closes #22530
2026-08-12 21:56:48 +02:00
Stefan Eissing
743096a496
uint-bset: add slot0 member
Add a fixed slot0 member for uint32_bset to have no allocations for
sizes < 64. This is a common use case for curl_easy_perform().

Closes #22561
2026-08-12 21:55:41 +02:00
Stefan Eissing
507ee5d792
progress: fix progress meter update to run every second again
Closes #22562
2026-08-12 21:54:42 +02:00
Stefan Eissing
1a17959fc7
url: fix negotiate/ntlm connection reuse
Reorder logic when looking for matching connections. Check candidate
Negotiate/NTLM state first. Require same "input" parameters when
connection is already authenticated. Same for proxy.

Deny connection reuse for empty usernames for NTLM/Negotiate using
connections.

Reported-by: Martin Dukek
Closes #22528
2026-08-12 16:46:01 +02:00
Daniel Stenberg
eca5ded9f6
mailmap: Ralf Mueller 2026-08-12 16:23:58 +02:00
hunterinvariants
574749016d
tests: verify AWS SigV4 redirect auth scope
Closes #22538
2026-08-12 16:22:07 +02:00
Viktor Szakats
8a8ff47b63
tidy-up: C and CI
- drop redundant casts for `CURL_UNCONST()` pointers (Windows).
- GHA/linux: delete redundant/dupe `-g` C flag in memory sanitizer job.
  Spotted-by: Daniel Stenberg
- examples/http2-upload: drop local macro.
- examples/http2-upload: drop leading underscore from union name.
- examples/http2-upload: drop interim macro.
- tests/server/util: reapply patch lost in a rebase.
- sync `main()` declarations across the codebase.

Closes #22559
2026-08-12 15:42:54 +02:00
Stefan Eissing
35843dd635
progress: cleanup, less memory
Keep only a single `start` time and calculate the rest in delta
microseconds since then. Separate timestamps and durations into separate
sub-structures for clarity.

remove progress.t_acceptdata
It was recorded in FTP accept but never used anywhere.

Closes #22547
2026-08-12 14:51:06 +02:00
Daniel Stenberg
fbfb2499f0
keylog: add a random size argument to Curl_tls_keylog_write()
To allow the function to verify that the buffer is large enough. Avoids
possible future internal mishaps.

Closes #22560
2026-08-12 14:33:01 +02:00
Daniel Stenberg
d064bc2adb
thrdqueue: drop name strdups from Curl_thrdq_create
The only usage of the thread queue and pool is for "DNS" which is a
static string. No point in strdup'ing it (twice). Future users are
*likely* to also used fixed strings, otherwise we revert this change
when dynamic names are introduced.

Reported-by: Max Dymond
Closes #22555
2026-08-12 14:17:01 +02:00
Daniel Stenberg
eae88a7473
urlapi: avoid dedotdotify() if possible
The dedotdotify() function that removes ./ and ../ sequences from paths
juggles memory and is slow. Now needs_dedotdot() is called first to
determine if the removal process is necessary and otherwise avoids doing
it. Avoids unnecessary memory operations.

Adjusted unit test 1395 accordingly because now a lot of input strings
return NULL for "no change necessary".

Suggested-by: Max Dymond

Closes #22557
2026-08-12 13:43:13 +02:00
Viktor Szakats
da04aa96ab
tidy-up: comments and formatting
Closes #22558
2026-08-12 13:32:22 +02:00
Viktor Szakats
943ac04fc4
CI: dump libcurl.pc (and curl-config) to log, verify .pc with pccritic tool
`pccritic` is available on the latest macOS runner revision (not every
job runs get it yet), Cygwin, MSYS2/mingw-w64 (one job, others will
follow on the next msys2/setup-msys2 Action bump). It will be
automatically used on BSDs, once they start offering it. Missing from
Linux jobs.

Also:
- GHA/windows: convert `libcurl.pc` to Unix newlines to bump score
  96 to 100 in mingw-w64 jobs.
  CMake-specific fix pending in: #22556
- GHA: verify with minimum `pccritic` score 94 to 100 (depending on CI
  job).
- build: fill `Maintainer:` `libcurl.pc` property when run curl CI.

Issues remaining:

macOS:
```
[info    ] Cflags adds an include path already on the default search path (pkgconf strips it): -I/usr/local/include (cflags/PC031)
[info    ] Libs adds a library path already on the default search path (pkgconf strips it): -L/usr/local/lib (libs/PC040)
[minor   ] Libs.private contains an unexpected flag: /Applications/Xcode_26.6.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.5.sdk/System/Library/Frameworks/GSS.framework (libs/PC041)
```

Windows:
```
[minor   ] file uses CRLF line endings (style/PC061)
```

Ref: #22556
Follow-up to b9254da617 #22548
Follow-up to 852f5d34da #22553
Follow-up to 4d9ba9fef4 #22545
Follow-up to 6c7993d4d9 #22536
Follow-up to 3f1c033afe #22519

Closes #22543
2026-08-12 12:53:06 +02:00
Viktor Szakats
852f5d34da
build: strip empty properties from libcurl.pc
To keep it tidy and to support properties in the template that only
appear in the generated `libcurl.pc` when filled.

E.g. `Required.private` may remain empty after #22548.

Also:
- GHA/windows: dump `libcurl.pc` to log in every job
- tidy up a pre-existing regex in the updated command.
  2c22d3069a #22544

Ref: b9254da617 #22548
Cherry-picked from #22543

Closes #22553
2026-08-12 11:24:51 +02:00
Viktor Szakats
acd9411b01
configure: replace stray raw grep with $GREP
Follow-up to 7cc2e8b349
Follow-up to bfaab6ed6b
Cherry-picked from #22543

Closes #22554
2026-08-12 11:19:46 +02:00
Daniel Stenberg
cd238bb7ad
tool_operate: only check for schannel if on windows
It can never be true elsewhere.

Reported-by: Max Dymond
Closes #22552
2026-08-12 11:01:59 +02:00
Viktor Szakats
b9254da617
build: clear Require.private for static-only builds in libcurl.pc
Before this patch static-only libcurl builds stored the list of module
dependencies in both `Require` and `Require.private`. The new `pccritic`
tool flagged this as an issue. Having (or not) a duplicate in
`Require.private` does not change the output created by `pkgconf` and
`pkg-config`, as tested with both with and without `--static` option.
Thus, fix by deleting the private copy.

Fixing:
```
$ pccritic libcurl.pc
bld/libcurl.pc
  score: 63/100  grade: D  (0 critical, 0 major, 9 minor, 1 info)
  [minor   ] 'libssh2' appears in both Requires and Requires.private (requires/PC051)
  [minor   ] 'libidn2' appears in both Requires and Requires.private (requires/PC051)
  [minor   ] 'openssl' appears in both Requires and Requires.private (requires/PC051)
[...]
```
Ref: https://github.com/curl/curl/actions/runs/31495008715/job/93790403026#step:10:210 (macOS, CM clang OpenSSL torture)
Ref: https://github.com/curl/curl/actions/runs/31495008825/job/93790433646#step:9:216 (mingw, AM ucrt-x86_64 wolfssl c-ares U)

Follow-up to f057de5a1a #13911
Follow-up to 98e5904165 #5373
Cherry-picked from #22543

Closes #22548
2026-08-12 10:46:19 +02:00
Alhuda Khan
f5378b88a9
content_encoding: exact-match the identity transfer-coding token
Verified by test 2119

Closes #22541
2026-08-11 17:36:19 +02:00
Viktor Szakats
4d9ba9fef4
libcurl.pc: add License tag
Also to improve `pccritic` score.

Idea-by: Dan Fandrich

Follow-up to 3f1c033afe #22519
Cherry-picked from #22543

Closes #22545
2026-08-11 15:08:21 +02:00
Viktor Szakats
2c22d3069a
build: strip duplicate spaces after Libs.private: in libcurl.pc
When `LIBCURL_PC_LDFLAGS_PRIVATE` is empty and `LIBCURL_PC_LIBS_PRIVATE`
is not.

To keep it tidy.

Closes #22544
2026-08-11 11:55:54 +02:00
Viktor Szakats
3b0cb22eb6
servers: add option to build without window handler (Windows)
curl already built like this in UWP mode; add a macro to allow building
regular Win32 targets too, meaning without the hidden GUI window, window
handler, and thus without support for shutting down `servers.exe`
gracefully. To test the server in CI as a plain console app and remove
one component/variable from the system, in an effort chasing flaky runs.

The graceful option was used by `taskkill` (without `-f`) in runtests,
and it has been disabled (in favor of always `-f` (forced) kill), in an
attempt to avoid taskkill hanging. Those resolved, but general CI
flakiness remained. We see `taskkill` invoked seldom per job, and in
most of these cases it doesn't find the PID requested. It means the
graceful option is not actually used since 2025-04, and rather rarely
before that. Also just today, the callback and main loop received a few
updates to avoid potentially unsafe calls and interaction with the ctrl
handler.

Not expecting anything breakthrough here. Also graceful shutdown
is a useful feature to cleanup properly and to be in sync with other
platforms.

Also: GHA/windows: enable in Windows CI jobs.

Ref: https://learn.microsoft.com/windows/console/registering-a-control-handler-function#listen-with-hidden-window-example

Follow-up to 7db9947fcf #22045
Follow-up to 9ea48811fe #22487
Follow-up to b11e0026f7 #22495
Follow-up to 208b87744e #21039
Follow-up to f450f3801b #19897
Follow-up to 2701ac6a4d #19421
Follow-up to 4e203f65a1 #17054

Closes #22496
2026-08-11 11:15:04 +02:00
Stefan Eissing
45a84dfe06
scorecard: report 'rss-max'
In addition report the maximum of the sampple RSS values. Increase the
sampling frequency for accuracy.

Closes #22542
2026-08-11 10:43:15 +02:00
Viktor Szakats
6c7993d4d9
build: strip trailing spaces from libcurl.pc
Fixing:
```
$ pccritic libcurl.pc
[...]
  [info    ] file has trailing whitespace on one or more lines (style/PC062)
```

Closes #22536
2026-08-11 10:26:23 +02:00