Commit Graph

34384 Commits

Author SHA1 Message Date
Viktor Szakats
dbf5fbd4a0
configure: delete unused HAVE_OPENSSL3 macro
Closes #14672
2024-08-26 11:01:11 +02:00
Viktor Szakats
c190338e0f
build: delete unused REQUIRE_LIB_DEPS
Unused since 97aca0971d #5808

Closes #14671
2024-08-26 11:00:57 +02:00
Viktor Szakats
573e7e827e
lib, src: delete stray curl_ prefix from printf calls
Also:
- unit1398: delete redundant `curl/mprintf.h` include.

Closes #14664
2024-08-26 11:00:15 +02:00
Viktor Szakats
8b09138083
cmake: minor tidy-ups
- show `OpenSSL v3+` when detected (as in `./configure`).
  (this string also makes its way to `curl-config`.)
- prefer `unset(VAR)` over `set(VAR)`.
  Same effect, but `unset()` tells the intent unambiguously.
  https://cmake.org/cmake/help/latest/command/set.html
- drop "implementation" from an `option()` description.
- FindGSS: replace legacy keyword alias with modern alternative.
  https://cmake.org/cmake/help/latest/command/get_filename_component.html
- move `CURL_STATIC_CRT` logic next to its `option()`.
- improve order of `libcurl.pc`/`curl-config` variable init lines.
- tests: drop/shorten custom target names.
  They inflated generated make files by 550KB.
  Keep target name logic for sync between code snippets.
  Follow-up to a2ef5d36b3 #14660
- clear a variable after use.
- restore `STATUS` for `Features:`/`Protocols:` `message()`s:
  Without it the output goes to stderr, and appears in red in CMake GUI.
  It doesn't seem possible to show a line on stdout without leading
  underscores to match `curl -V` and `./configure` output.
  Partial revert of acbc6b703f #14197
- WindowsCache: move `HAVE_LINUX_TCP_H` into the header group.
- move strings to the same line as their `STRING` keyword.
- formatting in generated code.
- delete bogus comment.
- unfold lines for readability.
- fix a too long line. (for cmakelint)
- missing quotes, whitespace, comments.

Closes #14610
2024-08-26 11:00:08 +02:00
renovate[bot]
5d4d1c712f
GHA: update CI dependencies
- update github/codeql-action digest to 2c779ab
- update awslabs/aws-lc to v1.34.2
- update ngtcp2/nghttp3 to v1.5.0
- update ngtcp2/ngtcp2 to v1.7.0

Closes #14638
Closes #14639
Closes #14675
Closes #14676
2024-08-25 23:39:02 +02:00
Daniel Stenberg
dacd483a78
README: refresh
- call them "manpages", not "man pages" and drop the .1 and .3
- replace link to "manual" with a link to everything curl
- remove the link to the FAQ
- add a new "open source "subtitle for the license link, and rephrase
- mention and link GitHub services in the contact section
- rename the "git" subtitle to "source code"
- shorten the source code section somewhat

Closes #14663
2024-08-25 23:31:53 +02:00
Dan Fandrich
6f35226415 tests: tweak use of impacket in smbserver
The missing message only uses a single line now and has a consistent
prefix making it easier for log parsers to skip. Remove a precheck test
looking for impacket in test1451 because it's incomplete, unnecessary
and in the wrong layer; the test harness will automatically discover
that the smbserver won't start and the test was only checking a single
dependency.  Also update the tests README to no longer mention Python 2.
The servers were switched to Python 3 several years ago and no attempt
is being made to maintain Python 2 compatibility

Closes #14669
2024-08-23 17:06:36 -07:00
Viktor Szakats
4b791dca37
GHA/macos: ignore flaky tests 2041 and 2037
- FAIL 2037: 'simple HTTPS GET with PEM public key pinning' HTTPS, HTTP GET, PEM certificate
  https://github.com/curl/curl/actions/runs/10529314166/job/29176801513?pr=14658

- FAIL 2041: 'simple HTTPS GET with base64-sha256 public key pinning' HTTPS, HTTP GET, PEM certificate
  https://github.com/curl/curl/actions/runs/10529181645/job/29176408976#step:16:4363
  https://github.com/curl/curl/actions/runs/10529019749/job/29175882809#step:13:5235
  https://github.com/curl/curl/actions/runs/10528920874/job/29175559070#step:16:4363
  https://github.com/curl/curl/actions/runs/10528759817/job/29175043048#step:16:4274
  https://github.com/curl/curl/actions/runs/10525250422/job/29163662307#step:16:4366
  https://github.com/curl/curl/actions/runs/10525250422/job/29163662602#step:13:3569

  Happened with cmake, autotools, gcc, clang and various TLS backends.

Follow-up to fa461b4eff #14486

Closes #14667
2024-08-23 21:04:05 +02:00
Viktor Szakats
8aadb8308a
GHA/windows: add Linux -> mingw-w64 cross-build (cmake, autotools)
Also:
- add a line to CMake log output showing the host and target OS and CPU
  when doing cross-builds.
- reduce excessive timeout for `curl -V` steps.

Closes #14661
2024-08-23 18:42:56 +02:00
Viktor Szakats
a2ef5d36b3
cmake: sync code between test/example targets
- reuse local variable names.
- sync `PROJECT_LABEL`, add where missing.
- namespace all target names.
- bind header directories to each target.
- tests/server: limit `CURL_STATICLIB` to Windows (as in autotools.)
- drop functions with a single caller.

Closes #14660
2024-08-23 18:42:56 +02:00
Viktor Szakats
f73f6bf9f8
GHA: add yamlcheck
Uses `yamllint`.

