]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
5 months agocontrithanks.sh: update docs/THANKS in place
Daniel Stenberg [Mon, 24 Feb 2025 10:04:30 +0000 (11:04 +0100)] 
contrithanks.sh: update docs/THANKS in place

Now using 'sort' for sorting the names. This has the small side-effect
that it sorts slightly different than the previously used sort function
(emacs).

I think this is a better sort and over all it makes it more convenient
to use the script as it removes a manual step.

Closes #16448

5 months agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 24 Feb 2025 09:13:06 +0000 (10:13 +0100)] 
RELEASE-NOTES: synced

5 months agohttp: convert parsers to strparse
Daniel Stenberg [Thu, 20 Feb 2025 15:55:13 +0000 (16:55 +0100)] 
http: convert parsers to strparse

Closes #16436

5 months agowolfssl: tls early data support
Stefan Eissing [Tue, 4 Feb 2025 14:24:00 +0000 (15:24 +0100)] 
wolfssl: tls early data support

Enable TLS Early Data for wolfSSL:

- merge WOLFSSL_CTX and WOLFSSL setup from ngtcp2 with the general
  implemenation in wolfssl.c
- enable for QUIC via ngtcp2
- give Curl_vquic_tls_init() a `struct alpn_spec` like used for the TCP
  case. Adapt gnutls and other users.
- enable pytest test cases for early data with wolfSSL

and while this messes up wolfssl.c anyway, do

- rename all struct/functions with prefix 'wolfssl_' to 'wssl_' to not
  pollute that name prefix
- rename `ctx/handle` to `ssl_ctx/ssl`, as used in openssl case

Closes #16167

5 months agocontributors.sh: lowercase 'github' for consistency
Daniel Stenberg [Sun, 23 Feb 2025 23:08:32 +0000 (00:08 +0100)] 
contributors.sh: lowercase 'github' for consistency

also fix contrithanks and THANKS-filter

Ref: #16438
Closes #16443

5 months agoRELEASE-NOTES: fix github casing
Timo Tijhof [Sun, 23 Feb 2025 00:18:56 +0000 (00:18 +0000)] 
RELEASE-NOTES: fix github casing

Follows-up b22f9066a5, which added a new contributor with a different
casing for "github" than the others.

Closes #16438

5 months agoCURLMOPT_SOCKETFUNCTION.md: add advice for socket callback invocation times
Stefan Eissing [Sun, 23 Feb 2025 09:05:41 +0000 (10:05 +0100)] 
CURLMOPT_SOCKETFUNCTION.md: add advice for socket callback invocation times

Explain when a registered socket callback may get invoked to make user
better aware on how to handle it.

Closes #16441

5 months agotool_operate: fail SSH transfers without server auth
Daniel Stenberg [Sat, 22 Feb 2025 12:05:17 +0000 (13:05 +0100)] 
tool_operate: fail SSH transfers without server auth

This now insists on using a server auth option unless --insecure is
provided. As an added bonus, it now also only checks for the knownhosts
file once (if found).

Ref: #16197
Closes #16205

5 months agohttp: make the RTSP version check stricter
Daniel Stenberg [Fri, 21 Feb 2025 22:48:51 +0000 (23:48 +0100)] 
http: make the RTSP version check stricter

- make it only accept version 1.0, as that is the version curl supports
- convert the parser to use strparse
- the status code max is now 999, but it does allow != 3 digits

Closes #16435

5 months agomulti: event based rework
Stefan Eissing [Sat, 22 Feb 2025 11:46:42 +0000 (12:46 +0100)] 
multi: event based rework

Rework the event based handling of transfers and connections to
be "localized" into a single source file with clearer dependencies.

- add multi_ev.c and multi_ev.h
- add docs/internal/MULTI-EV.md to explain the overall workings
- only do event handling book keeping when the socket callback
  is set
- add handling for "connection only" event tracking, when internal
  easy handles are used that are not really tied to a connection.
  Used in connection pool.
- remove transfer member "last_poll" and connections "shutdown_poll"
  and keep all that internal to multi_ev.c
- add CURL_TRC_M() for tracing of "multi" related things, including
  event handling and connection pool operations. Add new trace
  feature "multi" for trace config.
  multi traces will show exactly what is going on in regard to
  event handling.
- multi: trace transfers "mstate" in every CURL_TRC_M() call
- make internal trace buffer 2048 bytes and end the silliness
  with +n here -m there. Adjust test 1652 expectations of resulting
  length and input edge cases.
- add trace feature "lib-ids" to perfix libcurl traces with transfer
  and connection ids. Useful for debugging libcurl applications.

Closes #16308

5 months agotest76: add test with comma-separated list of WWW-Auth methods
Daniel Stenberg [Fri, 21 Feb 2025 15:24:01 +0000 (16:24 +0100)] 
test76: add test with comma-separated list of WWW-Auth methods

The support for this is not 100% but at least this works.

Closes #16425

5 months agosetopt: remove unnecesary void pointer typecasts
Daniel Stenberg [Fri, 21 Feb 2025 15:52:34 +0000 (16:52 +0100)] 
setopt: remove unnecesary void pointer typecasts

Closes #16426

5 months agocmake: disable HTTPS-proxy as a feature if proxy is disabled
Daniel Stenberg [Sat, 22 Feb 2025 09:08:07 +0000 (10:08 +0100)] 
cmake: disable HTTPS-proxy as a feature if proxy is disabled

Co-authored-by: Viktor Szakats
Closes #16434

5 months agovar: add a '64dec' function that can base64 decode a string
Daniel Stenberg [Sat, 22 Feb 2025 09:49:19 +0000 (10:49 +0100)] 
var: add a '64dec' function that can base64 decode a string

Verified in test 455 and 487.

If the provided string cannot be base64-decoded, it will instead use
"[64dec-fail]" (without the quotes).

Documented

Ref: #16288
Closes #16330

5 months agocurl: add write-out variable 'tls_earlydata'
Stefan Eissing [Thu, 9 Jan 2025 14:28:22 +0000 (15:28 +0100)] 
curl: add write-out variable 'tls_earlydata'

Add the write-out variable 'tls_earlydata' to inspect the amount of
TLSv1.3 early data that had been sent.

Closes #15956

5 months agognutls: fix connection state check on handshake
Stefan Eissing [Fri, 21 Feb 2025 13:42:26 +0000 (14:42 +0100)] 
gnutls: fix connection state check on handshake

When running curl event based, connect attempts stalled as the 'done'
check was using the wrong state in gnutls.

Add event based pytest runs to all http3 jobs and the openssl and
mbedtls ones on linux.

Closes #16423

5 months agocmake: avoid `-Wnonnull` warning in `HAVE_FSETXATTR_5` detection
Viktor Szakats [Fri, 21 Feb 2025 16:30:46 +0000 (17:30 +0100)] 
cmake: avoid `-Wnonnull` warning in `HAVE_FSETXATTR_5` detection

Seen in Android 21/35 CI jobs:
```
curl/CMake/CurlTests.c:315:16: warning: null passed to a callee that requires a non-null argument [-Wnonnull]
   315 |   fsetxattr(0, 0, 0, 0, 0);
       |                ^
 1 warning generated.
```
Ref: https://github.com/curl/curl/actions/runs/13460225795/job/37613494183#step:9:5978

Follow-up to bd9f9b085aa242a5e93be0b2da96ce498d7813c4 #16377
Closes #16427

5 months agoGHA/windows: replace GfW with MSYS2 runtime downgrade
Viktor Szakats [Fri, 21 Feb 2025 15:15:49 +0000 (16:15 +0100)] 
GHA/windows: replace GfW with MSYS2 runtime downgrade

We recently switched to a known good version of Git for Windows to avoid
the MSYS2/Cygwin runtime performance regression.

MSYS2 is closer to the source of the MSYS2/Cygwin projects. Its known
good version is newer. Installing the downgrade is faster and safer. It
also allows to restore the scripts to their original iteration, making
the workaround easier to drop once the perf issue is fixed upstream.

Therefore, switch back to using MSYS2, and install the runtime downgrade
before running curl tests.

Also disable `pacman`'s `CheckSpace` for best performance.

