Commit Graph

34209 Commits

Author SHA1 Message Date
Viktor Szakats
0c37894611
cmake: pkg-config 'found' message sync with native CMake
Cherry-picked from #14610
2024-08-23 00:11:23 +02:00
Daniel Stenberg
c8c64c882c
GHA: trim markdown headers before proselinting
Allow interface.md to use more exclamation marks.

Closes #14645
2024-08-22 23:45:40 +02:00
Daniel Stenberg
23749bfd04
GHA: add a checksrc job
This job unconditionally runs checksrc on ALL .c and .h files present in
git.

checksrc.pl: fixed to look for ".checksrc" in the same directory from
where it loads the file to check so that it an be invoked like this

Closes #14625
2024-08-22 23:43:52 +02:00
Daniel Stenberg
99ba50d9c4
misc: general C style cleanups
... in code that previously was not checksrc'ed

Closes #14625
2024-08-22 23:43:45 +02:00
Viktor Szakats
42843af0b8
tidy-up: spelling WebSockets
Closes #14646
2024-08-22 17:43:57 +02:00
Viktor Szakats
118f446ad5
src: delete curlx_m*printf() aliases
A couple of seemingly random calls used them.
They were all mapped to `curl_m*printf()`.

Closes #14647
2024-08-22 17:06:06 +02:00
Viktor Szakats
0052b4b52d
configure: fix indentation
Also:
- move `then`s and an `in` inline.
- whitespace.

Closes #14628
2024-08-22 12:46:12 +02:00
Chris Swan
35034df1ca
docs: Clarify OpenSSF Best Practices vs Scorecard
SECURITY.md has a recently added section titled OpenSSF Scorecard
that actually documents OpenSSF Best Practices. Scorecard [0] is a
different OpenSSF project, that incorporates Best Practices, but is
distinct in its objectives and how it achieves them.
This change clarifies the terminology, and also removes any
implication that Gold Best Practices is an award rather than a self
certification programme.
As curl was a leader in implementing Best Practices some folk may be
more familiar with the earlier Core Infrastructure Initiative (CII)
naming, so a reference to that has been added.

[0] https://scorecard.dev/

Signed-off-by: Chris Swan <478926+cpswan@users.noreply.github.com>
Ref: #14319
Closes #14635
2024-08-22 11:50:20 +02:00
Jan Venekamp
aebd50870b
sectransp: fix setting tls version
Had multiple failures on test_17_09_ssl_min_max with --tlsv1 and
--tlsv1.3.

Closes #14621
2024-08-22 11:48:49 +02:00
Jan Venekamp
a4152864f8
tests: constrain http pytest to tests/http directory
Running the http pytest had to be done from tests directory or above,
because the repeat argument fixture was defined in tests/conftest.py.
However, the repeat argument is not needed because its functionality
can be provided by pytest-repeat as documented in the test's
README.md. So, removed the pytest_addoption function for the repeat
argument and the pytest_report_header function is moved to
tests/http/conftest.py.

TODO: Remove repeat argument from all tests. As a stopgap, a
one-element list is defined for it for now.

Closes #14611
2024-08-22 11:47:10 +02:00
Daniel Stenberg
aeb1a281ca
gtls: fix OCSP stapling management
Reported-by: Hiroki Kurosawa
Closes #14642
2024-08-22 11:11:14 +02:00
Viktor Szakats
c730c8549b
build: make CURL_FORMAT_CURL_OFF_T[U] work with mingw-w64 <=7.0.0
Add tweak for mingw-w64 when building tests/http/client programs to
avoid a bogus `-Wformat` warning when using mingw-w64 v7.0.0 or older.
The warning is bogus because these programs use curl's `printf()`
implementation that is guaranteed to support that format spec.

Add this for both CMake and autotools. (But only CMake is CI tested with
an old toolchain.)

Apply the workaround to `docs/examples`, and fix an example to use
curl's `printf()` with `CURL_FORMAT_CURL_OFF_T`.

Reintroduce curl `printf()` calls into `tests/http/client`, via #14625.
Also restore large number masks to a printf, changed earlier in #14382.

