Viktor Szakats [Tue, 6 May 2025 23:29:32 +0000 (01:29 +0200)]
cmake: set `BUILDING_LIBCURL` directly for unit test targets
To avoid adding this macro to the global `CURL_DEBUG_MACROS` variable,
which may be used for targets defined after unit tests, and where this
macro may not be necessary.
As of this commit unit tests are defined last, so extending the global
variable did not cause any issue.
Jay Satiro [Tue, 6 May 2025 21:47:37 +0000 (17:47 -0400)]
generate.bat: exclude curlinfo.c from legacy VS projects
- Do not include curlinfo.c as a ClCompile unit when compiling the curl
tool.
Prior to this change generate.bat would add curlinfo.c to the source
files for the curl tool because it is located in the src directory. That
caused ambiguous behavior in legacy versions of Visual Studio which had
to guess between two main entry points (one in curlinfo and one in
tool_main, the latter being correct).
Daniel Stenberg [Tue, 6 May 2025 13:03:46 +0000 (15:03 +0200)]
tests: separate tunit tests from unit tests more
- unit tests need no tool code as they are libcurl unit tests
- unit test 1621 is now tunit test 1621 instead, as it tests tool code
- build unit tests with BUILDING_LIBCURL as they pretent to be libcurl
Viktor Szakats [Sat, 26 Apr 2025 16:37:39 +0000 (18:37 +0200)]
GHA: drop vcpkg cache and most vcpkg logic with it
The unplanned dropping of the granular vcpkg binary cache indeed fell
into the cracks between Microsoft's various departments. The old method
is now official dropped, without replacement either on the vcpkg side or
the GitHub cache provider side.
Without a granular cache, vcpkg is impractical for builds larger than
a small dependency tree in CI, for performance reasons.
A granular cache is critical for CI use. Building dependencies is not
a goal of this CI, so a more desirable option would be pre-built binary
downloads. This would also allow keeping job timeouts low, which is
important for quick iteration in GHA when a flaky job requiring a manual
retry needs all other jobs to finish first. (GHA often disregards
step timeouts, which is another contributing factor here.)
Windows remains tested extensively with MSYS2, curl-for-win, and via
AppVeyor CI with MSVC + OpenSSL, and also in GHA via scaled back vcpkg
jobs that perform well without caching. What's lost is the recently
added Android OpenSSL build tests.
We may consider building/cachine important dependencies manually as in
GHA/linux-http3, and/or try integrating MSVC jobs with MSYS2 UCRT DLLs.
Daniel Stenberg [Tue, 8 Apr 2025 09:45:17 +0000 (11:45 +0200)]
openssl: enable builds for *both* engines and providers
OpenSSL3 can in fact have both enabled at once. Load the provider and
key/cert appropriately. When loading a provider, the user can now also
set an associated "property string".
Daniel Stenberg [Tue, 22 Apr 2025 12:51:49 +0000 (14:51 +0200)]
lib: provide a getaddrinfo wrapper
This uses c-ares under the hood and supports the CURL_DNS_SERVER
environment variable - for debug builds only. The getaddrinfo()
replacement function is only used if CURL_DNS_SERVER is set to make a
debug build work more like a release version without the variable set.
'override-dns' is a new feature for the test suite when curl can be told
to use a dedicated DNS server, and test 2102 is the first to require
this.
Daniel Stenberg [Sun, 27 Apr 2025 15:35:20 +0000 (17:35 +0200)]
buildinfo: move from tests/server/ to src/, rename to curlinfo
Since a16485a42ea5dabe6c, the test servers build with a different set of
options than the tool/lib - for example a different CURLDEBUG. To make
buildinfo better reflect the curl build, move it to src/ and build it
here using the local CURLDEBUG. Renamed to curlinfo to not get confused
with buildinfo.txt
I chose src/ and not lib/ because the file also uses tool-specific headers.
Jay Satiro [Mon, 28 Apr 2025 17:35:44 +0000 (13:35 -0400)]
progress: fix integer overflow check
- Fix logic typo.
Prior to this change the overflow check was reversed, meaning it did
not stop an overflow condition and also if there wasn't an overflow it
erroneously set the total expected transfer size to the maximum value.
Viktor Szakats [Sun, 27 Apr 2025 10:26:41 +0000 (12:26 +0200)]
cmake: extend integration tests
- GHA: add cmake integration tests for Windows.
- make them run faster with prefill, unity, Ninja, omitting curl tool.
- also test static libcurl.
- add old-cmake support with auto-detection.
- auto-detect Ninja.
- run consumer test apps to see if they work.
- add support for Windows.
- make it more verbose.
- re-add `ExternalProject` cmake consumer test. It's broken.
- tidy up terminology.
To help anyone wanting to build/reproduce release candidates, this is
the set git tag naming scheme to use. Similar to, but different, than
the "normal" release tags to not be possible to mixup.
Viktor Szakats [Sat, 26 Apr 2025 07:34:55 +0000 (09:34 +0200)]
cmake: honor individual picky option overrides found in `CMAKE_C_FLAGS`
Also to sync up with similar `./configure` feature via
`CURL_ADD_COMPILER_WARNINGS()`.
Example: `-DCMAKE_C_FLAGS=-Wno-xor-used-as-pow`
It may be useful as a workaround if a specific build combination hits
a picky warning within curl's source code. If such happens, we do
appreciate a report to fix it in curl itself.
Viktor Szakats [Thu, 24 Apr 2025 23:45:23 +0000 (01:45 +0200)]
cmake: stop deleting `-W<n>` from `CMAKE_C_FLAGS` (MSVC)
1. `CMAKE_C_FLAGS` may apply to other projects, and deleting/altering it
may be unexpected.
2. We pass `-W4`/`-Wall` internally now, which do override custom
`-W<n>` options in all supported MSVC versions.
(as tested with Visual Studio generators)
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/51945416
Daniel Stenberg [Fri, 25 Apr 2025 06:16:13 +0000 (08:16 +0200)]
tests/buildinfo: former "disabled" now provides more info
This tool now contains ON/OFF information about features in the build.
This way, runtests gets both positive and negative feature presence with
this. Allows for more flexibility and avoids having to duplicate the
names.
Viktor Szakats [Thu, 24 Apr 2025 17:12:42 +0000 (19:12 +0200)]
GHA/windows: limit jobs to 15 minutes
They typically finish (well) within 10 minutes.
A notable exception was vcpkg jobs when a rebuild was triggered.
With caching lost and reducing them to short builds, this is not
an issue at the moment.
The advantage of shorter timeouts is hung/crashed jobs giving back
control earlier for a manual retry.
Viktor Szakats [Wed, 23 Apr 2025 08:26:38 +0000 (10:26 +0200)]
cmake: install shell completions for cross-builds
Also:
- omit auto-detecting `CURL_COMPLETION_FISH_DIR` via `pkg-config`
for cross-builds and when `CMAKE_INSTALL_PREFIX` is set.
- flatten nested `if`s.
Note:
On macOS with Homebrew, `pkg-config --variable completionsdir fish`
returns the version-specific Cellar path instead of the permanent path
`/opt/homebrew/share/fish/vendor_completions.d/`. This mimics what
autotools does, but may need further fixing, possibly upstream.
https://github.com/Homebrew/homebrew-core/blob/9c13e62b009b8e814fda180e0fcc5096318daf31/Formula/f/fish.rb
https://github.com/fish-shell/fish-shell/blob/ce631fd2fb1f5b63f5f0f1b4041a30dfad823d22/cmake/Install.cmake#L15-L21
Stefan Eissing [Wed, 23 Apr 2025 09:24:45 +0000 (11:24 +0200)]
multi: init_do(): check result
Calls to `Curl_init_do()` did not check on result and missed failures to
properly and completely initialize a transfer request.
The main cause of such an init failure is the need to rewind the
READFUNCTION without a SEEKFUNCTION registered. Check the failure to
"rewind" the upload data immediately make test cases 1576 and friends
fail.
Reported-by: Travis Lane
Fixes #17139
Closes #17150
Viktor Szakats [Wed, 23 Apr 2025 10:12:02 +0000 (12:12 +0200)]
GHA/windows: apply MSYS2 runtime downgrades to v3.5.x, leave v3.6.x as-is
windows-runners 20250420.1.0 come with msys2-runtime 3.6.x. It has
the perf regression issue fixed, so stop downgrading it.
This makes CI jobs settle on this version when supplied by
the runner image or the msys2/setup-msys2 action:
MINGW64_NT-10.0-20348 fv-az980-636 3.6.1-0cfedd4f.x86_64 2025-04-12 01:44 UTC x86_64 Msys
With 3.6.1, we've seen issues launching `perl.exe` before this patch:
https://github.com/curl/curl/discussions/14854#discussioncomment-12908214
https://github.com/curl/curl/discussions/14854#discussioncomment-12921007
I don't understand what this error says, why it happens in certain CMake
versions, and why a workaround is necessary for what seems like
a standard export/consume configuration. This patch is based on internet
suggestions and other projects ending up with this workaround.
Stefan Eissing [Tue, 22 Apr 2025 10:53:22 +0000 (12:53 +0200)]
http: fix HTTP/2 handling of TE request header using "trailers"
A "TE" request header is allowed in HTTP/2 when it only carries the
"trailers" value. RFC 9113 ch. 8.2.2. Check client supplied TE values
for the "trailers" token and only pass that one in a HTTP/2 request.
Add test_01_17 to verify.
Fixes #17122 Reported-by: epicmkirzinger on github
Closes #17128