Jeremy identified to the root cause of the perf regression in this
Cygwin commit (from 2024-09-17):
https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=c7fe29f5cb85242ae2607945762f7e0b9af02513

Co-authored-by: Jeremy Drake
Patch: https://github.com/jeremyd2019/curl/commit/95a404e19ae03ba8d35089e66d9690e3a4f11b7c
Ref: https://github.com/curl/curl/pull/16217#issuecomment-2673158597
Ref: https://github.com/curl/curl/pull/16217#issuecomment-2673461330

Follow-up to 116950a25066257f86461f9d1dfa5f787f55e73c #16265
Follow-up to 1bf774df57e873d08f0c6e525e6ec3a0f6e62bce #16217
Follow-up to 5f9411f953f35ca84645b5a6824fb9fef20887ed #15380

Closes #16424

5 months agoasyn-ares: renamed define
Daniel Stenberg [Fri, 21 Feb 2025 13:56:21 +0000 (14:56 +0100)] 
asyn-ares: renamed define

It has the same name as the one used in asyn-thread, but for a slightly
different purpose. This not only caused unity build problems, but would
also be confusing and error-prone.

5 months agoGHA: add a build with c-ares + HTTP-RR on Alpine
Daniel Stenberg [Fri, 21 Feb 2025 07:19:18 +0000 (08:19 +0100)] 
GHA: add a build with c-ares + HTTP-RR on Alpine

Closes #16413

5 months agohttp: split Curl_http_input_auth into sub functions
Daniel Stenberg [Fri, 21 Feb 2025 08:07:41 +0000 (09:07 +0100)] 
http: split Curl_http_input_auth into sub functions

Simplifies things. Increases readability a lot.

Fixes #16412
Reported-by: Viktor Szakats
Closes #16416

5 months agoc-ares: error out for unsupported versions, drop unused macros
Viktor Szakats [Thu, 20 Feb 2025 16:08:38 +0000 (17:08 +0100)] 
c-ares: error out for unsupported versions, drop unused macros

Stop compilation with a clear error when build with versions older than
decribed in `docs/INTERNALS.md` and `docs/HTTPSRR.md` docs.

Also drop an unused macro and another one that's no longer used with
the required minimum c-ares version.

Closes #16407

5 months agoconfigure: silence compiler warnings in feature checks, drop duplicates
Viktor Szakats [Tue, 18 Feb 2025 01:49:31 +0000 (02:49 +0100)] 
configure: silence compiler warnings in feature checks, drop duplicates

Silence compiler warnings (200 of them across the main CI workflows):
```
warning #2193: null argument provided for parameter marked with attribute "nonnull"
warning: Null pointer passed to 1st parameter expecting 'nonnull' [core.NonNullParamChecker]
warning: Null pointer passed to 2nd parameter expecting 'nonnull' [core.NonNullParamChecker]
warning: argument 1 null where non-null expected [-Wnonnull]
warning: argument 2 null where non-null expected [-Wnonnull]
warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits]
warning: null argument where non-null required (argument 1) [-Wnonnull]
```

Also drop `if ... can be linked` feature checks that were identical to
`if ... is compilable` checks, for:
`closesocket`, `ioctlsocket`, `socket`, `freeaddrinfo`, `getaddrinfo`,
`gethostname`, `getpeername`, `getsockname`,
`CloseSocket` (AmigaOS), `IoctlSocket` (AmigaOS).
Another option is to really do the link checks. But, if they weren't
missed so far, it seems safer to drop than risk a detection failure,
as was the case with AmigaOS functions while working on this PR.

There remain 22 `-Wnonnull` warnings in `gethostbyname_r()`,
`getpeername()` `getsockname()`. Most of the rest is necessary for
detection, or originate from autotools and CMake detection code
templates. Some still fixable, like duplicate libs.

Follow-up to ca2f49ded03426a246b3db7833592157cdd7f597 #16287
Closes #16377

5 months agobuild: add Windows CE / CeGCC support, with CI jobs
Viktor Szakats [Fri, 10 Jan 2025 10:04:02 +0000 (11:04 +0100)] 
build: add Windows CE / CeGCC support, with CI jobs

Make it possible to build curl for Windows CE using the CeGCC toolchain.
With both CMake and autotools, including tests and examples, also in CI.
The build configuration is the default one with Schannel enabled. No
3rd-party dependencies have been tested.

Also revive old code to make Schannel build with Windows CE, including
certificate verification.

Builds have been throughougly tested. But, I've made no functional tests
for this PR. Some parts (esp. file operations, like truncate and seek)
are stubbed out and likely broken as a result. Test servers build, but
they do not work on Windows CE. This patch substitutes `fstat()` calls
with `stat()`, which operate on filenames, not file handles. This may or
may not work and/or may not be secure.

About CeGCC: I used the latest available macOS binary build v0.59.1
r1397 from 2009, in native `mingw32ce` build mode. CeGCC is in effect
MinGW + GCC 4.4.0 + old/classic-mingw Windows headers. It targets
Windows CE v3.0 according to its `_WIN32_WCE` value. It means this PR
restores portions of old/classic-mingw support. It makes the Windows CE
codepath compatible with GCC 4.4.0. It also adds workaround for CMake,
which cannot identify and configure this toolchain out of the box.

Notes:
- CMake doesn't recognize CeGCC/mingw32ce, necessitating tricks as seen
  with Amiga and MS-DOS.
- CMake doesn't set `MINGW` for mingw32ce. Set it and `MINGW32CE`
  manually as a helper variable, in addition to `WINCE` which CMake sets
  based on `CMAKE_SYSTEM_NAME`.
- CMake fails to create an implib for `libcurl.dll`, due to not
  recognizing the platform as a Windowsy one. This patch adds the
  necessary workaround to make it work.
- headers shipping with CeGCC miss some things curl needs for Schannel
  support. Fixed by restoring and renovating code previously deleted
  old-mingw code.
- it's sometime non-trivial to figure out if a fallout is WinCE,
  mingw32ce, old-mingw, or GCC version-specific.
- WinCE is always Unicode. With exceptions: no `wmain`,
  `GetProcAddress()`.
- `_fileno()` is said to convert from `FILE *` to `void *` which is
  a Win32 file `HANDLE`. (This patch doesn't use this, but with further
  effort it probably could be.)
  https://stackoverflow.com/questions/3989545/how-do-i-get-the-file-handle-from-the-fopen-file-structure
- WinCE has no signals, current directory, stdio/CRT file handles, no
  `_get_osfhandle()`, no `errno`, no `errno.h`. Some of this stuff is
  standard C89, yet missing from this platform. Microsoft expects
  Windows CE apps to use Win32 file API and `FILE *` exclusively.
- revived CeGCC here (not tested for this PR):
  https://building.enlyze.com/posts/a-new-windows-ce-x86-compiler-in-2024/

On `UNDER_CE` vs. `_WIN32_WCE`: (This patch settled on `UNDER_CE`)

- A custom VS2008 WinCE toolchain does not set any of these.
  The compiler binaries don't contain these strings, and has no compiler
  option for targeting WinCE, hinting that a vanilla toolchain isn't
  setting any of them either.
- `UNDER_CE` is automatically defined by the CeGCC compiler.
  https://cegcc.sourceforge.net/docs/details.html
- `UNDER_CE` is similar to `_WIN32`, except it's not set automatically
  by all compilers. It's not supposed to have any value, like a version.
  (Though e.g. OpenSSL sets it to a version)
- `_WIN32_WCE` is the CE counterpart of the non-CE `_WIN32_WINNT` macro.
  That does return the targeted Windows CE version.
- `_WIN32_WCE` is not defined by compilers, and relies on a header
  setting it to a default, or the build to set it to the desired target
  version. This is also how `_WIN32_WINNT` works.
- `_WIN32_WCE` default is set by `windef.h` in CeGCC.
- `_WIN32_WCE` isn't set to a default by MSVC Windows CE headers (the
  ones I checked at least).
- CMake sets `_WIN32_WCE=<ver>`, `UNDER_CE`, `WINCE` for MSVC WinCE.
- `_WIN32_WCE` seems more popular in other projects, including CeGCC
  itself. `zlib` is a notable exception amongst curl dependencies,
  which uses `UNDER_CE`.
