Commit Graph

34209 Commits

Author SHA1 Message Date
Daniel Stenberg
cbc39a88d7
setopt_cptr: make overflow check only done when needed
An overflow check for if the value of a curl_off_t is larger than a
size_t can hold, is only necessary if the two types are actually
differently sized, now checked by the preprocessor. To avoid
"Unreachable Conditional".

Closes #15439
2024-10-29 09:25:29 +01:00
Viktor Szakats
1a2d38c47c
GHA/windows: avoid curl.exe libtool wrapper
Avoid the `curl.exe` wrapper binary created by libtool, and run the real
`curl.exe` directly for tests and version information.

This solution was used in Azure jobs. I missed it when migrating jobs
to GHA.

Applies to tests run in the `mingw, AM x86_64 c-ares U` job, which has
seen unexplained flakiness.

Ref: 354afc891d #6049
Follow-up to e53523fef0 #14859

Closes #15437
2024-10-29 09:20:37 +01:00
Viktor Szakats
ef7399b8b5
runtests: pass single backslashes with Windows Perl
handle/handle64 requires a literal match with the filenames it's
listing.

Also:
- make handle64 log messages more unique to help text searches.
- update a comment with Windows Perl info.

Cherry-picked from #14949
Closes #15436
2024-10-29 09:20:37 +01:00
Daniel Stenberg
cd2b45201a
src/lib: remove redundant ternary operators
Closes #15435
2024-10-29 08:18:30 +01:00
Daniel Stenberg
080973dcdb
lib: msnprintf tidy-ups
doh: avoid an msnprintf()

openssl: skip a superfluous return code check

Closes #15434
2024-10-28 22:56:11 +01:00
Daniel Stenberg
cb011ac096
tls: avoid abusing CURLE_SSL_ENGINE_INITFAILED
That error code was introduced and has been used for OpenSSL ENGINE
things and not others, so switch the other use cases over to other TLS
related error codes.

Closes #15430
2024-10-28 16:13:14 +01:00
Daniel Stenberg
974f6bcf80
RELEASE-NOTES: synced 2024-10-28 16:01:08 +01:00
Stefan Eissing
701813b23f
tests/http: add --insecure tests
Add two test cases that connection using a hostname the server has no
certificate for. First, verify that the peer verification fail, as
expected. Second, provide '--insecure' to test that the connection
succeeded and returned some data.

Closes #15429
2024-10-28 13:04:28 +01:00
Stefan Eissing
0e0c8cdf89
tests/scorecard: allow remote server test
New args for scorecard.py:
* --remote ip:port to run tests against a remote server
* --start-only: to only start the servers, listing their ports

Start the server using "scorecard.py --start-only" on one machine and
then run the tests with "scorecard.py --remote ip:port" against that
machine.

Closes #15415
2024-10-28 11:41:19 +01:00
Daniel Stenberg
770702fa3d
CI: bump wolfSSH and wolfSSL
- wolfSSH 1.4.18
- wolfSSL 5.7.4

Closes #15427
2024-10-28 09:38:37 +01:00
Daniel Stenberg
80aa1fe462
tool_getparam: drop unused time() call
The second argument to curl_getdate() once took a time argument, but
that feature has been gone for decades, thus passing in a date there
makes no difference.

Closes #15420
2024-10-27 23:32:34 +01:00
Viktor Szakats
398025a41f
appveyor: fix job names, tidy-up
- add 'Shared' to job names where missing.
- dedupe setting the default `HTTP_ONLY` env.
- fix typo in job name.

Cherry-picked from #15414
Closes #15422
2024-10-27 14:26:45 +01:00
Viktor Szakats
1db9af2b9e
cmake: tweaks around debug mode and hidden symbols
- emit warning for `ENABLE_DEBUG` builds.

- add words to clarify that `ENABLE_DEBUG` is meant for developing curl
  itself.