Follow-up to 232302f88a #14382
Ref: https://github.com/curl/curl/pull/14625#issuecomment-2302361737

Closes #14640
2024-08-22 10:45:04 +02:00
Viktor Szakats
c04504885d
src: fix potential macro confusion in cmake unity builds
Sources used `lib/curlx.h` with both `ENABLE_CURLX_PRINTF` set and unset
before including it.

In a cmake "unity" batch where the first included source had it unset,
the next sources did not get the macros requested with
`ENABLE_CURLX_PRINTF` because `lib/curl.x` had already been included
without them.

Fix it by by making the macros enabled permanently and globally for
internal sources, and dropping `ENABLE_CURLX_PRINTF`.

This came up while testing unity builds with smaller batches. The full,
default unity build where all `src` is bundled up in a single unit, was
not affected.

Fixes:
```
$ cmake -B build -DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=15
$ make -C build
...
curl/src/tool_getparam.c: In function ‘getparameter’:
curl/src/tool_getparam.c:2409:11: error: implicit declaration of function ‘msnprintf’; did you mean ‘vsnprintf’? [-Wimplicit-function-declaration]
 2409 |           msnprintf(buffer, sizeof(buffer), "%" CURL_FORMAT_CURL_OFF_T "-",
      |           ^~~~~~~~~
      |           vsnprintf
curl/src/tool_getparam.c:2409:11: warning: nested extern declaration of ‘msnprintf’ [-Wnested-externs]
[...]
```

Reported-by: Daniel Stenberg
Bug: https://github.com/curl/curl/pull/14626#issuecomment-2301663491

Closes #14632
2024-08-22 10:45:04 +02:00
Daniel Stenberg
6292a332f8
RELEASE-NOTES: synced 2024-08-22 09:44:54 +02:00
Daniel Stenberg
b000cdfb2c
CURLOPT_XFERINFOFUNCTION: clarify the callback return codes
also done in CURLOPT_PROGRESSFUNCTION.md

This changes the wording to say that 1 should be returned instad of
non-zero to return error from the callback. I did this to simplify, even
if other non-zero values still do the same thing I figure we might just
as well just leave out the others from the documentation.

Fixes #14627
Reported-by: Benjamin Riefenstahl Mecom
Closes #14637
2024-08-22 09:20:53 +02:00
Viktor Szakats
9724526429
lib: delete stray undefs for vsnprintf, vsprintf
Stop #undefining macros that were not redefined or used in the code.

Closes #14631
2024-08-22 00:01:29 +02:00
Viktor Szakats
b3e1fe6dd6
cmake: tidy up option descriptions
- capitalize.
- impartive voice.
- stick to `Build ...`, `Use ...`, `Enable ...`, `Disable ...` with
  a couple of exceptions.
- drop period.
- fix wolfSSH, WebSockets casing.

Closes #14636
2024-08-21 23:36:12 +02:00
Viktor Szakats
a62e3be67d
cmake: honor custom CMAKE_UNITY_BUILD_BATCH_SIZE
This value tells how many sources files to bundle in a single "unity"
compilation unit.

The CMake default is 8 sources, curl's CMake set this to 0, meaning
to bundle all sources into a single unit.

This patch makes it possible to override the 0 value, and potentially
optimize the build process further by better utilizing multiple cores
in conjunction with `make -jN`.

The number of sources in lib is 172 at the time of writing this. For
a 12-core CPU, this can give a job for them all:
`-DCMAKE_UNITY_BUILD_BATCH_SIZE=15`

(Compile time may be affected by a bunch of other factors.)

Closes #14626
2024-08-21 23:32:52 +02:00
Viktor Szakats
9fff0742b6
GHA/windows: fix indentation in the MSVC section 2024-08-21 16:13:11 +02:00
Daniel Stenberg
b0b4b481b5
setopt: allow CURLOPT_INTERFACE to be set to NULL
Ref: https://github.com/curl/curl/discussions/14299#discussioncomment-10393909
Regression from 3060557af7 (shipped in 8.9.0)