- Since `_WIN32_WCE` needs "certain" headers to have it defined, it's
  undefined depending on headers included beforehand.
- `curl/curl.h` re-uses `_WIN32_WCE`'s as a self-guard, relying on
  its not-(necessarily)-defined-by-default property:
  https://github.com/curl/curl/blob/25b445e4796bcbf9f842de686a8c384b30f6c2a2/include/curl/curl.h#L77

Toolchain downloads:
- Windows:
  https://downloads.sourceforge.net/cegcc/cegcc/0.59.1/cegcc_mingw32ce_cygwin1.7_r1399.tar.bz2
- macOS Intel:
  https://downloads.sourceforge.net/cegcc/cegcc/0.59.1/cegcc_mingw32ce_snowleopard_r1397.tar.bz2

Closes #15975

5 months agohttp: fix the auth check
Daniel Stenberg [Fri, 21 Feb 2025 11:28:19 +0000 (12:28 +0100)] 
http: fix the auth check

It used the wrong variable.

Follow-up to d1fc1c4a854d5cc809cc4ae59a9511900228023a
Pointed-out-by: qhill on github
Ref: https://github.com/curl/curl/pull/16406#pullrequestreview-2632734134
Closes #16419

5 months agoGHA: update dependency ngtcp2/nghttp3 to v1.8.0
renovate[bot] [Fri, 21 Feb 2025 12:20:49 +0000 (12:20 +0000)] 
GHA: update dependency ngtcp2/nghttp3 to v1.8.0

Closes #16421

5 months agoGHA: update dependency ngtcp2/ngtcp2 to v1.11.0
renovate[bot] [Fri, 21 Feb 2025 12:20:53 +0000 (12:20 +0000)] 
GHA: update dependency ngtcp2/ngtcp2 to v1.11.0

Closes #16422

5 months agoschannel: guard ALPN init code to ALPN builds
Viktor Szakats [Fri, 21 Feb 2025 12:00:27 +0000 (13:00 +0100)] 
schannel: guard ALPN init code to ALPN builds

To avoid unnecessary init work with toolchains not supporting ALPN.

Follow-up to 7fd15b4a827f08db153265aa45f755256bc251f3 #16393
Closes #16420

5 months agoschannel: enable ALPN support under WINE 6.0+
Viktor Szakats [Wed, 19 Feb 2025 11:26:47 +0000 (12:26 +0100)] 
schannel: enable ALPN support under WINE 6.0+

ALPN support was announced in 5.6 (2020-04-10). It likely needs a WINE
built against GnuTLS 3.2.0 (2013-05-10) or upper (for macOS, GnuTLS was
made default in WINE 6.0.2). I could confirm ALPN working under 6.0.2
(2021-10-26).

https://www.winehq.org/announce/5.6
https://gitlab.winehq.org/wine/wine/-/commit/0527cf89fb907c330bc4fad3b135a1c85208fa9e
https://gitlab.winehq.org/wine/wine/-/blob/wine-5.6/dlls/secur32/schannel_gnutls.c
https://gitlab.winehq.org/wine/wine/-/blob/wine-5.6/dlls/secur32/tests/schannel.c

If you run into problems, open and Issue and disable ALPN manually with
`--no-alpn` or the equivalent for libcurl.

Ref: #983
Closes #16393

5 months agoeventfd: allow for all CPUs
Viktor Szakats [Sat, 8 Feb 2025 01:34:48 +0000 (02:34 +0100)] 
eventfd: allow for all CPUs

After fixing support for x32, unlock eventfd support for all CPUs.
Before this patch, it was explicitly limited to 64-bit ones.

You can disable eventfs manually on systems where it's auto-detected:
- cmake: `-DHAVE_EVENTFD=0`
- configure: `export ac_cv_func_eventfd=0`

Ref: c2aa504ab9148b5c284b090c5043d9f0c3fbd903 #16239
Closes #16277

5 months agocmake: drop `CURL_DISABLE_TESTS` option
Viktor Szakats [Thu, 30 Jan 2025 15:38:18 +0000 (16:38 +0100)] 
cmake: drop `CURL_DISABLE_TESTS` option

curl builds tests with CMake when explicitly building the `testdeps`
target. It's not built by default. It seems overkill to have
a curl-specific variant of this (over CMake's `BUILD_TESTING`)
to disable generating this target.

Its history also doesn't make it obvious why this was necessary,
and there was a long debate how to do it, by the time the original
submitter abandoned CMake. The option also remained uninitialized
and thus undocumented.

Let me know if I missed something.

Ref: #6036
Ref: 3a1e798009799be1e9fad30666351b66f250befb #6072
Closes #16134

5 months agoopenssl: drop support for old OpenSSL/LibreSSL versions
Viktor Szakats [Mon, 27 Jan 2025 19:35:23 +0000 (20:35 +0100)] 
openssl: drop support for old OpenSSL/LibreSSL versions

Require OpenSSL 1.0.2a (2015-03-19) or LibreSSL 2.9.1 (2019-04-13).

Closes #16104

5 months agomsvc: drop support for VS2005 and older
Viktor Szakats [Mon, 13 Jan 2025 19:49:20 +0000 (20:49 +0100)] 
msvc: drop support for VS2005 and older

- cmake: assume large file support (VS2005+ / `_fseeki64()`)
- config-win32.h: assume large file support (VS2005+ / `_fseeki64()`)
- config-win32.h: assume `HAVE_LONGLONG` (VS2003+)
- config-win32.h: assume 64-bit `time_t` (VS2005+)
- config-win32.h: assume VS2008+
- cmake: use multi-threaded/parallel compilation (VS2008+)
- curl_setup.h: require multi-threading MSVC CRT (~VS2005+)
- curl_setup.h: hard fail for unsupported MSVC versions.
Authored-by: Jay Satiro
- winbuild: bump minimum version

Follow-up to 308437ac53a142be2c3470330e7de3737915bb23 #15992
Ref: #15972
Closes #16004

5 months agotidy-up: align MSYS2/Cygwin codepaths, follow Cygwin `MAX_PID` bump
Viktor Szakats [Thu, 20 Feb 2025 22:42:46 +0000 (23:42 +0100)] 
tidy-up: align MSYS2/Cygwin codepaths, follow Cygwin `MAX_PID` bump

MSYS/MSYS2 and Cygwin are the same platform. Adjust code where they were
treated differently.

- drop separate `MSYS` from buildinfo flags. Our code is using the
  `CYGWIN` variable and CMake (since v3.21) sets it also for `MSYS`.
- fix test1158 and test1186 to exclude them for all Win32 targets,
  instead of just MSYS test envs. To align behavior between MSYS and
  Cygwin envs. Required for recent MSYS2 releases which reports itself
  as Cygwin, and no longer MSYS, which broke the previous exclusion
  logic.
- follow Cygwin bumping its `MAX_PID` value, to avoid PID collisions.
  https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=363357c023ce01e936bdaedf0f479292a8fa4e0f

Reported-by: Jeremy Drake
Bug: https://github.com/curl/curl/pull/16217#issuecomment-2672768233
Ref: https://www.msys2.org/news/#2025-02-14-moving-msys2-closer-to-cygwin
Closes #16411

5 months agoschannel: deduplicate Windows Vista detection
Viktor Szakats [Thu, 20 Feb 2025 16:46:57 +0000 (17:46 +0100)] 
schannel: deduplicate Windows Vista detection

curl detects Vista as part of its global initialization. Use that result
instead of detecting it again in Schannel, to save some cycles and API
calls.

Follow-up to 46e97b10ba917aed55f079b89c1dfe54955a4a62 #16400
Closes #16408

5 months agocurlver.h: bump to 8.13.0
Daniel Stenberg [Fri, 21 Feb 2025 10:07:56 +0000 (11:07 +0100)] 
curlver.h: bump to 8.13.0

5 months agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 21 Feb 2025 09:36:53 +0000 (10:36 +0100)] 
RELEASE-NOTES: synced

5 months agocf-socket: deduplicate Windows Vista detection
Jay Satiro [Wed, 19 Feb 2025 21:36:07 +0000 (16:36 -0500)] 
cf-socket: deduplicate Windows Vista detection