- add comment saying `CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON`
  CMake option may export extra, non-curl symbols.
  Ref: https://github.com/microsoft/vcpkg/issues/41761
  Unexplained exports seen also in curl CI:
  ```
  [ 742] _tcschr
  [ 743] _tcsncmp
  [ 744] _tcsncpy
  [ 745] _tcspbrk
  ```
  https://ci.appveyor.com/project/curlorg/curl/builds/50864041/job/lolledrg4h7hu6e4?fullLog=true#L2160
  CMake extracts these symbols from `.obj` files:
  https://gitlab.kitware.com/cmake/cmake/-/issues/22092#note_943718
  I have not found any new MSVC option that helps fixing this without
  decorating all functions in-source or maintaining a manual list of
  internal function names used for tests:
  https://learn.microsoft.com/cpp/build/reference/wholearchive-include-all-library-object-files

Closes #15414
2024-10-27 14:26:45 +01:00
Viktor Szakats
0da1489eb9
build: disable warning -Wunreachable-code-break
This warning remains silent in unity builds. Since we're using unity
in CI for most jobs, warnings remain undetected there.
Disable them for all builds to avoid a surprise warning outside our CI.

The issue caught by the warning is useful for a tidy codebase, but
doesn't affect executed code. It was enabled in
84338c4de2 #12331 (2023-11-15).

llvm source: fee2953f23/clang/lib/Sema/AnalysisBasedWarnings.cpp (L125-L134)
llvm issue: https://github.com/llvm/llvm-project/issues/71046

Follow-up to 7c023c3f6e #15384
Closes #15416
2024-10-27 14:11:18 +01:00
Daniel Stenberg
e77326403d
multi: split multi_runsingle into sub functions
Introduce five functions named after the state they serve:

- state_connect for MSTATE_CONNECT
- state_do for MSTATE_DO
- state_performing for MSTATE_PERFORMING
- state_ratelimiting for MSTATE_RATELIMITING
- state_resolving for MSTATE_RESOLVING

Closes #15418
2024-10-27 10:59:50 +01:00
Daniel Stenberg
522c89a134
lib: remove Curl_ prefix from static functions
'Curl_' is a prefix used for library global functions (cross-files).
Static functions should thus not use it.

Closes #15419
2024-10-27 10:57:21 +01:00
Daniel Stenberg
1160380e50
docs: clarify FTP over HTTP proxy functionality somewhat
Reported-by: newfunction

Closes #15417
2024-10-26 23:45:32 +02:00
Viktor Szakats
0910a412a9
cmake: fix missing spacing in log message
Follow-up to e89491e1f0 #15337
Closes #15411
2024-10-25 15:04:36 +02:00
Viktor Szakats
aafc074f87
cmake: clear package version after pkg-config detection
`pkg_check_modules()` seems to leave `<PACKAGE>_VERSION` defined with an
empty value, if the package is not found.

When the package is also not found in the fallback branch,
`find_package_handle_standard_args()` logs and error message. In this
message it includes the bogus empty value as: `(found version "")`:
```
Could NOT find Libssh2 (missing: LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY) (found version "")
```
https://github.com/curl/curl/actions/runs/11509727553/job/32040378958?pr=15408#step:31:99

Clear the version number to avoid the confusion:
```
Could NOT find Libssh2 (missing: LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY)
```
https://github.com/curl/curl/actions/runs/11510022503/job/32041149129?pr=15408#step:31:99

Seen with CMake v3.30.5.

Follow-up to 7bab201abe #15193
Closes #15409
2024-10-25 15:04:35 +02:00
Viktor Szakats
b8c12634fc
INSTALL-CMAKE: fix punctuation and a typo [ci skip] 2024-10-24 23:21:00 +02:00
Viktor Szakats
f66af623cf
cmake: document -D and env build options
Extend `INSTALL-CMAKE` document with the list of available options,
a short description and default values.

The list may not be 100% complete.