Closes #14629
2024-08-21 14:33:51 +02:00
Viktor Szakats
3065f106e3
build: add iphlpapi lib for libssh on Windows
vcpkg doesn't need it because it fixes this with a libssh patch.
All other Windows builds need it.

(autotools build not tested.)

Closes #14618
2024-08-21 10:07:13 +02:00
Viktor Szakats
576b39b6d0
cmake: drop libssh CONFIG-style detection
Drop `find_package(libssh CONFIG)` detection method in favour of
the Find module that supports both `pkg-config`, and CMake-native
(since #14555) detection.

This aligns `libssh` detection with other dependencies. It makes the
build honor custom configuration via `LIBSSH_INCLUDE_DIR`,
`LIBSSH_LIBRARY`.

Also enable libssh in a GHA/macos cmake job for build coverage.

Fixing:
- curl-for-win requiring a hack to configure libssh:
  4f9acbed92/curl.sh (L255-L263)
- after #14555, GHA/windows gnutls vcpkg job no longer auto-detected
  libssh, due to a regression missing to enable libssh when
  found via `find_package(libssh CONFIG)`.
  Ref: https://github.com/curl/curl/actions/runs/10470138955/job/28994650338

Follow-up to 422696f0a4 #14555

Closes #14614
2024-08-21 10:07:13 +02:00
Jay Satiro
778391334e unit1300: fix checksrc longline warnings
Closes https://github.com/curl/curl/pull/14624
2024-08-21 03:37:29 -04:00
Jay Satiro
c8d71e598d http2: fix GOAWAY message sent to server
- fix typo in GOAWAY debug message "shutown" -> "shutdown"

Closes https://github.com/curl/curl/pull/14623
2024-08-21 03:36:50 -04:00
Jay Satiro
eb5c3f3707 buildconf.bat: fix tool_hugehelp.c generation
- Fix showhelp() function prototype in tool_hugehelp.c.cvs.

Follow-up to 9a0cf564 which added the function.

Closes https://github.com/curl/curl/pull/14622
2024-08-21 03:36:18 -04:00
Viktor Szakats
81a0861463
cmake: fixup linking libgsasl when detected via CMake-native
Found in local tests.

Follow-up to 422696f0a4 #14555
which added CMake-native detection.
2024-08-21 09:21:41 +02:00
Viktor Szakats
fc8575ed4a
tidy-up: spelling wolfSSL [ci skip] 2024-08-21 08:53:11 +02:00
Jan Venekamp
7ca719deef
mbedtls: fix incorrect macro condition mbed_dump_cert_info
Follow-up to 88cae14550
2024-08-21 07:50:31 +02:00
Daniel Stenberg
69b50017a4
docs/SSLCERTS: rewrite
cleanup, modernize, refresh

Remove libcurl solutions, only do curl command lines.

Closes #14616
2024-08-21 07:48:57 +02:00
Viktor Szakats
8e9056f8b1
GHA/macos: enable brotli and zstd in autotools and cmake jobs
They were missing from macOS builds:
https://testclutch.curl.se/static/reports/feature-matrix.html

Closes #14619
2024-08-21 07:11:34 +02:00
Viktor Szakats
2e88ef1049
version: fix shadowing a libssh.h symbol
```
/Users/runner/work/curl/curl/lib/version.c: In function 'curl_version_info':
/Users/runner/work/curl/curl/lib/version.c:584:15: error: declaration of 'ssh_buffer' shadows a global declaration [-Werror=shadow]
  584 |   static char ssh_buffer[80];
      |               ^~~~~~~~~~
In file included from /Users/runner/work/curl/curl/lib/vssh/ssh.h:35,
                 from /Users/runner/work/curl/curl/lib/urldata.h:185,
                 from /Users/runner/work/curl/curl/lib/altsvc.c:32,
                 from /Users/runner/work/curl/curl/bld/lib/CMakeFiles/libcurl_shared.dir/Unity/unity_0_c.c:4:
/opt/homebrew/include/libssh/libssh.h:99:35: note: shadowed declaration is here
   99 | typedef struct ssh_buffer_struct* ssh_buffer;
      |                                   ^~~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/10477958747/job/29020250670#step:9:48

Tested via #14614

Closes #14617
2024-08-20 23:22:26 +02:00
Viktor Szakats
ac207bf567
ssh: deduplicate SSH backend includes (and fix libssh cmake unity build)
For libssh, it fixes a "unity" build issue where libssh deprecation
warnings were not suppressed before this patch, because the suppression
macro was only set before just one of the two `libssh.h` includes.
If the other was compiled first in unity mode, the warnings appeared.

Seen in local curl-for-win build (`CW_CONFIG=test-x64-libssh-quictls`)
with libssh 0.11.0. (Also in a GHA/macos cmake job upcoming in #14614)

Use this opportunity to drop duplicate SSH header includes from the SSH
modules. It's enough to include them via the common `ssh.h` header.

Closes #14612
2024-08-20 21:34:24 +02:00
Viktor Szakats
440d00d17e
tidy-up: spelling 'built-in'
Closes #14613
2024-08-20 21:32:40 +02:00
Dan Fandrich
e83c83807d build: improve compiler version detection portability
POSIX sed doesn't support extended regular expressions, so convert a
call to the basic format. This caused a problem on AIX. Also, use the
detected sed binary name instead of hard-coding one.
2024-08-20 11:02:31 -07:00
Viktor Szakats
ae2c753a88
GHA/windows: add missing time limit for msys2 autotools test runs
The new mingw job (the first msys2/mingw job to run tests) is seen
hanging frequently.

Follow-up to 9f23c8f201 #14541
2024-08-20 16:02:15 +02:00
Jan Venekamp
0cbfce802d
tests: add test_17_09_ssl_min_max
Test setting all combinations of --tlsv1.x and --tls-max.

Closes #14590
2024-08-20 12:48:36 +02:00
Jan Venekamp
3ca38f9a5e
tests: improve test_17_07_ssl_ciphers
Change TLS proto version on the test httpd server to test setting
combinations of --tls13-ciphers and --ciphers.

To not let the changed config of the httpd server bleed into the next
test, clean and reload on each test. Because a reload is slow, only
do this if the config is different than the loaded config. For this
the httpd.reload_if_config_changed() method is added.

Overloading of autouse fixtures does not seem to work. For the test
httpd server to be reloaded with a clean config in test_18_methods,
to not be affected by the config changes in test_17_ssl_use, the two
class scope fixtures of test_18_methods are now combined.

Closes #14589
2024-08-20 12:46:13 +02:00
Jan Venekamp
925aea1aba
mbedtls: no longer use MBEDTLS_SSL_VERIFY_OPTIONAL
With mbedTLS if the minimum version of TLS is set to 1.3,
MBEDTLS_SSL_VERIFY_OPTIONAL is not available in client mode. See:
https://github.com/Mbed-TLS/mbedtls/blob/2ca6c285/library/ssl_tls.c#L1357
Also, there might be plans to remove it completely in future mbedTLS
versions.

Switch to always use MBEDTLS_SSL_VERIFY_REQUIRED. If verifypeer or
verifyhost are disabled the corresponding error flags are cleared in the
verify callback function. That is also where verification errors are
logged.

Closes #14591
2024-08-20 12:45:06 +02:00
renovate[bot]
e8bfa96393
GHA: update github/codeql-action digest to 883d858
Closes #14608
2024-08-20 12:37:37 +02:00
Viktor Szakats
422696f0a4
cmake: migrate dependency detections to Find modules
For: libgsasl, libidn2, libssh, libuv.

The new Find modules retain using `pkg-config` natively, not as a "hint"
for the CMake-native detection. Of the pre-existing Find modules, only
FindNettle, and FindGSS (with customized code) work this way. Align
detection code for the new modules and add version detection for the
CMake-native paths.

Also, add CMake-native detection for `libgsasl`.

The remaining outlier in `CMakeLists.txt` is GnuTLS, which has
a CMake built-in Find module, but which lacks `pkg-config` support,
required for vcpkg. It remains unchanged.

Another part-outlier is `libssh`, which keeps requiring the trick
`find_package(libssh CONFIG QUIET)` for reasons I could not yet figure
out.

Closes #14555
2024-08-20 11:38:40 +02:00
Viktor Szakats
cd683f9071
cmake: add find_package() missing from USE_MSH3 option
The original patch added the Find module and CMake option. But the logic
missed a `find_package(MSH3)` call to use that Find module, leaving the
referenced `MSH3_INCLUDE_DIRS`, `MSH3_LIBRARIES` variables undefined.

Blind fix.

Follow-up to 37492ebbfa #8517

Closes #14609
2024-08-20 11:38:27 +02:00
Sam Jessup
d8cefac245
cf-socket: prevent KEEPALIVE_FACTOR being set to 1000 for Windows
Fixes #14368
Reported-by: feelingseas on github
Closes #14606
2024-08-20 09:24:12 +02:00
Daniel Stenberg
26e9d3a896
curl: find curlrc in XDG_CONFIG_HOME without leading dot
If XDG_CONFIG_HOME is set, look for XDG_CONFIG_HOME/curlrc - without a
leading dot in the filename.

Fixes #12129
Reported-by: Jat Satiro
Closes #14600
2024-08-20 08:44:44 +02:00
Viktor Szakats
96b9027f16
GHA/windows: unblock TFTP MQTT WebSockets SMTP FTP tests
Run them now. Also ignore results for now.

Closes #14607
2024-08-20 00:50:24 +02:00
Viktor Szakats
c555ab469d
cmake: limit pkg-config to UNIX and MSVC+vcpkg by default
Limits `pkg-config` to UNIX and MSVC with vcpkg, by default. Compared to
curl 8.9.1, this unlocks `pkg-config` on MSVC with vcpkg.

This condition might be updated in the future depending on where
`pkg-config` can be useful without breaking things. (e.g. to non-cross
MINGW, or all MINGW).

In the meantime everyone is free to override the default and test their
build with `pkg-config` by setting the `CURL_USE_PKGCONFIG=ON` CMake
option.

Closes #14575
2024-08-20 00:50:11 +02:00
Viktor Szakats
211cbcb4f6
cmake: rename Find modules
- `FindCARES`   -> `FindCares`
- `FindLibPSL`  -> `FindLibpsl`
- `FindLibSSH2` -> `FindLibssh2`
- `FindQUICHE`  -> `FindQuiche`
- `Findrustls`  -> `FindRustls`

Our convention for naming Find modules (the part after the `Find`
prefix, also called as 'package name') is:

Always start with uppercase. Follow with lowercase, unless there is
a clear preference for a stylized name. E.g. the project itself uses it
that way with a matching `<Name>Config.cmake` file, or we use it that
way elsewhere, or the name is an acronym.

Ref: #14580

Closes #14601
2024-08-20 00:50:10 +02:00
Viktor Szakats
3a2e47afb7
cmake: fix Find module and package names
- fix BearSSL warning about name mismatch.
- fix Nettle Find module not found on Linux.
- tidy-up: drop quotes from a package name.

Package names must match case-sensitively to work on all platforms:
- `find_package(<NAME> ...)` in `CMakeLists.txt`.
- `CMake/Find<NAME>.cmake` filenames.
- `find_package_handle_standard_args(<NAME> ...` in Find modules.
- `message(STATUS "Found <NAME> ...` in Find modules.
  (to match the message shown by `find_package_handle_standard_args()`)

Closes #14599
2024-08-20 00:44:43 +02:00
Viktor Szakats
c5cb8e7c7e
tidy-up: spelling quiche and Rustls
Closes #14605
2024-08-20 00:44:10 +02:00
Viktor Szakats
0fb4e59269
tidy-up: adjust casing of project names (continued)
Replace remaining `LibSSH2` with `libssh2`.

Follow-up to 6343034dd1 #14160

Closes #14602
2024-08-20 00:44:04 +02:00
Daniel Stenberg
a5598b6fcb
pingpong: drain the input buffer when reading responses
As the data might be held by TLS buffers, leaving some and expecting to
get called again is error prone.

Reported-by: ralfjunker on github
Fixes #14201
Closes #14597
2024-08-19 23:31:38 +02:00