- Remove Vista detection logic from Curl_sndbuf_init and evaluate global
  init variable Curl_isVistaOrGreater instead.

This way we don't need a separate initialization in Curl_sndbuf_init.

Ref: https://github.com/curl/curl/pull/16393#discussion_r1962377920

Closes https://github.com/curl/curl/pull/16400

5 months agowolfssl: fix CA certificate multiple location import
Jay Satiro [Wed, 19 Feb 2025 08:25:32 +0000 (03:25 -0500)] 
wolfssl: fix CA certificate multiple location import

- Do not set x509_store_setup until after all CA certificate imports.

- If CA blob import fails then return error unconditionally.

This is to sync the behavior with OpenSSL and other backends.

Prior to this change, setting CA native and/or CA blob were treated as
mutually exclusive from setting CA file and/or CA path.

CA blob import still overrides CA file import as documented.

Closes https://github.com/curl/curl/pull/16391

5 months agoasyn-ares: fix the port assign
Daniel Stenberg [Fri, 21 Feb 2025 07:27:03 +0000 (08:27 +0100)] 
asyn-ares: fix the port assign

Follow-up to 6bc65a444b2e7f1453b0b4
Fixes #16414
Closes #16415

5 months agohttp: simplify the check for auth methods
Daniel Stenberg [Thu, 20 Feb 2025 15:14:58 +0000 (16:14 +0100)] 
http: simplify the check for auth methods

Avoids having to use the correct index into the line. Avoids repeated
use of is_valid_auth_separator.

Require that the following letter is not an alnum instead of checking
explicitly for ch == '\0' || ch == ',' || ISSPACE(ch). After all, the
point is to not erroneously match another auth string using the same
prefix.

Follow-up to b75620b9a05c0f0d03bd

Closes #16406

5 months agohttpsrr: fix port detection
Dexter Gerig [Thu, 20 Feb 2025 18:57:02 +0000 (12:57 -0600)] 
httpsrr: fix port detection

Closes #16409

5 months agoGHA: add https-rr (asyn-rr) to the alpine job
Daniel Stenberg [Thu, 20 Feb 2025 14:01:13 +0000 (15:01 +0100)] 
GHA: add https-rr (asyn-rr) to the alpine job

Assisted-by: Viktor Szakats
Closes #16402

5 months agoconn: fix connection reuse when SSL is optional
Stefan Eissing [Wed, 19 Feb 2025 09:52:34 +0000 (10:52 +0100)] 
conn: fix connection reuse when SSL is optional

In curl 8.12 I tried to improve the logic on how we handle connections
that "upgrade" to TLS later, e.g. with a STARTTLS. I found the existing
code hard to read in this regard. But of course, the "improvements" blew
up in my face.

We fixed issues with imap, opo3, smtp in 8.12.1, but ftp was no longer
reusing existing, upgraded control connections as before. This PR adds
checks in our pytest FTP tests that verify reuse is happening as
intended.

I rewrote the logic in url.c again, so that the new test checks now pass.

Reported-by: Zenju on github
Fixes #16384
Closes #16392

5 months agoclient writer: handle pause before deocding
Stefan Eissing [Mon, 10 Feb 2025 16:40:11 +0000 (17:40 +0100)] 
client writer: handle pause before deocding

Adds a "cw-pause" client writer in the PROTOCOL phase that buffers
output when the client paused the transfer. This prevents content
decoding from blowing the buffer in the "cw-out" writer.

Added test_02_35 that downloads 2 100MB gzip bombs in parallel and
pauses after 1MB of decoded 0's.

This is a solution to issue #16280, with some limitations:
- cw-out still needs buffering of its own, since it can be paused
  "in the middle" of a write that started with some KB of gzipped
  zeros and exploded into several MB of calls to cw-out.
- cw-pause will then start buffering on its own *after* the write
  that caused the pause. cw-pause has no buffer limits, but the
  data it buffers is still content-encoded.
  Protocols like http/1.1 stop receiving, h2/h3 have window sizes,
  so the cw-pause buffer should not grow out of control, at least
  for these protocols.
- the current limit on cw-out's buffer is ~75MB (for whatever
  historical reason). A potential content-encoding that blows 16KB
  (the common h2 chunk size) into > 75MB would still blow the buffer,
  making the transfer fail. A gzip of 0's makes 16KB into ~16MB, so
  that still works.

A better solution would be to allow CURLE_AGAIN handling in the client
writer chain and make all content encoders handle that. This would stop
explosion of encoding on a pause right away. But this is a large change
of the deocoder operations.

Reported-by: lf- on github
Fixes #16280
Closes #16296

5 months agohttp: negotiation and room for alt-svc/https rr to navigate
Stefan Eissing [Tue, 28 Jan 2025 13:11:59 +0000 (14:11 +0100)] 
http: negotiation and room for alt-svc/https rr to navigate

Add a 'wanted' major HTTP version bitmask next to the 'allowed' bitmask
in HTTP version negotiation. This will try connections as specified in
'wanted', but enabled Alt-Svc and HTTPS-RR to redirect to other major
HTTP versions, if those are 'allowed'.

Changes libcurl internal default to `CURL_HTTP_VERSION_NONE` and removes
the code in curl that sets `CURL_HTTP_VERSION_2TLS` if the command line
does not say anything else.

Closes #16117

5 months agocfilter: remove 'blocking' connect handling
Stefan Eissing [Wed, 19 Feb 2025 15:49:31 +0000 (16:49 +0100)] 
cfilter: remove 'blocking' connect handling

Remove `blocking` argument from cfilter's connect method.

Implement blocking behaviour in Curl_conn_connect() instead for all
filter chains.

Update filters implementations. Several of which did never use the
paramter (QUIC for example). Simplifies connect handling in TLS filters
that no longer need to loop

Fixed a blocking connect call in FTP when waiting on a socket accept()
which only worked because the filter did not implement it.

Closes #16397

5 months agotool_getparam: clear sensitive arguments better
Daniel Stenberg [Wed, 19 Feb 2025 22:55:31 +0000 (23:55 +0100)] 
tool_getparam: clear sensitive arguments better

curl attempts to clear some flags to hide them from snooping neighbors
(on platforms where it works). For example the credentials provided with
-u. Previously it would only do that if there was a space between the
option and the credentials as in "-u joe:s3cr3t" but not when done
without a separating space as in "-ujoe:s3cr3t".

This addresses that previous shortcoming.

Reported-by: kayrus on github
Fixes #16396
Closes #16401

5 months agohttpsrr: fix the HTTPS-RR threaded-resolver build combo
Daniel Stenberg [Thu, 20 Feb 2025 07:31:33 +0000 (08:31 +0100)] 
httpsrr: fix the HTTPS-RR threaded-resolver build combo

Reported-by: Viktor Szakats
Fixes #16399
Closes #16404

5 months agobuild: silence bogus `-Wconversion` warnings with gcc 5.1-5.4
Viktor Szakats [Wed, 19 Feb 2025 16:26:58 +0000 (17:26 +0100)] 
build: silence bogus `-Wconversion` warnings with gcc 5.1-5.4

It's fixed in gcc 5.5.0.

Example: https://godbolt.org/z/x6Th8q844

Seen in gcc 5.1.0, 5.4.0 (both 32/64-bit) with dl-mingw:
```
lib/rtsp.c: In function 'rtsp_parse_transport':
lib/rtsp.c:1025:36: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
           rtp_channel_mask[idx] |= (unsigned char)(1 << off);
                                    ^
lib/mprintf.c: In function 'parsefmt':
lib/mprintf.c:526:31: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
         usedinput[width/8] |= (unsigned char)(1 << (width&7));
                               ^
lib/mprintf.c:544:35: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
         usedinput[precision/8] |= (unsigned char)(1 << (precision&7));
                                   ^
lib/mprintf.c:559:29: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
       usedinput[param/8] |= (unsigned char)(1 << (param&7));
                             ^
lib/cfilters.c: In function 'Curl_pollset_change':
lib/cfilters.c:935:25: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
       ps->actions[i] |= (unsigned char)add_flags;
                         ^
```
gcc 5.1.0: https://github.com/curl/curl/actions/runs/13413103492/job/37467698381#step:9:21
gcc 5.4.0: https://github.com/curl/curl/actions/runs/13413103492/job/37467694479#step:9:19