There are no component boundaries in CMake, so the line is blurry
between curl options, CMake options, CMake Find modules options.
I included certain CMake options that seemed useful, and/or have
dedicated use withing curl's CMake source. But, all CMake built-in
options are usable, as documented upstream in CMake.

The naming of the options has a heritage and the inconsistencies with
it, including a lack of clear namespace. This may be subject to future
updates, also after figuring out which name has special meaning within
CMake and/or CMake projects out of unwritten convention or something
more tangible.

CMake allows to initialize any internal variable via `-D`. This may be
useful to pre-initialize/override feature check results. The list
doesn't contain these, and they remain officially undocumented.

Also:
- make adjustments to keep the spellchecker happy.
- retrofit description changes to the cmake sources.
- stop documenting deprecated `Find*` variables.

Reported-by: Daniel Stenberg
Fixes https://github.com/curl/curl/discussions/14885
Closes #15388
2024-10-24 23:06:40 +02:00
Viktor Szakats
ffc4e6a886
cmake: mark as advanced some internal Find* variables
To sync with other similar variables and hide them from cmake UIs.

Follow-up to 7bab201abe #15193
Closes #15407
2024-10-24 23:06:40 +02:00
Viktor Szakats
45862f2221
cmake: tidy up and shorten symbol hiding initialization
- drop redundant local variables.

- drop extra Intel C feature check that always returned success due
  to not passing the tested compiler option. Nobody reported an issue
  with this since 2016, suggesting the version check alone is enough.

Closes #15400
2024-10-24 22:12:58 +02:00
Viktor Szakats
1da1fcc43d
cmake: tidy up picky warning initialization
- use CMake 3.12 syntax when available, in clang-cl branch.
  Follow-up to e89491e1f0 #15337

- rename internal variables to underscore-lowercase.
  Follow-up to d8de4806e1 #14571

- update comment.

Closes #15404
2024-10-24 21:20:04 +02:00
Viktor Szakats
fff6afb0f8
cmake: rename local variables to underscore-lowercase
Also drop `_curl` prefix, which isn't necessary for underscore variables
and wasn't used in most other cases.

Follow-up to d8de4806e1 #14571
Closes #15397
2024-10-24 21:20:03 +02:00
Viktor Szakats
f48609d4c1
cmake: limit CURL_STATIC_CRT to MSVC
`CURL_STATIC_CRT` supports MSVC only. Limit its effect to this compiler.

Closes #15403
2024-10-24 19:16:10 +02:00
Viktor Szakats
c9b54fadd7
cmake: use list(APPEND) on CURL_INCLUDES
It does the same as the `set()` used before this patch.
Makes the code easier to read.

Closes #15399
2024-10-24 19:16:10 +02:00
Viktor Szakats
7e94680c9a
cmake: tidy up CURL_DISABLE_FORM_API initialization
Initialization of `CURL_DISABLE_FORM_API` depends on another option.
Make sure the other option is initialized before this one.

Due to the defaults and logic this did not cause an issue.

Also fix the order of two other lines to match with the rest.

Closes #15394
2024-10-24 19:16:10 +02:00
Viktor Szakats
ec68fb5a6c
cmake: drop obsolete items from TODO and INSTALL-CMAKE
- INSTALL-CMAKE: delete `Current flaws in the curl CMake build` section.
  #1123 was fixed in 7e93637acd #2443

- TODO: delete item 3.2.
  Follow-up to 1cb4f5d6e8 #1879

Closes #15405
2024-10-24 19:13:10 +02:00
Daniel Stenberg
02ac5547c7
docs/libcurl/opts/Makefile.inc: alphasort the options list 2024-10-24 16:20:36 +02:00
Daniel Stenberg
469f53686a
curl: detect ECH support dynamically, not at build time
Closes #15402
2024-10-24 16:10:39 +02:00
Stefan Eissing
8cb2d5f48a
quic: use the session cache with wolfSSL as well
Use session cache for QUIC when built with quictls or wolfSSL.