Also:
- fix warning for existing YAML files:
  ```
  [truthy] truthy value should be one of [false, true]
  ```

Closes #14650
2024-08-23 18:42:55 +02:00
Dan Fandrich
5629bb7cf6 CI: consolidate workflows for source and docs check
A bunch of tiny jobs that run various source or documentation checks are
consolidated into two workflow files: checksrc.yml and checkdocs.yml.
This reduces the proliferation of new files containing one-line checks
and brings those that operate similarly together for better reasoning
about them. The man-examples check is also now running again for the
first time in 7 months.

Various calls to find, xargs and git ls-files are changed where possible
to use NUL line terminators in pipes to avoid issues with oddly-named
files that might find their way into the repo.

Closes #14654
2024-08-23 09:00:08 -07:00
Dan Fandrich
6429ce8e5f docs: fix some examples in man pages
The man-examples job hasn't been running for a few months to verify
that these compile, so some mistakes slipped in.

Ref: #14654
2024-08-23 09:00:08 -07:00
Daniel Stenberg
4d5d171ace
RELEASE-NOTES: synced 2024-08-23 14:08:26 +02:00
Daniel Stenberg
d1394a00ea
urlapi: verify URL *decoded* hostname when set
It was previously wrongly verifying the input in its URL encoded format
when setting the hostname component with curl_url_set(), so it wrongly
rejected '%'.

Now it URL decodes the name appropriately before the check.

Added tests to lib1560 to verify that a fine %-code is okay and that a
bad %-code (that decodes to '%') is rejected.

Regression from 0a0c9b6dfa, shipped in 8.0.0

Fixes #14656
Reported-by: Venkat Krishna R
Closes #14657
2024-08-23 13:55:13 +02:00
Aki
fa461b4eff
GHA/macos: enable HTTPS tests with stunnel
- Install stunnel.

- Regenerate certificates (as SecureTransport requires a validity period
  less than 398 days).

- Restart server if it is unresponsive.

- Do not hardcode the SHA-256 base64 public pinned key.

- Ignore test 313 as SecureTransport does not support crl file.

- Ignore tests 1631 and 1632 as SecureTransport is not yet able to shut
  down FTP over HTTPS gracefully.

- Add a CMake target for generating certificates.

Closes #14486
2024-08-23 11:06:50 +02:00
Viktor Szakats
7c0b6eb3bd
cmake: respect cflags/libdirs of native pkg-config detections
In Find modules with native pkg-config detection (libgsasl, libidn2,
libssh, libuv, nettle) use the C compiler flags returned by pkg-config.
Also use the library paths, and return the pathless library names.

Also:
- add these library paths to `libcurl.pc`/`curl-config`.
- fix libgsasl detection to use the detected header directory.

FindGSS already did this before this patch.

Fixes #14641

Closes #14652
2024-08-23 10:43:43 +02:00
Viktor Szakats
4f09967a3c
cmake/FindGSS: bring closer to other Find modules
- add pkg-config-specific 'Found' message to the Find module.

- update non-pkg-config 'Found' message to show the flavour instead of
  the library name. (= the first value listed after `REQUIRED_VARS`)

- delete extra 'Found' message from `CMakeLists.txt`.

- rename internal result variables to match with default pkg-config
  names, in preparation of introducing them in other Find modules:
  - `GSS_LINK_DIRECTORIES` -> `GSS_LIBRARY_DIRS`
  - `GSS_LINKER_FLAGS` -> `GSS_LDFLAGS`
  - `GSS_COMPILER_FLAGS` -> `GSS_CFLAGS`

  Ref: #14652

Closes #14651
2024-08-23 10:43:43 +02:00
Jan Venekamp
df15d9ff26
gha labeler: make labeler.yml human-readable
Split the strings containing the globs over multiple lines, with
each line having one glob.

Closes #14649
2024-08-23 08:48:20 +02:00
Daniel Stenberg
dbc4b70723
FEATURES.md: fix typo
Fixes #14653
Reported-by: Jason Hood
Closes #14655
2024-08-23 08:46:09 +02:00
Daniel Stenberg
3b057d4b7a
test1521: verify setting options to NULL better
Previously this test allowed several error values when setting options.
This made this test miss #14629.

Now, errors are generally not accepted for setopts:

 - numerical setopts accept CURLE_BAD_FUNCTION_ARGUMENT for funny input
 - the first setopt to an option accepts CURLE_NOT_BUILT_IN or
   CURLE_UNKNOWN_OPTION for when they are disabled/not built-in
 - there is an allowlist concept for some return code for some variables,
   managed at the top of the mk-lib1521.pl script

In curl.h: remove the OBSOLETE named values from the setopt list.

Closes #14634
2024-08-23 08:24:34 +02:00
Daniel Stenberg
17dde53968
setopt: make CURLOPT_TFTP_BLKSIZE accept bad values
... and just move them into the accepted range. Like how buffersize and
a few other options work.

Closes #14634
2024-08-23 08:24:33 +02:00
Daniel Stenberg
05609bac95
setopt: let CURLOPT_ECH set to NULL reset to default
Because NULL is documented as default and most options that take
pointers accept NULL to reset back to internal default.

Closes #14634
2024-08-23 08:24:33 +02:00
Daniel Stenberg
20d447c1a7
getinfo: return zero for unsupported options (when disabled)
instead of returning an error code to the getinfo() call. Like other
info variables work.

Closes #14634
2024-08-23 08:24:33 +02:00
Viktor Szakats
4be599fe78
src: replace copy of printf mappings with an include
Closes #14648
2024-08-23 00:11:24 +02:00
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