Closes #16398

5 months agostrparse: provide access functions
Daniel Stenberg [Wed, 19 Feb 2025 07:49:54 +0000 (08:49 +0100)] 
strparse: provide access functions

To access the string and the length without having to directly use the
struct field names. Gives more freedom, flexbility and keeps
implementation specifics out of users' code.

Closes #16386

5 months agocookie: convert to using strparse
Daniel Stenberg [Tue, 18 Feb 2025 22:03:09 +0000 (23:03 +0100)] 
cookie: convert to using strparse

- using strparse cleans up the code and makes it easier to read and follow
- remove ? handling never used - since the path is provided without queries nowadays
- simplify sanitize_cookie_path
- avoid the strdup in pathmatch()

Closes #16386

5 months agoschannel: enable ALPN with MinGW, fix ALPN for UWP builds
Viktor Szakats [Tue, 18 Feb 2025 22:30:54 +0000 (23:30 +0100)] 
schannel: enable ALPN with MinGW, fix ALPN for UWP builds

ALPN requires mingw-w64 9.0 or newer.

Also fix ALPN-enabled builds for UWP. This assumes that WINE doesn't
support UWP, which seems to be the case when writing this.

Closes #16385

5 months agoca-native.md: sync with CURLSSLOPT_NATIVE_CA
Jay Satiro [Mon, 17 Feb 2025 21:31:48 +0000 (16:31 -0500)] 
ca-native.md: sync with CURLSSLOPT_NATIVE_CA

- Add that the native CA store is used to verify certs in addition to
  the other certificate location settings.

Basically clarify that --ca-native does not override --cacert etc.

Prior to this change that behavior was only documented in
CURLSSLOPT_NATIVE_CA which is what --ca-native maps to.

Ref: https://github.com/curl/curl/pull/16181#issuecomment-2663998865

Closes https://github.com/curl/curl/pull/16373

5 months agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 19 Feb 2025 07:11:43 +0000 (08:11 +0100)] 
RELEASE-NOTES: synced

5 months agoKNOWN_BUGS: fix typo
John Bampton [Tue, 18 Feb 2025 16:32:06 +0000 (02:32 +1000)] 
KNOWN_BUGS: fix typo

Closes #16383

5 months agossh: consider sftp quote commands case sensitive
Daniel Stenberg [Tue, 18 Feb 2025 15:39:25 +0000 (16:39 +0100)] 
ssh: consider sftp quote commands case sensitive

They have always been documented in lowercase. They have never been
claimed to be case insensitive. They mostly map to unix counterparts
that are always lowercase. Switch to case sensitive checks: lowercase.

Closes #16382

5 months agostrparse: speed up the hex parser somewhat
Daniel Stenberg [Mon, 17 Feb 2025 21:34:21 +0000 (22:34 +0100)] 
strparse: speed up the hex parser somewhat

Around 2.3x speed-up parsing many large hexadecimal numbers. The decimal and
octal parser get marginally faster.

Still very readable, compact and easy to follow code.

Tweaks

- combine the max and the overflow check, gains 3ns/num (use a separate
  check outside of the loop instead for max < base)
- one less indirection in the pointer, gains 3ns/num
- using the table lookup for hex nums, gains 5ns/num
- unfold the num_digit() macro, gains 3s/num
- use the hexasciitable unconditionally, gains 2ns/num
- use post-increment pointer in the table lookup, gains 1ns/num
- improved valid_digit() using the table for the hex case,
  gains 26 ns/num
- use "max char" in valid_digit(), gains 3ns/num

Behavior changes:

- no longer returns STRE_TOO_BIG - only STRE_OVERFLOW
- does not move the char ** on error, which is probably better

Updated and extended test 1664 (significantly).

Closes #16374

5 months agotidy-up: use `CURL_ARRAYSIZE()`
Viktor Szakats [Tue, 18 Feb 2025 13:48:18 +0000 (14:48 +0100)] 
tidy-up: use `CURL_ARRAYSIZE()`

Follow-up to 13b2ea68f0e08b2746669addfbc7b0ecd5f1bf0e #16111

Closes #16381

5 months agohttps-rr: implementation improvements
Stefan Eissing [Thu, 30 Jan 2025 14:31:16 +0000 (15:31 +0100)] 
https-rr: implementation improvements

- fold DoH and async HTTPS-RR handling into common code.
  have common cleanups, etc. Have a CURLcode result in async
  handling to allow HTTPS RR parsing to fail.
- keep target, ipv4hints, ipv6hints, port and echconfig also
  when resolving via cares. We need to know `target` and `port`
  when evaluating possible ALPN candidates to not go astray.
- add CURL_TRC_DNS for tracing DNS operations
- replace DoH specific tracing with DNS, use doh as alias
  for dns in curl_global_tracea()

Closes #16132

5 months agohttp: version negotiation
Stefan Eissing [Mon, 27 Jan 2025 14:39:13 +0000 (15:39 +0100)] 
http: version negotiation

Translate the `data->set.httpwant` which is one of the consts from the
public API (CURL_HTTP_VERSION_*) into a major version mask plus
additional flags for internal handling.

`Curl_http_neg_init()` does the translation and flags setting in http.c,
using new internal consts CURL_HTTP_V1x, CURL_HTTP_V2x and CURL_HTTP_V3x
for the major versions. The flags are

- only_10: when the application explicity asked fro HTTP/1.0
- h2_upgrade: when the application asks for upgrading 1.1 to 2.
- h2_prior_knowledge: when directly talking h2 without ALPN
- accept_09: when a HTTP/0.9 response is acceptable.

The Alt-Svc and HTTPS RR redirections from one ALPN to another obey the
allowed major versions. If a transfer has only h3 enabled, Alt-Svc
redirection to h2 is ignored.

This is the current implementation. It can be debated if Alt-Svc should
be able to override the allowed major versions. Added test_12_06 to
verify the current restriction.

Closes #16100

5 months agocmake: `SHARE_LIB_OBJECT=ON` requires CMake 3.12 or newer
Viktor Szakats [Tue, 18 Feb 2025 00:23:40 +0000 (01:23 +0100)] 
cmake: `SHARE_LIB_OBJECT=ON` requires CMake 3.12 or newer

This feature requires Object Libraries which is supported by CMake 3.12
or newer: https://cmake.org/cmake/help/latest/release/3.12.html

Keep it permanently disabled for older CMake versions.
Also document it in `docs/INSTALL-CMAKE.md`.

Ref: https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#object-libraries

Follow-up to fc9bfb14520712672b4784e8b48256fb29204011 #11627
Follow-up to 2ebc74c36a19a1700af394c16855ce144d9878e3 #11546

Reported-by: Mark Phillips
Fixes #16375
Closes #16376

5 months agohostip: make CURLOPT_RESOLVE support replacing IPv6 addresses 16358/head
Daniel Stenberg [Mon, 17 Feb 2025 07:33:52 +0000 (08:33 +0100)] 
hostip: make CURLOPT_RESOLVE support replacing IPv6 addresses

This also applies to --resolve of course.

Applied strparse functions on the function.

Fixes #16357
Reported-by: rmg-x on github
Closes #16358
Assisted-by: Jay Satiro
5 months agoGHA/windows: drop no-op `-DCMAKE_BUILD_TYPE=` from MSVC jobs
Viktor Szakats [Mon, 17 Feb 2025 21:25:32 +0000 (22:25 +0100)] 
GHA/windows: drop no-op `-DCMAKE_BUILD_TYPE=` from MSVC jobs

They use Visual Studio generators, which are multi-target.
The build command does the Release/Debug selection via `--config`.

Also:
- appveyor: drop unnecessary conditional for 3 options.
  To sync with GHA.
- appveyor: drop unused `-DCMAKE_INSTALL_PREFIX=`.
  To sync with GHA.
- sync cmake option order between GHA and appveyor.

Closes #16372

5 months agocmake: sync OpenSSL(-fork) feature checks with `./configure`
Viktor Szakats [Thu, 9 Jan 2025 10:43:42 +0000 (11:43 +0100)] 
cmake: sync OpenSSL(-fork) feature checks with `./configure`