Add test_017_10 for verifying QUIC TLS session reuse when built with
quictls, gnutls or wolfssl.

Closes #15358
2024-10-24 14:55:23 +02:00
Kazuho Oku
b34b757c2e
ngtcp2: set max window size to 10x of initial (128KB)
Just as the quiche backend does

Closes #15392
2024-10-24 14:47:26 +02:00
Stefan Eissing
358eae42a4
bearssl: improved session handling, test exceptions
Add length to session saves, making it clear that we are storing a byte
blob and allowing memcmp() on sameness check.

Remove some pytest skips for bearssl to see if they now work properly in
CI.

Closes #15395
2024-10-24 14:40:01 +02:00
Stefan Eissing
30f66c8ba4
mbedtls: handle session as blobs
Use mbedtls_ssl_session_load() and mbedtls_ssl_session_save() to convert
TLS sessions to byte blobs for the session cache.

Fix a skip message to better indicate why the test is skipped for
mbedtls.

Closes #15398
2024-10-24 14:37:59 +02:00
Daniel Stenberg
3722ed0376
RELEASE-NOTES: synced 2024-10-24 14:35:24 +02:00
Daniel Stenberg
1056889f91
url.md: clarify
- the specified URL can also get data sent to it
- rephrase the scheme guessing part
- mention target options for each URL for saving data
- mention --remote-name-all
- remove "warning" and make it into normal text

Closes #15396
2024-10-24 14:32:13 +02:00
Daniel Stenberg
9255e7a105
version: minor cleanups
- remove typecasts and parentheses in zstd_version()
- create and use oldap_version() for OpenLDAP
- create and use psl_version() for libpsl
- reduce the size of the 40 byte buffers to 30 bytes
- use the brotil/zstd like the others (add the lib name in the functions)
- create and use idn_version for IDN builds
- handle (unlikely) error from ldap_get_option

Closes #15393
2024-10-24 14:04:59 +02:00
Jay Satiro
ac7ae08f02
schannel: reclassify extra-verbose schannel_recv messages
- Create a new macro SCH_DEV() to manage verbose debug messages that are
  only useful for debugging Schannel recv decryption.

schannel_recv contains a lot of useful debug messages to help debug the
function, however in practice they are not otherwise useful and showing
them in debug builds adds a lot of noise.

To show these messages curl must now be built with
CURL_SCHANNEL_DEV_DEBUG defined.

Prior to this change many, but not all, extra-verbose messages were
wrapped in DEBUGF() so they were only shown in debug builds.

Ref: https://github.com/curl/curl/issues/14807

Closes #14826
2024-10-24 10:34:20 +02:00
ArtSin
0325e1b9b2
mprintf: treat %o as unsigned, add tests for %o, %x, %X
`%x` and `%X` were already treated as unsigned, but `%o` was not, even
though it was used with unsigned numbers.

Closes #15348
2024-10-24 10:17:24 +02:00
ArtSin
7ca164faba
mprintf: do not ignore length modifiers of %o, %x, %X
There are uses of `%lx` and `%zx` in the codebase, but `parsefmt`
interpreted them as `%x`.

Closes #15348
2024-10-24 10:16:19 +02:00
Stefan Eissing
f901ab84e6
schannel: ignore error on recv beyond close notify
When receiving data, schannel does a recv from the lower filters, e.g.
the socket, *before* it decrypts and analyses the buffered data it
already has. When that buffer contains a close-notify, e.g. the end of
the TLS stream, any error on the previous receive from the socket are
not applicable to its return codes.

Example from #153345: a server sends a close notify and closes its
connection. The encrypted data, including the close notify is received.
Another receive on the sockets gets a CONNABORTED which curl reports as
CURLE_RECV_ERROR. Schannel analyses its bufferi, sees the close notify
and early returns to the caller. On this return, the error on the
attempted receive does not apply.

Closes #15381
2024-10-24 10:06:40 +02:00
renovate[bot]
38c57bdf0d
GHA: update five dependencies
- rojopolis/spellcheck-github-actions digest to ab8ac45
- nghttp2/nghttp2 to v1.64.0
- actions/cache digest to 6849a64
- github/codeql-action digest to 6624720
- Update actions/checkout digest to 11bd719

Closes #15341
Closes #15346
Closes #15365
Closes #15366
Closes #15387
2024-10-24 10:03:31 +02:00
Daniel Stenberg
59831f8061
tool_operate: split up the huge single_transfer into sub functions
- split up in a few smaller and easier to read functions
- simplify several sections
- avoid superfluous extra allocations
- remove unused debug code

Closes #15385
2024-10-23 23:12:54 +02:00
Daniel Stenberg
30da1f5974
setopt: split Curl_vsetopt() into several sub functions
Reduce the ~3000 line super function into smaller pieces, easier to read and
manage.

Extract the option's argument earlier and use a fixed type instead of using
va_arg() everywhere.

Closes #15376
2024-10-23 23:09:48 +02:00
Viktor Szakats
b3816f67b9
cmake: avoid setting BUILD_TESTING
`BUILD_TESTING` variable is used by other projects and CMake internally.
Replace `cmake_dependent_option()` with `option()` and introduce an
internal variable to track if want and can do testing.

Follow-up to #6036
Follow-up to 3a1e798009 #6072

Reported-by: Robert Maynard
Fixes #15351
Closes #15355
2024-10-23 21:24:02 +02:00
Viktor Szakats
7c023c3f6e
libssh2: delete duplicate break
```
lib/vssh/libssh2.c:2495:7: warning: 'break' will never be executed [-Wunreachable-code-break]
      break;
      ^~~~~
```

CI did not catch it due to llvm skipping this check for all #included
files. It's designed this way to avoid performance issues and false
positive when checking headers:
https://github.com/llvm/llvm-project/issues/71046

Closes #15384
2024-10-23 19:36:04 +02:00
Viktor Szakats
6b440704d8
GHA: drop "3" from openssl names and keys
Also:
- drop patch suffix from cache key for thread-sanitizer local build
  Follow-up to 73d2779196 #15379

Closes #15383
2024-10-23 19:36:03 +02:00
Viktor Szakats
b8de0dadd9
cmake: tidy up line order [ci skip] 2024-10-23 13:13:01 +02:00
Viktor Szakats
5f9411f953
GHA/windows: work around Git for Windows perf regression
Fix the significant perf regression for vcpkg jobs by switching to the
MSYS2 shell environment from Git for Windows. This env is already used
for old-mingw-w64 job that remained unaffected by this issue.

The issue began with the windows-runner update 20241015.1.0. It bumped
Git for Windows from Git 2.46.2.windows.1 to Git 2.47.0.windows.1. GfW
bumped its MSYS2 components, including `msys-2.0.dll`. That's Cygwin
code, which may have contributed to this. Pipes were involved and
`runtests.pl` relies on pipes heavily in parallel mode. (The issue was
not seen with parallel tests disabled, in retrospect.)

This is useful as a permanent solution too. It drop GfW as a dependency
and makes Windows jobs use one less shell/env flavour.

Long term it might help to use native Windows Perl to avoid the MSYS
layer completely, if there is a way to make that work.

Assortment of possibly related links:
https://cygwin.com/pipermail/cygwin/2024-August/256398.html
f78009cb1c
7f3c225325

https://github.com/actions/runner-images/issues/10843
https://github.com/git-for-windows/git/issues/5199
https://github.com/git-for-windows/msys2-runtime/pull/75
7913a41703
555afcb2f3
1c5f4dcdc5

Follow-up to c33174d42f #15364
Follow-up to 1e0305973c #15356

Closes #15380
2024-10-23 13:00:41 +02:00