`./configure` uses `AC_CHECK_FUNC` for these checks, with one exception
(`SSL_CTX_set_srp_username`). It's slightly less precise but simpler as
it doesn't need headers and/or macros. Do the same in CMake.

It also allows merging ECH detections across OpenSSL forks in CMake too.

Closes #16352

5 months agoasyn-thread: fix mutex refs and unused variable in no-`HAVE_GETADDRINFO` builds
Viktor Szakats [Mon, 17 Feb 2025 13:51:02 +0000 (14:51 +0100)] 
asyn-thread: fix mutex refs and unused variable in no-`HAVE_GETADDRINFO` builds

Follow-up to 074048ae803a817e39df198c61c2d9d87ec3585f #16321
Follow-up to 2ee754d830da084c386d1f1778de5e00fb1c348e #16323
Closes #16370

5 months agoCI: dump non-pre-fill configure log on pre-fill check fail
Viktor Szakats [Mon, 17 Feb 2025 13:48:03 +0000 (14:48 +0100)] 
CI: dump non-pre-fill configure log on pre-fill check fail

To help debugging builds where the actual feature check is broken.

Follow-up to e7adf3e83747c2915c671f2e560cde6f3d4a4905 #15841
Closes #16369

5 months agoGHA: bump rojopolis/spellcheck-github-actions
dependabot[bot] [Mon, 17 Feb 2025 14:48:18 +0000 (14:48 +0000)] 
GHA: bump rojopolis/spellcheck-github-actions

Bumps [rojopolis/spellcheck-github-actions](https://github.com/rojopolis/spellcheck-github-actions) from 9e0a5fb25a80b89c84899657949cbd6e17eb376c to ed0756273a1658136c36d26e3d0353de35b98c8b.
- [Release notes](https://github.com/rojopolis/spellcheck-github-actions/releases)
- [Changelog](https://github.com/rojopolis/spellcheck-github-actions/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rojopolis/spellcheck-github-actions/compare/9e0a5fb25a80b89c84899657949cbd6e17eb376c...ed0756273a1658136c36d26e3d0353de35b98c8b)

---
updated-dependencies:
- dependency-name: rojopolis/spellcheck-github-actions
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Closes #16368

5 months agotimediff: remove unnecessary double typecast
Daniel Stenberg [Mon, 17 Feb 2025 13:38:23 +0000 (14:38 +0100)] 
timediff: remove unnecessary double typecast

Closes #16367

5 months agoSTRPARSE.md: sync with recent changes
Daniel Stenberg [Mon, 17 Feb 2025 09:23:09 +0000 (10:23 +0100)] 
STRPARSE.md: sync with recent changes

New functions and Curl_str_number() changed number return type.

Closes #16365

5 months agohttp_aws_sigv4: use strparse more for parsing
Daniel Stenberg [Mon, 17 Feb 2025 12:50:34 +0000 (13:50 +0100)] 
http_aws_sigv4: use strparse more for parsing

Closes #16366

5 months agossl session cache: add exportable flag
Stefan Eissing [Thu, 13 Feb 2025 14:33:45 +0000 (15:33 +0100)] 
ssl session cache: add exportable flag

Give peers and `exportable` flag, set TRUE when sessions for this peer
should not be exported. This evalualtes if the peer uses confidential
information (like srp username/password), a client certificate OR if the
"ssl_peer_key" contains relative paths.

When SSL is configured with paths for relevant components, like CA trust
anchors, an attempt is made to make this path absolute. When that does
not work or the infrstructure is not available, the peer key is marked
as *local*.

Exporting sessions based on relative paths may lead to confusion when
later imported in another execution context.

Closes #16322

5 months agohash: use single linked list for entries
Stefan Eissing [Sun, 16 Feb 2025 14:19:20 +0000 (15:19 +0100)] 
hash: use single linked list for entries

Curl's double linked list is proven code, but it comes with some
additional memory overhead. Since hash's internal list of elements needs
only forward traversals, it seems worthwhile to use a single linked list
internally.

This saves 3 pointers per entry plus 3 pointers per slot.

Closes #16351

5 months agocookie: minor parser simplification
Daniel Stenberg [Mon, 17 Feb 2025 10:15:32 +0000 (11:15 +0100)] 
cookie: minor parser simplification

- parse whitespace before the value is handled
- remove superflous checks from some ISBLANK() loops

Closes #16362

5 months agolib: use Curl_str_* instead of strtok_r()
Daniel Stenberg [Mon, 17 Feb 2025 08:43:45 +0000 (09:43 +0100)] 
lib: use Curl_str_* instead of strtok_r()

Helps avoid extra mallocs. Gets rid of the private strtok_r
implementation.

Closes #16360

5 months agolib: simplify more white space loops
Daniel Stenberg [Mon, 17 Feb 2025 10:24:49 +0000 (11:24 +0100)] 
lib: simplify more white space loops

Since the ISBLANK() and ISSPACE() macros check for specific matches,
there is no point in using while(*ptr && ISSPACE(*ptr)) etc, as the
'*ptr' check is then superfluous.

Closes #16363

5 months agobuild: even more strtoll cleanups
Daniel Stenberg [Mon, 17 Feb 2025 07:51:22 +0000 (08:51 +0100)] 
build: even more strtoll cleanups

Follow-up to b4538ec5229d716baa5e09b0f4

Closes #16359

5 months agobuild: enable -Wjump-misses-init for GCC 4.5+ 16252/head
Marcel Raad [Fri, 7 Feb 2025 23:03:47 +0000 (00:03 +0100)] 
build: enable -Wjump-misses-init for GCC 4.5+

This should have caught https://github.com/curl/curl/issues/16246.

Closes https://github.com/curl/curl/pull/16252

5 months agoopenssl: remove bad `goto`s into other scope
Marcel Raad [Sun, 16 Feb 2025 20:52:52 +0000 (21:52 +0100)] 
openssl: remove bad `goto`s into other scope

All the `goto` did in these cases was effectively `return 0`, so just
use that explicitly.

Closes https://github.com/curl/curl/pull/16356

5 months agoRevert "openssl: fix out of scope variables in goto"
Marcel Raad [Sun, 16 Feb 2025 20:37:24 +0000 (21:37 +0100)] 
Revert "openssl: fix out of scope variables in goto"

This reverts the main part of commit
3f79695be9e4628d246740bcd36c627daab676ca, but keeping the
formatting fix.

Closes https://github.com/curl/curl/pull/16356

5 months agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 17 Feb 2025 07:43:08 +0000 (08:43 +0100)] 
RELEASE-NOTES: synced

5 months agoasyn-thread: fix `CURL_DISABLE_SOCKETPAIR` build
Marcel Raad [Sun, 16 Feb 2025 20:29:56 +0000 (21:29 +0100)] 
asyn-thread: fix `CURL_DISABLE_SOCKETPAIR` build

Since commit 074048ae803, `td` is used also with
`CURL_DISABLE_SOCKETPAIR`.

Closes https://github.com/curl/curl/pull/16355

5 months agovariable.md: clarify 'trim' example
Jay Satiro [Sun, 16 Feb 2025 08:05:15 +0000 (03:05 -0500)] 
variable.md: clarify 'trim' example

- Use the variable name 'var' instead of 'url' since the latter is also
  a function name and that may confuse the user.

Closes https://github.com/curl/curl/pull/16346

5 months agoscripts/managen: fix parsing of markdown code sections
Jay Satiro [Sun, 16 Feb 2025 07:49:43 +0000 (02:49 -0500)] 
scripts/managen: fix parsing of markdown code sections

- Terminate a code section before parsing a heading line.

Prior to this change when a code line (eg "    code") was followed
by a heading line (eg "## heading") the code section in the output
was terminated after converting the header instead of before. That led
to some weird formatting outputs depending on the nroff or roffit etc.

With this change:

.nf
curl \--expand\-url https.//example.com/{{url:trim}}
.fi
.IP json

Without this change:

.nf
curl \--expand\-url https.//example.com/{{url:trim}}
.IP json
.fi

Closes https://github.com/curl/curl/pull/16345

5 months agoscripts/managen: fix option 'single'
Jay Satiro [Sun, 16 Feb 2025 07:09:57 +0000 (02:09 -0500)] 
scripts/managen: fix option 'single'

- Fix option 'single' to generate single manpages.

As far as I can tell the option did not work prior to this change.

Example: scripts/managen -d docs/cmdline-opts single variable.md

Closes https://github.com/curl/curl/pull/16344

5 months agocmake: fix ECH detection in custom-patched OpenSSL
Viktor Szakats [Sun, 16 Feb 2025 19:07:40 +0000 (20:07 +0100)] 
cmake: fix ECH detection in custom-patched OpenSSL

Typo found via #16352
Regression-from fd067bfb5b028ac41660decc5abb87f1cd093b6b #15596
Closes #16354

5 months agobuild: drop more unused `HAVE_STRTOLL`
Viktor Szakats [Sun, 16 Feb 2025 19:05:50 +0000 (20:05 +0100)] 
build: drop more unused `HAVE_STRTOLL`

Follow-up to e5326bfb4477f54df64e2a7d0c2627f236a7130d #16350
Closes #16353

5 months agobuild: remove checks for strtoll()
Daniel Stenberg [Sun, 16 Feb 2025 13:52:43 +0000 (14:52 +0100)] 
build: remove checks for strtoll()

Follow-up to b4538ec5229d716baa5e09b

It is not being used anymore.

Closes #16350

5 months agoCODE_STYLE: readability and banned functions
Daniel Stenberg [Sun, 16 Feb 2025 13:50:45 +0000 (14:50 +0100)] 
CODE_STYLE: readability and banned functions

Closes #16349

5 months agoasyn-thread: remove 'status' from struct Curl_async
Daniel Stenberg [Thu, 6 Feb 2025 21:05:10 +0000 (22:05 +0100)] 
asyn-thread: remove 'status' from struct Curl_async

While it gets stored, nothing needs nor uses it.

Closes #16347

5 months agolib: strparse.h include where missing
Stefan Eissing [Sun, 16 Feb 2025 12:39:24 +0000 (13:39 +0100)] 
lib: strparse.h include where missing

Closes #16348

5 months agocmake: misc tidy-ups
Viktor Szakats [Fri, 7 Feb 2025 12:44:39 +0000 (13:44 +0100)] 
cmake: misc tidy-ups

- replace `add_compile_options()`,  `add_definitions()` with directory
  properties. To harmonize this across all scripts. The new commands are
  verbose, but describe better how they work. The syntax is also closer
  to setting target properties, helps grepping.

- prefer `CMAKE_INSTALL_PREFIX` over `--prefix` (in tests, CI).

- tidy up cmake invocations.

- formatting.

Closes #16238

5 months agobuild: fix compiler warnings in feature detections
Viktor Szakats [Tue, 11 Feb 2025 01:46:29 +0000 (02:46 +0100)] 
build: fix compiler warnings in feature detections

Fix or silence compiler warnings happening in feature detections
to reduce log noise. Warnings may also get promoted to errors in certain
cases, causing missed detections.

It reduces the number of warnings by 4500+ across the linux, linux-old,
macos, non-native and windows GHA workflows (~142 jobs).

Also move picky warning logic for MSVC/Borland to
`CMake/PickyWarnings.cmake. To make them listed in the picky-warnings
log output, and to also apply to feature detections to make them compile
under the same conditions as source code. The hope is to help catching
issues faster. It also improves code quality of feature tests.

Fixed/silenced:
```
warning #177: variable "dummy" was declared but never referenced
warning #177: variable "flag" was declared but never referenced
warning #177: variable "res" was declared but never referenced
warning #592: variable "s" is used before its value is set
warning #1011: missing return statement at end of non-void function "main"
warning #1786: function "SSL_CTX_set_srp_password" (declared at line 1888 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0")
warning #1786: function "SSL_CTX_set_srp_username" (declared at line 1887 of "/usr/include/openssl/ssl.h") was declared deprecated ("Since OpenSSL 3.0")
warning #2332: a value of type "const char *" cannot be assigned to an entity of type "char *" (dropping qualifiers)
warning: 'SSL_CTX_set_srp_password' is deprecated [-Wdeprecated-declarations]
warning: 'SSL_CTX_set_srp_password' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
warning: 'SSL_CTX_set_srp_username' is deprecated [-Wdeprecated-declarations]
warning: 'SSL_CTX_set_srp_username' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
warning: 'b' is used uninitialized [-Wuninitialized]
warning: 'gethostname' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn]
warning: Value stored to 'i' is never read [deadcode.DeadStores]
warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
warning: control reaches end of non-void function [-Wreturn-type]
warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
warning: excess elements in struct initializer
warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
warning: macro "_FILE_OFFSET_BITS" is not used [-Wunused-macros]
warning: macro "_REENTRANT" is not used [-Wunused-macros]
warning: missing braces around initializer [-Wmissing-braces]
warning: no previous extern declaration for non-static variable 'off_t_is_large' [-Wmissing-variable-declarations]
warning: no previous prototype for 'check' [-Wmissing-prototypes]
warning: no previous prototype for function 'check' [-Wmissing-prototypes]
warning: null argument where non-null required (argument 2) [-Wnonnull]
warning: passing 'const char[1]' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
warning: passing argument 2 of 'SSL_CTX_set_srp_password' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
warning: passing argument 2 of 'SSL_CTX_set_srp_username' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
warning: unused parameter 'c' [-Wunused-parameter]
warning: unused parameter 'f' [-Wunused-parameter]
warning: unused variable 'data' [-Wunused-variable]
warning: unused variable 'dummy' [-Wunused-variable]
warning: unused variable 'flag' [-Wunused-variable]
warning: unused variable 'res' [-Wunused-variable]
warning: unused variable 's' [-Wunused-variable]
warning: variable 's' set but not used [-Wunused-but-set-variable]
warning: variable 'ts' set but not used [-Wunused-but-set-variable]
```

Closes #16287

5 months agoconfigure: use `curl_cv_apple` variable
Viktor Szakats [Sat, 15 Feb 2025 10:57:55 +0000 (11:57 +0100)] 
configure: use `curl_cv_apple` variable

Follow-up to 876db1070bf3bee5e35ac0d2ebe612e313093262 #16338

Closes #16340

5 months agocmake: allow empty custom `IMPORT_LIB_SUFFIX`, add suffix collision detection
Viktor Szakats [Fri, 14 Feb 2025 10:35:12 +0000 (11:35 +0100)] 
cmake: allow empty custom `IMPORT_LIB_SUFFIX`, add suffix collision detection

Allow overriding the `IMPORT_LIB_SUFFIX` default with an empty value.

Also:
- add a fatal error if the implib and static lib filename are identical.
- clarify `IMPORT_LIB_SUFFIX` default value in the documentation.

Reported-by: RubisetCie on Github
Fixes #16324
Ref: 1199308dbc902c52be67fc805c72dd2582520d30 #11505

Closes #16332

5 months agocmake: add pre-fill for Unix, enable in GHA/macos, verify pre-fills
Viktor Szakats [Fri, 27 Dec 2024 23:27:26 +0000 (00:27 +0100)] 
cmake: add pre-fill for Unix, enable in GHA/macos, verify pre-fills

TL;DR: Save 10 minutes of CI time for GHA/macos jobs using pre-fills and
add pre-fill verification for Apple and Windows. Also restores Xcode job
and saves 1.5-10 minutes configuring iOS jobs.

Pre-filling feature detection results can bring down the CMake configure
step to ~5 seconds on most GHA runners, ~10 seconds in slow envs like
Cygwin/MSYS2.

The potential savings per job are:
- 5-40 (average 19) seconds on GHA/macos (33 jobs)
- ~10 seconds on GHA for iOS GNU Makefile (1 job)
- 1.5-10 minutes on GHA for iOS Xcode generator (1 job)
- 10 seconds on GHA/linux with native Ubuntu (12 jobs)
- 40 seconds for Cygwin/MSYS2 (2 jobs)
- 5-10 seconds for virtualized BSDs, native CPU (3 jobs)
- ~60 seconds for virtualized BSDs, emulated CPU (1 job)

On native Windows pre-filling has been in place for a long time and
saving 8 minutes (VS2019-VS2015) to 1.5-2 minutes (VS2022), 3 minutes
(VS2022 UWP), and 30-60 seconds (MinGW), per CI job.

The downside is that detection results need to be manually collected and
filtered to those that universally apply to all platforms that they are
enabled on. Another downside is that by using a cache, we're not running
the actual detections, and thus won't catch regressions in them. It
means we must make sure that the cache is solid and matches with actual
detections results. An upside is that it gives a rough overview of which
features are available on which platforms. Another upside is pre-filled
values do work for feature detections skipped for cross-builds, e.g.
`HAVE_WRITABLE_ARGV`.

This PR adds a pre-fill cache that supports all Unixes (except OmniOS)
used in CI, and makes it usable with an internal option. It also enables
it for GHA/macos CI jobs, where the maximum savings are. And also for
the two iOS [1] and two Cygwin/MSYS2 jobs. The latters don't have
pre-fill checks and we can drop them if they turn into a hassle.

Saving:
- 10 minutes of CI time per GHA/macos workflow run. [2]
- ~80 seconds per GHA/windows workflow run with Cygwin/MSYS2.
  (offsetting the cost of pre-fill verifications)
- 1.5-10 minutes per GHA/non-native runs with iOS jobs. [3]

You can enable pre-fill locally with `-D_CURL_PREFILL=ON`. It's
experimental, and if you experience a problem, file a PR or an Issue.

This PR also adds a pre-fill checker for macOS and MinGW/MSVC Windows
GHA jobs to catch if the cache diverges from real detections. It also
adds this logic to AppVeyor, but doesn't enable it due to the perf
penalty of 2 minutes mininum.

The pre-fill checker works by configuring out-of-tree with and without
pre-fill, then diffing their `lib/curl_config.h` outputs.

Exceptions are 3 detection results exposed indirectly [4], and missing
to expose 2, of which one is the C89 header `stddef.h`. While we assume
the C99 `stdint.h` available outside iOS. We can expose them in the
future, if necessary.

The pre-fill checks cost in total:
- ~20 seconds for macOS
- ~40 seconds for MinGW on GHA
- ~80 seconds for MSVC on GHA (UWP would be 2x this)

An extra time saving potential is caching type sizes. They are
well-known, and seldom change, esp. in CI. GHA/Windows jobs spend 8-17
seconds per job on these ~12 feature checks. ~5s on Cygwin/MSYS2. Couple
of seconds on other platforms. (This PR doesn't make this optimization.)

Another opportunity is doing the same for autotools, which typically
spends more time in the configuration step than cmake.

[1] Xcode job restored as a
follow-up to be5f20202c1618788b3d8f6d255543638f48bd65 #16302

[2] GHA/macos cmake configure times in seconds:
Job                                              |  Bef. | After |  Gain
:----------------------------------------------- | ----: | ----: | ----:
CM clang GnuTLS !ldap krb5                       |  21.2 |   4.5 |  16.7
CM clang LibreSSL !ldap heimdal c-ares +examples |  13.3 |   3.9 |   9.4
CM clang OpenSSL +static libssh +examples        |  20.0 |   4.6 |  15.4
CM clang OpenSSL IDN clang-tidy~ (w/chkprefill)  |  15.7 |  18.6 |  -2.9
CM clang OpenSSL gsasl rtmp AppleIDN             |  25.0 |   4.7 |  20.3
CM clang OpenSSL torture !FTP                    |  15.3 |   4.5 |  10.8
CM clang OpenSSL torture FTP                     |  25.0 |   5.9 |  19.1
CM clang SecureTransport debug                   |  18.0 |   3.8 |  14.2
CM clang macos-13 SecureTransport                |  45.8 |  12.4 |  33.4
CM clang macos-14 SecureTransport                |  15.8 |   4.6 |  11.2
CM clang macos-15 SecureTransport                |  26.8 |   6.1 |  20.7
CM clang mbedTLS openldap brotli zstd            |  15.1 |   6.5 |   8.6
CM clang wolfSSL !ldap brotli zstd               |  27.0 |   4.4 |  22.6
CM gcc-12 GnuTLS !ldap krb5                      |  39.1 |   8.7 |  30.4
CM gcc-12 LibreSSL !ldap heimdal c-ares +examples|  23.8 |   7.2 |  16.6
CM gcc-12 OpenSSL +static libssh +examples       |  20.7 |   8.5 |  12.2
CM gcc-12 OpenSSL gsasl rtmp AppleIDN            |  23.1 |  10.1 |  13.0
CM gcc-12 SecureTransport debug                  |  21.1 |   4.8 |  16.3
CM gcc-12 mbedTLS openldap brotli zstd           |  21.4 |   5.8 |  15.6
CM gcc-12 wolfSSL !ldap brotli zstd              |  21.1 |   6.9 |  14.2
CM gcc-14 macos-13 SecureTransport               |  61.9 |  18.7 |  43.2
CM gcc-14 macos-14 SecureTransport               |  30.5 |   6.4 |  24.1
CM gcc-14 macos-15 SecureTransport               |  32.7 |   8.4 |  24.3
CM llvm@15 GnuTLS !ldap krb5                     |  21.1 |   7.5 |  13.6
CM llvm@15 LibreSSL !ldap heimdal c-ares +exampl~|  24.6 |   6.8 |  17.8
CM llvm@15 OpenSSL +static libssh +examples      |  19.0 |   6.4 |  12.6
CM llvm@15 OpenSSL gsasl rtmp AppleIDN           |  19.0 |   8.2 |  10.8
CM llvm@15 SecureTransport debug                 |  18.0 |   5.4 |  12.6
CM llvm@15 macos-13 SecureTransport              |  66.2 |  25.7 |  40.5
CM llvm@15 macos-14 SecureTransport              |  31.9 |   6.1 |  25.8
CM llvm@15 mbedTLS openldap brotli zstd          |  19.5 |   8.9 |  10.6
CM llvm@15 wolfSSL !ldap brotli zstd             |  24.3 |   5.9 |  18.4
CM llvm@18 macos-15 SecureTransport              |  33.8 |   6.4 |  27.4
Total                                            | 856.8 | 257.3 | 599.5
Before: https://github.com/curl/curl/actions/runs/13311042735/job/37173478424
After: https://github.com/curl/curl/actions/runs/13313927119/job/37183206426?pr=15841

[3] iOS:
Before: https://github.com/curl/curl/actions/runs/13326401704?pr=15841
After: https://github.com/curl/curl/actions/runs/13332177764?pr=15841

[4] detection results exposed indirectly in `curl_config.h`:
- `HAVE_FILE_OFFSET_BITS` via `_FILE_OFFSET_BITS`
- `HAVE_GETHOSTBYNAME_R_*_REENTRANT` via `NEED_REENTRANT`
- `HAVE_SOCKADDR_IN6_SIN6_ADDR` via `USE_IPV6`

Closes #15841

5 months agocurl_msh3: remove verify bypass from DEBUGBUILDs
Jay Satiro [Sat, 15 Feb 2025 18:32:34 +0000 (13:32 -0500)] 
curl_msh3: remove verify bypass from DEBUGBUILDs

- Remove the workaround that disabled peer verification in DEBUGBUILDs
  when CA certs were provided.

The workaround was part of a TODO that disabled verification in
DEBUGBUILDs with a CAfile/path because apparently there's no way to set
those options in msh3 and that caused some tests to fail. Instead the
tests should fail and this problem should not be covered up.

Ref: https://github.com/curl/curl/pull/16327#issuecomment-2661039423

Closes https://github.com/curl/curl/pull/16342

5 months agoRELEASE-NOTES: synced
Daniel Stenberg [Sat, 15 Feb 2025 21:32:44 +0000 (22:32 +0100)] 
RELEASE-NOTES: synced

5 months agodocs: correct argument names & URL redirection
kriztalz [Fri, 14 Feb 2025 12:34:47 +0000 (13:34 +0100)] 
docs: correct argument names & URL redirection

Closes #16334

5 months agowolfssh: retrieve the error using wolfSSH_get_error
Joseph Chen [Fri, 14 Feb 2025 13:53:51 +0000 (21:53 +0800)] 
wolfssh: retrieve the error using wolfSSH_get_error

Closes #16335