]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
7 months agomime: explicitly rewind subparts at attachment time.
Patrick Monnerat [Sat, 4 Jan 2025 16:10:25 +0000 (17:10 +0100)] 
mime: explicitly rewind subparts at attachment time.

Subparts may have been previously used as a top-level mime structure and
thus not rewound.

New test 695 checks the proper functioning in these particular conditions.

Reported-by: Qriist on github
Fixes #15842
Closes #15911

7 months agodocs/examples/checksrc: don't allow snprintf specifically
Yedaya Katsman [Sun, 5 Jan 2025 20:47:58 +0000 (22:47 +0200)] 
docs/examples/checksrc: don't allow snprintf specifically

This isn't needed anymore after https://github.com/curl/curl/pull/15835,
since banned functions are just allowed in general in
`docs/examples/.checksrc`, and emits a warning when running make
checksrc:

`invalid warning specified in .checksrc: "SNPRINTF"`

Closes #15916

7 months agoautotools: silence gcc warnings in libtool code
Viktor Szakats [Sun, 5 Jan 2025 13:24:40 +0000 (14:24 +0100)] 
autotools: silence gcc warnings in libtool code

```
./.libs/lt-upload-pausing.c: In function 'lt_fatal':
./.libs/lt-upload-pausing.c:593:1: warning: function might be candidate for attribute 'noreturn' [-Wsuggest-attribute=noreturn]
  593 | lt_fatal (const char *file, int line, const char *message, ...)
      | ^~~~~~~~
```
https://github.com/curl/curl/actions/runs/12611924141/job/35148104431?pr=15911#step:11:264

Ref: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wsuggest-attribute_003d

Closes #15915

7 months agoINFRASTRUCTURE.md: project infra
Daniel Stenberg [Fri, 3 Jan 2025 13:47:13 +0000 (14:47 +0100)] 
INFRASTRUCTURE.md: project infra

Closes #15906

7 months agocmake: publish/check supported protocols/features via `CURLConfig.cmake`
Viktor Szakats [Sun, 29 Dec 2024 21:34:09 +0000 (22:34 +0100)] 
cmake: publish/check supported protocols/features via `CURLConfig.cmake`

Via these variables, as lists:
- `CURL_SUPPORTED_PROTOCOLS`
- `CURL_SUPPORTED_FEATURES`

As individual flags:
- `CURL_SUPPORTS_<protocol/feature>` = `TRUE`

Also:
- set `CURL_VERSION_STRING` which was missing when using
  `find_package(CURL CONFIG)` or
  `find_package(CURL NO_MODULE)`.
- set `CURL_<prototol/feature>_FOUND` for compatibility.
- show full list of missing but required `COMPONENTS`.

Assisted-by: Derek Huang
Fixes #15854
Closes #15858

7 months agocheckdocs: trim links off docs/ markdowns before spellcheck
Daniel Stenberg [Fri, 3 Jan 2025 16:47:37 +0000 (17:47 +0100)] 
checkdocs: trim links off docs/ markdowns before spellcheck

So that we can use words in links without having them spellchecked.

Closes #15910

7 months agocleancmd.pl: strip out backticked words
Daniel Stenberg [Fri, 3 Jan 2025 17:15:44 +0000 (18:15 +0100)] 
cleancmd.pl: strip out backticked words

To make sure they are not spellchecked. Also, leaving two backticks is
not good because they cause the spellchecker to misinterpret the
markdown file so they have to be removed as well.

7 months agonetrc: 'default' with no credentials is not a match
Daniel Stenberg [Fri, 3 Jan 2025 15:22:27 +0000 (16:22 +0100)] 
netrc: 'default' with no credentials is not a match

Test 486 verifies.

Reported-by: Yihang Zhou
Closes #15908

7 months agoCURLOPT_SEEKFUNCTION.md: used for FTP, HTTP and SFTP (only)
Daniel Stenberg [Thu, 2 Jan 2025 16:52:45 +0000 (17:52 +0100)] 
CURLOPT_SEEKFUNCTION.md: used for FTP, HTTP and SFTP (only)

The same goes for *SEEKDATA.

Closes #15903

7 months agoGHA/http3-linux: fix cache rebuild conditions, switch to wolfSSL stable
Viktor Szakats [Wed, 1 Jan 2025 02:59:25 +0000 (03:59 +0100)] 
GHA/http3-linux: fix cache rebuild conditions, switch to wolfSSL stable

ngtcp2 depends on crypto backends. nghttp2 depends on ngtcp2 and nghttp3
(for nghttpx server used in pytests).

Before this patch, ngtcp2, nghttp2 weren't rebuilt when their
dependencies changes. This worked fine until wolfSSL bumped its
soversion and caused CI to fail because ngtcp2 was not rebuilt and was
still referring to the old soname that was no longer offered by the
wolfSSL package.

Make sure to rebuild ngtcp2/nghttp2 when any of their dependencies bump.
To avoid rebuilding everything on every wolfSSL commit, switch to use
wolfSSL stable versions.

Bug: https://github.com/curl/curl/pull/15882#issuecomment-2566821417
Closes #15885

7 months agosmb: fix compiler warning
prpr19xx on github [Thu, 2 Jan 2025 16:22:01 +0000 (16:22 +0000)] 
smb: fix compiler warning

An old version of GCC (4.5.2 on a mipsel) moans about the constant being
too big to fit in a long.

Closes #15902

7 months agodocs: use lowercase curl and libcurl
Daniel Stenberg [Thu, 2 Jan 2025 13:43:23 +0000 (14:43 +0100)] 
docs: use lowercase curl and libcurl

Adjusted badwords to find them.

Plus: make badwords run on all markdown files in the repo and update
markdowns previously unchecked

Closes #15898

7 months agodocs/libcurl/opts: clarify the return values
Daniel Stenberg [Thu, 2 Jan 2025 14:54:12 +0000 (15:54 +0100)] 
docs/libcurl/opts: clarify the return values

Expand a little.

- mention the type name of the return code
- avoid stating which exact return codes that might be returned, as that
  varies over time, builds and conditions
- avoid stating some always return OK
- refer to the manpage documenting all the return codes

Closes #15900

7 months agodocs/cmdline-opts/_ENVIRONMENT.md: minor language fix
Daniel Stenberg [Thu, 2 Jan 2025 13:07:11 +0000 (14:07 +0100)] 
docs/cmdline-opts/_ENVIRONMENT.md: minor language fix

Closes #15897

7 months agodocs/libcurl: return value overhall
Daniel Stenberg [Thu, 2 Jan 2025 14:43:12 +0000 (15:43 +0100)] 
docs/libcurl: return value overhall

Unified, extended, clarified the return values for numerous functions

Closes #15899

7 months agosrc: drop support for `CURL_TESTDIR` debug env
Viktor Szakats [Wed, 1 Jan 2025 22:14:13 +0000 (23:14 +0100)] 
src: drop support for `CURL_TESTDIR` debug env

No longer used by curl tests.

`--output-dir` option can be used as an alternative in all builds.

Follow-up to 39697dead3e7e3366941fe740226d56f30e6fc9e #15114
Closes #15893

7 months agocmake/FindLDAP: avoid framework locations for libs too (Apple)
Viktor Szakats [Thu, 2 Jan 2025 01:46:00 +0000 (02:46 +0100)] 
cmake/FindLDAP: avoid framework locations for libs too (Apple)

We already avoid system framework paths while looking for LDAP headers
to avoid issues.

Do the same while looking for LDAP libraries. This makes sure to find
the regular ldap library (`libldap.tbd`) instead of picking up
`ldap.framework` and let that seep into `libcurl.pc` with a full path.

This makes LDAP detection work on Apple as before introducing FindLDAP.

Follow-up to 49f2a23d509645d534cbb2e2ffbd6347fac6e59e #15273
Closes #15895

7 months agocmake: make system libraries `dl`, `m`, `pthread` customizable
Viktor Szakats [Wed, 1 Jan 2025 21:55:07 +0000 (22:55 +0100)] 
cmake: make system libraries `dl`, `m`, `pthread` customizable

via `DL_LIBRARY`, `MATH_LIBRARY`, `PTHREAD_LIBRARY` variables.

They are used in Rustls, wolfSSL Find modules.

Also:
- always use `NAMES` keyword in `find_library()` calls.
- respect `find_library()` results for `dl`, `m`, `pthread`.
- formatting.

Closes #15892

7 months agocurl_sha512_256: rename symbols to the curl namespace
Viktor Szakats [Wed, 1 Jan 2025 22:32:40 +0000 (23:32 +0100)] 
curl_sha512_256: rename symbols to the curl namespace

Closes #15894

7 months agodocs/HTTP-COOKIES.md: link to more information
Daniel Stenberg [Wed, 1 Jan 2025 20:18:11 +0000 (21:18 +0100)] 
docs/HTTP-COOKIES.md: link to more information

Closes #15891

7 months agohash: add asserts in hash_element_dtor()
Daniel Stenberg [Wed, 1 Jan 2025 19:37:47 +0000 (20:37 +0100)] 
hash: add asserts in hash_element_dtor()

This just adds a precaution and shows a clear intention in the code.
Added because CodeSonar is reporting a false positive Use After Free on
this function.

Closes #15889

7 months agoCOPYING: bump copyright year range to 1996 - 2025
Daniel Stenberg [Wed, 1 Jan 2025 19:58:42 +0000 (20:58 +0100)] 
COPYING: bump copyright year range to 1996 - 2025

Closes #15890

7 months agoselect: avoid a NULL deref in cwfds_add_sock
Daniel Stenberg [Wed, 1 Jan 2025 00:00:33 +0000 (01:00 +0100)] 
select: avoid a NULL deref in cwfds_add_sock

curl_multi_waitfds(m, NULL, ...);

=> Curl_waitfds_init(&cwfds, ufds, size);

=> Curl_waitfds_add_ps(&cwfds);

=>   cwfds_add_sock(cwfds, ...);

Would then try to use the ->wfds array while set to NULL previously.
This should not happen, which this is now also protected with an assert
to trigger debug builds if it happens.

Caught by CodeSonar

Assisted-by: Jay Satiro
Closes #15881

7 months agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 1 Jan 2025 13:50:59 +0000 (14:50 +0100)] 
RELEASE-NOTES: synced

7 months agoopenssl: add support to use keys and certificates from PKCS#11 provider
Jakub Jelen [Thu, 14 Nov 2024 16:57:48 +0000 (17:57 +0100)] 
openssl: add support to use keys and certificates from PKCS#11 provider

In OpenSSL < 3.0, the modularity was provided by mechanism called
"engines". This is supported in curl, but the engines got deprecated
with OpenSSL 3.0 in favor of more versatile providers.

This adds a support for OpenSSL Providers, to use PKCS#11 keys, namely
through the pkcs11 provider. This is done using similar approach as the
engines and this is automatically built in when the OpenSSL 3 and newer
is used.

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Closes #15587

7 months agoGHA/http3-linux: drop redundant `pkg-config` paths for ngtcp2/nghttp2
Viktor Szakats [Wed, 1 Jan 2025 13:10:53 +0000 (14:10 +0100)] 
GHA/http3-linux: drop redundant `pkg-config` paths for ngtcp2/nghttp2

- ngtcp2: drop `$PWD/build` (= self)
- ngtcp2: drop nghttp3. It's only used for examples, which we do not use
  here and are disabled by default.
- nghttp2: drop `$HOME/build` (does not exist)

Closes #15887

7 months agourlapi: cleanup the redirect logic somewhat
Daniel Stenberg [Tue, 31 Dec 2024 12:27:12 +0000 (13:27 +0100)] 
urlapi: cleanup the redirect logic somewhat

Closes #15877

7 months agolib: remove `__EMX__` guards
Viktor Szakats [Wed, 1 Jan 2025 02:33:26 +0000 (03:33 +0100)] 
lib: remove `__EMX__` guards

Follow-up to 179ee78e8672ec44c50aa36279c48b28e008ea29 #2166
Closes #15884

7 months agofile: fix Android compiler warning
Viktor Szakats [Wed, 1 Jan 2025 02:28:09 +0000 (03:28 +0100)] 
file: fix Android compiler warning

Apply the fix already used in `lib/fopen.c`.

```
lib/file.c:326:41: warning: implicit conversion loses integer precision: 'unsigned int' to 'mode_t' (aka 'unsigned short') [-Wimplicit-int-conversion]
  326 |   fd = open(file->path, mode, data->set.new_file_perms);
      |        ~~~~                   ~~~~~~~~~~^~~~~~~~~~~~~~
```

Closes #15883

7 months agofile: drop `OPEN_NEEDS_ARG3` option
Viktor Szakats [Wed, 1 Jan 2025 02:19:24 +0000 (03:19 +0100)] 
file: drop `OPEN_NEEDS_ARG3` option

Not set since 1bf3643f7b1760f7f92cbb42df2dbdc94e29bf96 #8362 (2022)
Added in 00883822be245d2660a569e6bde38892b9433aa2 (2009) for VxWorks.

Closes #15882

7 months agomultissl: auto-enable `OPENSSL_COEXIST` for wolfSSL + OpenSSL
Viktor Szakats [Wed, 1 Jan 2025 04:16:24 +0000 (05:16 +0100)] 
multissl: auto-enable `OPENSSL_COEXIST` for wolfSSL + OpenSSL

When building with both OpenSSL and wolfSSL set this necessary option.
Otherwise fail with an error.

Requires wolfSSL v5.7.6 or upper.

Closes #15765

7 months agoCI: update dependency wolfSSL/wolfssl to v5.7.6
renovate[bot] [Wed, 1 Jan 2025 03:56:57 +0000 (03:56 +0000)] 
CI: update dependency wolfSSL/wolfssl to v5.7.6

Closes #15886

7 months agobuild: replace configure check with PP condition (Android <21)
Viktor Szakats [Tue, 31 Dec 2024 01:22:42 +0000 (02:22 +0100)] 
build: replace configure check with PP condition (Android <21)

To make it build again with CMake + Android 20 and earlier.

8e345057761a8f796403923a96f2c8fd3edca647 synced `getpwuid_r()` detection
in cmake with autotools. It means cmake started detecting it with
Android <21 just like autotools, and thus cmake builds also need to
tackle the missing declaration with old Android SDK versions. Use a PP
solution, allowing to drop the autotools-specific on used before this
patch.

Follow-up to 8e345057761a8f796403923a96f2c8fd3edca647 #15164
Follow-up to 9c33813d835dde214c1a9449f789dd72ab3d9dc3 #2609
Ref: #2058
Closes #15871

7 months agotest483: require cookie support
Marcel Raad [Tue, 31 Dec 2024 09:35:40 +0000 (10:35 +0100)] 
test483: require cookie support

The test fails with `--disable-cookies`.

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

7 months agotest3105: verify multi_remove_handle done twice
Daniel Stenberg [Mon, 30 Dec 2024 09:06:24 +0000 (10:06 +0100)] 
test3105: verify multi_remove_handle done twice

It should be ok.

Ref: #15852
Closes #15860

7 months agocmp-config: drop 3 exceptions
Viktor Szakats [Tue, 31 Dec 2024 01:43:36 +0000 (02:43 +0100)] 
cmp-config: drop 3 exceptions

Follow-up to fd067bfb5b028ac41660decc5abb87f1cd093b6b #15596
Closes #15872

7 months agoGHA/configure-vs-cmake: trigger by `CMake/**` updates
Viktor Szakats [Tue, 31 Dec 2024 03:22:30 +0000 (04:22 +0100)] 
GHA/configure-vs-cmake: trigger by `CMake/**` updates

Closes #15875

7 months agocmake: sync OpenSSL QUIC fork detection with autotools
Viktor Szakats [Tue, 31 Dec 2024 01:49:51 +0000 (02:49 +0100)] 
cmake: sync OpenSSL QUIC fork detection with autotools

Before this patch, detection used a function which wasn't called
from curl since d2c6d8be18adfe4c49ca8948d04e228ba1a6e9fb #8968.

Follow-up to b3f02e1d927f10b48bdaa573fe09e28bdc25d94d #12683
Closes #15873

7 months agocmake: fix `net/in.h` detection for MS-DOS
Viktor Szakats [Mon, 30 Dec 2024 22:48:09 +0000 (23:48 +0100)] 
cmake: fix `net/in.h` detection for MS-DOS

Syncing this with autotools.

Follow-up to 8e345057761a8f796403923a96f2c8fd3edca647 #15164
Closes #15869

7 months agobuild: fix unsigned `time_t` detection for cmake, MS-DOS, AmigaOS
Viktor Szakats [Mon, 30 Dec 2024 19:57:41 +0000 (20:57 +0100)] 
build: fix unsigned `time_t` detection for cmake, MS-DOS, AmigaOS

- cmake: add auto-detection. Sync this with autotools.
- enable for MS-DOS and AmigaOS builds.
  (auto-detection doesn't work for cross-builds.)
- tidy up detection snippet.
- fix comment.

Closes #15868

7 months agoconfigure: drop unused detections and macros
Viktor Szakats [Mon, 30 Dec 2024 19:02:19 +0000 (20:02 +0100)] 
configure: drop unused detections and macros

- drop `HAVE_IOCTL` macro, drop exception.
- drop unused `setjmp.h` detection, drop exception.
  It's a C89 header and result also not used in detections.
- use C89 `stdlib.h` without detection.
  (It's still being detected by autotools anyway.)

Closes #15867

7 months agomulti: fix return code for an already-removed easy handle
Jay Satiro [Sat, 28 Dec 2024 23:47:45 +0000 (18:47 -0500)] 
multi: fix return code for an already-removed easy handle

- Ensure that CURLM_OK is returned when curl_multi_remove_handle is
  called with an already removed easy handle.

Prior to this change and since ba235ab2 which precedes 8.10.0, if
curl_multi_remove_handle was called with an already-removed easy handle
then the return code would be CURLM_OK or CURLM_BAD_EASY_HANDLE
depending respectively on whether the multi did or did not contain other
easy handles.

This change restores the old behavior of returning CURLM_OK in both
cases.

Reported-by: Ralph Sennhauser
Fixes https://github.com/curl/curl/issues/15844
Closes https://github.com/curl/curl/pull/15852

7 months agohttp: ignore invalid Retry-After times
Jay Satiro [Thu, 26 Dec 2024 20:38:39 +0000 (15:38 -0500)] 
http: ignore invalid Retry-After times

- Treat negative Retry-After date-based times as 0.

- Treat Retry-After times greater than 6 hours as 6 hours.

Prior to this change Retry-After did not have a limited range and the
server could have set a time greater than 6 hours or a date in the past
that would result in a negative time, either of which may be unexpected
by the user.

The 6 hour limit is purposely not documented so that it can be changed
in the future if necessary.

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

7 months agoGHA/http3-linux: do run on cmake build updates
Viktor Szakats [Tue, 31 Dec 2024 03:07:36 +0000 (04:07 +0100)] 
GHA/http3-linux: do run on cmake build updates

Closes #15874

7 months agoexamples/block-ip: drop redundant `memory.h` include
Viktor Szakats [Mon, 30 Dec 2024 19:04:08 +0000 (20:04 +0100)] 
examples/block-ip: drop redundant `memory.h` include

Not used elsewhere in the repo.

7 months agocmake: rename Windows detection cache file
Viktor Szakats [Sun, 29 Dec 2024 23:57:09 +0000 (00:57 +0100)] 
cmake: rename Windows detection cache file

To flatten the directory tree.

Closes #15859

7 months agovtls: only remember the expiry timestamp in session cache
Stefan Eissing [Mon, 30 Dec 2024 09:58:35 +0000 (10:58 +0100)] 
vtls: only remember the expiry timestamp in session cache

Instead of receive and lifetime, keep only the eppch seconds when a
session expires.

Closes #15861

7 months agocurl/var: change byte offset syntax for assignments
Daniel Stenberg [Mon, 30 Dec 2024 12:17:39 +0000 (13:17 +0100)] 
curl/var: change byte offset syntax for assignments

Follow-up to 40c264db617d0 after discussions on IRC.

The new style is

  name[0-99]=contents

and

  name[0-99]@filename

A) This does not cause the same problems with old curl versions trying
the new syntax as this way will cause old curls just fail with syntax
error and not risk using the wrong file.

B) Adds the same byte range support for "normal" assigns, which the
previous syntax did not. Thus lets a user get a partial content of a
variable etc.

Added test 790 and 791 to verify non-file assigns with ranges.

Closes #15862

7 months agoGHA/non-native: measure duration of individual build steps inside VMs
Viktor Szakats [Mon, 30 Dec 2024 13:04:38 +0000 (14:04 +0100)] 
GHA/non-native: measure duration of individual build steps inside VMs

Closes #15864

7 months agoCI: bump actions/cache from 4.1.2 to 4.2.0
dependabot[bot] [Mon, 23 Dec 2024 14:15:53 +0000 (14:15 +0000)] 
CI: bump actions/cache from 4.1.2 to 4.2.0

Bumps [actions/cache](https://github.com/actions/cache) from 4.1.2 to 4.2.0.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v4.1.2...1bd1e32a3bdc45362d1e726936510720a7c30a57)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

7 months agoCI: bump actions/upload-artifact from 4.4.3 to 4.5.0
dependabot[bot] [Mon, 23 Dec 2024 14:15:48 +0000 (14:15 +0000)] 
CI: bump actions/upload-artifact from 4.4.3 to 4.5.0

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.4.3 to 4.5.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882...6f51ac03b9356f520e9adb1b1b7802705f340c2b)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

7 months agoTheArtOfHttpScripting.md: rewrite double 'that'
Daniel Stenberg [Mon, 30 Dec 2024 12:42:25 +0000 (13:42 +0100)] 
TheArtOfHttpScripting.md: rewrite double 'that'

Closes #15863

7 months agombedtls: fix handling of blocked sends
Stefan Eissing [Sat, 28 Dec 2024 11:19:19 +0000 (12:19 +0100)] 
mbedtls: fix handling of blocked sends

mbedtls is picky when a mbedtls_ssl_write) was previously blocked. It
requires to be called with the same amount of bytes again, or it will
lose bytes, e.g. reporting all was sent but they were not. Remember the
blocked length and use that when set.

Reported-by: Tamás Bálint Misius
Fixes #15801
Closes #15846

7 months agochecksrc: introduce 'banfunc' to ban specific functions
Daniel Stenberg [Fri, 27 Dec 2024 08:21:56 +0000 (09:21 +0100)] 
checksrc: introduce 'banfunc' to ban specific functions

Use 'banfunc' and 'allowfunc' in .checksrc to specify which functions to
ban or allow to be used. This saves us from having to edit the script
going forward when we want to ban or allow specific functions.

This replaces a set of previous rules and all banned functions are now
checked with the BANNEDFUNC rule.

There is a set of default banned functions, shown by invoking
./checksrc.

Also, -a and -b options are added to specify allowed or banned functions
on the command line.

Closes #15835

7 months agourlapi: fix redirect to a new fragment or query (only)
Daniel Stenberg [Sat, 28 Dec 2024 13:47:01 +0000 (14:47 +0100)] 
urlapi: fix redirect to a new fragment or query (only)

The redirect logic was broken when the redirect-to URL was a relative
URL only as a fragment or query (starting with '#' or '?').

Extended test 1560 to reproduce, then verify.

Reported-by: Jeroen Ooms
Fixes #15836
Closes #15848

7 months agoCI: update vmactions/omnios-vm digest
renovate[bot] [Sun, 29 Dec 2024 00:14:50 +0000 (00:14 +0000)] 
CI: update vmactions/omnios-vm digest

to https://github.com/vmactions/omnios-vm/commit/8eba2a9217262f275d4566751a92d6ef2f433d00

Closes #15853

7 months agoRELEASE-NOTES: synced
Daniel Stenberg [Sun, 29 Dec 2024 13:23:21 +0000 (14:23 +0100)] 
RELEASE-NOTES: synced

Bump the planned next version to 8.12.0

7 months agocmake: use `STREQUAL` to detect Linux
Viktor Szakats [Sun, 29 Dec 2024 11:45:32 +0000 (12:45 +0100)] 
cmake: use `STREQUAL` to detect Linux

Instead of `MATCHES`.
To sync with another check that already used `STREQUAL`.

Closes #15855

7 months agomulti: fix curl_multi_waitfds reporting of fd_count 15155/head
Christopher Dannemiller [Fri, 4 Oct 2024 16:31:59 +0000 (09:31 -0700)] 
multi: fix curl_multi_waitfds reporting of fd_count

- Make curl_multi_waitfds consistent with the documentation.

Issue Addressed:

 - The documentation of curl_multi_waitfds indicates that users should
   be able to call curl_multi_waitfds with a NULL ufds. However, before
   this change, the function would return CURLM_BAD_FUNCTION_ARGUMENT.
 - Additionally, the documentation suggests that users can use this
   function to determine the number of file descriptors (fds) needed.
   However, the function would stop counting fds if the supplied fds
   were exhausted.

Changes Made:

 - NULL ufds Handling: curl_multi_waitfds can now accept a NULL ufds if
   size is also zero.
 - Counting File Descriptors: If curl_multi_waitfds is passed a NULL
   ufds, or the size of ufds is insufficient, the output parameter
   fd_count will return the number of fds needed. This value may be
   higher than actually needed but never lower.

Testing:

 - Test 2405 has been updated to cover the usage scenarios described
   above.

Fixes https://github.com/curl/curl/issues/15146
Closes https://github.com/curl/curl/pull/15155

7 months agoGHA/windows: shorten job timeouts
Viktor Szakats [Sat, 28 Dec 2024 22:23:04 +0000 (23:23 +0100)] 
GHA/windows: shorten job timeouts

To reduce the wait for re-running stuck jobs.

Sometimes jobs hang/get stuck while running tests, ignoring the step
timeout.

Closes #15851

7 months agocmake: optimize out 4 picky warning option detections with gcc
Viktor Szakats [Sat, 28 Dec 2024 19:20:38 +0000 (20:20 +0100)] 
cmake: optimize out 4 picky warning option detections with gcc

Follow-up to 9c543de0ecf14880c3324d3d24591fb695dd1917 #10973
Closes #15850

7 months agocmake: drop unused `HAVE_SYS_XATTR_H` detection
Viktor Szakats [Sat, 28 Dec 2024 11:06:53 +0000 (12:06 +0100)] 
cmake: drop unused `HAVE_SYS_XATTR_H` detection

Follow-up to 8e345057761a8f796403923a96f2c8fd3edca647 #15164
Follow-up to 1c877a0712b7851c7f286007193668058ed2e987 #1176

Closes #15845

7 months agocmake: tidy up local variable names
Viktor Szakats [Sun, 1 Jan 2023 00:11:51 +0000 (01:11 +0100)] 
cmake: tidy up local variable names

Closes #15843

7 months agocmake: drop duplicate Windows cache value
Viktor Szakats [Fri, 27 Dec 2024 22:54:37 +0000 (23:54 +0100)] 
cmake: drop duplicate Windows cache value

Closes #15840

7 months agotidy-up: rename `MHDX_INLINE` to `CURL_FORCEINLINE`
Viktor Szakats [Fri, 27 Dec 2024 22:35:48 +0000 (23:35 +0100)] 
tidy-up: rename `MHDX_INLINE` to `CURL_FORCEINLINE`

Closes #15839

7 months agoGHA/non-native: fix CM/AM in FreeBSD job names
Viktor Szakats [Fri, 27 Dec 2024 21:57:28 +0000 (22:57 +0100)] 
GHA/non-native: fix CM/AM in FreeBSD job names

Closes #15837

7 months agocookie: fix crash in netscape cookie parsing
Jay Satiro [Tue, 24 Dec 2024 07:18:37 +0000 (02:18 -0500)] 
cookie: fix crash in netscape cookie parsing

- Parse the input string without modifying it.

Prior to this change a segfault could occur if the input string was
const because the tokenizer modified the input string. For example if
the user set CURLOPT_COOKIELIST to a const string then libcurl would
likely cause a crash when modifying that string. Even if the string was
not const or a crash did not occur there was still the incorrect and
unexpected modification of the user's input string.

This issue was caused by 30da1f59 (precedes 8.11.0) which refactored
some options parsing and eliminated the copy of the input string. Also,
an earlier commit f88cc654 incorrectly cast the input pointer when
passing it to strtok.

Co-authored-by: Daniel Stenberg
Closes https://github.com/curl/curl/pull/15826

7 months agoclang-tidy: add to CI, add cmake support, fix fallouts
Viktor Szakats [Tue, 24 Dec 2024 01:43:02 +0000 (02:43 +0100)] 
clang-tidy: add to CI, add cmake support, fix fallouts

build:
- autotools: fix to build generated sources for the `tidy` target.
- autotools: allow passing custom clang-tidy options via
  `CURL_CLANG_TIDYFLAGS` env.
- cmake: add `CURL_CLANG_TIDY` option to configure for `clang-tidy`.
  Also add:
  - `CLANG_TIDY` variable to customize the `clang-tidy` tool.
  - `CURL_CLANG_TIDYFLAGS` to pass custom options to `clang-tidy`.
- apply `--enable-werror` and `-DCURL_WERROR=ON` to `clang-tidy`.

CI/GHA:
- add clang-tidy job for Linux, using autotools and clang-tidy v18.
  This one needs to disable `clang-analyzer-valist.Uninitialized`
  to avoid false positives:
  https://github.com/llvm/llvm-project/issues/40656
  Duration: 5.5 minutes
- add clang-tidy job for macOS, using cmake and clang-tidy v19.
  This one also covers tests and examples, and doesn't hit the false
  positives seen with llvm v18 and earlier.
  Duration: 4.5 minutes
- Linux/macOS: skip installing test dependencies when not building or
  running tests.

fix fallouts reported by `clang-tidy`:
- lib:
  - cf-h2-proxy: unused assignment in non-debug builds.
  - cf-socket: silence warning.
    FIXME: https://github.com/curl/curl/pull/15825#issuecomment-2561867769
  - ftp: NULL passed to `strncmp()`.
  - http2: NULL-ptr deref.
  - mprintf: silence warning.
- src/tool_writeout: NULL passed to `fputs()`.
- examples:
  - invalid file pointers.
  - missing `fclose()`.
- tests:
  - http/clients/hx-download: memory leaks on error.
  - http/clients/hx-download: memory leak on repeat `-r` option.
  - server: double `fclose()`.
    https://www.man7.org/linux/man-pages/man3/fclose.3.html
  - server: invalid file pointer/handle.
  - server/getpart: unused assignments.
  - server/mqttd: leak on failed `realloc()`.
  - server/tftpd: NULL passed to `strcmp()`.

Closes #15825

7 months agocmake: add `librtmp` Find module
Viktor Szakats [Thu, 26 Dec 2024 10:34:24 +0000 (11:34 +0100)] 
cmake: add `librtmp` Find module

The new detection method also allows to enable librtmp without using
OpenSSL as a curl TLS backend at the same time.

Also:
- implement manual version detection for librtmp.
  Version info is in hex. With CMake 3.13 and newer, extract it as a hex
  number. With earlier CMake version, just strip the leading zeroes.
  Doing more here seems overkill because librtmp has been standing
  at 2.3/2.4 for a decade now. Bumping into hex digits seems unlikely
  before deprecating CMake 3.13 support.
  librtmp advertises v2.4 via its `pkg-config` module, and v2.3 via
  its public header. The latter shows up in `curl -V` and either can
  be shown at configure-time depending on detection method.
  This isn't a curl bug.
- GHA/macos: enable rtmp in a job.
- apply the "half-detection" fix to the Find module.
  `librtmp` is also affected (in CI too), because it depends on libssl and
  libcrypto.

Closes #15832

7 months agocurl_ws_recv.md: fix typo
Jay Satiro [Fri, 27 Dec 2024 05:37:53 +0000 (00:37 -0500)] 
curl_ws_recv.md: fix typo

7 months agocmake: move `pkg-config` names to Find modules
Viktor Szakats [Sun, 22 Dec 2024 10:30:45 +0000 (11:30 +0100)] 
cmake: move `pkg-config` names to Find modules

Make the Find modules set and return their respective `pkg-config`
module name(s) to the CMake build process, which then adds those
to the `Requires:` list.

Before this patch, `pkg-config` module names were maintainted in two
separate places. After this patch, they are maintained in the Find
modules for dependencies that have one (most do).

Re-align existing modules with this change: msh3, mbedtls, rustls.
These modules return their `pkg-config` module name only when
detected via `pkg-config`.

Follow-up to d511ec8b0a56b2a99226fe556abe9f815153c648 #15573
Closes #15800

7 months agocmake: allow `CURL_LTO` regardless of `CURL_BUILD_TYPE`, enable in CI
Viktor Szakats [Tue, 24 Dec 2024 09:09:13 +0000 (10:09 +0100)] 
cmake: allow `CURL_LTO` regardless of `CURL_BUILD_TYPE`, enable in CI

Before this patch `CURL_LTO` only applied to builds explicitly
configured for `Release` or `RelWithDebInfo` via `CURL_BUILD_TYPE`.

After this patch it enables LTO regardess of build type.

Also:
- GHA/linux: enable LTO in an existing job.

Follow-up to 4ccf7622db04af58442c460b8091b952585de5c7 #4799
Closes #15829

7 months agocmake/FindLibpsl: protect against `pkg-config` "half-detection"
Viktor Szakats [Tue, 24 Dec 2024 09:12:31 +0000 (10:12 +0100)] 
cmake/FindLibpsl: protect against `pkg-config` "half-detection"

Same issue as seen before with libssh2: `libpsl`'s pkg-config module
depends on another module, but that's not found. CMake ends up reporting
`LIBPSL_FOUND=YES`, while leaving `LIBPSL_INCLUDE_DIRS` empty. Then
the build fails to find `psl.h`.

The missing dependency in this case is `icu4c`, which is "keg-only",
meaning it's not exposed in the default Homebrew header, pkg-config,
lib, etc locations. It must be added to the `PKG_CONFIG_PATH` env, as
suggested by the warnings messages of `pkgconf`.

To avoid this fallout, let's ensure that `LIBPSL_INCLUDE_DIRS` is
non-empty when detecting via `pkg-config` and fall back to the CMake
detection method otherwise.

This was an issue till Homebrew libpsl 0.21.5_1, fixed in 0.21.5_2, that
no longer depends on `icu4c`.

Example log:
```
-- Checking for module 'libpsl'
--   Found libpsl, version 0.21.5
Package icu-uc was not found in the pkg-config search path.
Perhaps you should add the directory containing `icu-uc.pc'
to the PKG_CONFIG_PATH environment variable
Package 'icu-uc', required by 'libpsl', not found
[...]
-- Found Libpsl (via pkg-config):  (found version "0.21.5")
[...]
In file included from curl/_bld/lib/CMakeFiles/libcurl_static.dir/Unity/unity_0_c.c:4:
In file included from curl/lib/altsvc.c:32:
In file included from curl/lib/urldata.h:145:
curl/lib/psl.h:28:10: fatal error: 'libpsl.h' file not found
         ^~~~~~~~~~
1 error generated.
```

Follow-up to 39c741b7b008b5959980b29ac721357ff75de3f5 #15408
Closes #15827

7 months agocmake/FindLDAP: avoid empty 'Requires' item when omitting `pkg-config` module
Viktor Szakats [Mon, 23 Dec 2024 20:36:23 +0000 (21:36 +0100)] 
cmake/FindLDAP: avoid empty 'Requires' item when omitting `pkg-config` module

`list(APPEND ...)` does this automatically, but we're _prepending_ LDAP
(to follow historical code and also autotools). `list(PREPEND ...)`
would likely do that the same, but it requires CMake 3.15 so we do this
manually and the manual method needs to skip the empty value manually.

Follow-up to 49f2a23d509645d534cbb2e2ffbd6347fac6e59e #15273
Closes #15828

7 months agotidy-up: misc
Viktor Szakats [Sat, 14 Dec 2024 22:52:38 +0000 (23:52 +0100)] 
tidy-up: misc

- lib1531: fix to use `curl_off_t`.
- src/tool_doswin: merge `_WIN32` guards.
- src/tool_doswin: limit `S_ISCHR()` to MS-DOS.
- src: dedupe `CURL_O_BINARY` macro into `tool_setup.h`.
- CMake/CurlTests.c: cleanup/formatting `HAVE_FILE_OFFSET_BITS` test.
- examples/httpput-postfields: delete unused include.
- spelling: MultiSSL.
- whitespace.

Ref: #15652
Closes #15799

7 months agocurl-config: tidy up, optimize
Viktor Szakats [Wed, 20 Nov 2024 21:01:32 +0000 (22:01 +0100)] 
curl-config: tidy up, optimize

- optimize out `cppflag_curl_staticlib` variable.
- optimize out `CPPFLAG_CURL_STATICLIB` variable and simplify logic.
- lowercase local variable name `CURLLIBDIR`.

Closes #15810

7 months agocmake: move GSS init before feature detections
Viktor Szakats [Mon, 23 Dec 2024 00:44:06 +0000 (01:44 +0100)] 
cmake: move GSS init before feature detections

To sync up with other dependency initializations.

Closes #15809

7 months agocurl_url_set.md: adjust the added-in to 7.62.0
Daniel Stenberg [Mon, 23 Dec 2024 22:56:25 +0000 (23:56 +0100)] 
curl_url_set.md: adjust the added-in to 7.62.0

Reported-by: Jeroen Ooms
Fixes #15822
Closes #15823

7 months agohttp: fix build with `CURL_DISABLE_COOKIES`
Marcel Raad [Mon, 23 Dec 2024 17:34:17 +0000 (18:34 +0100)] 
http: fix build with `CURL_DISABLE_COOKIES`

This fixes an oversight from commit fc3e1cbc508.

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

7 months agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 23 Dec 2024 22:06:36 +0000 (23:06 +0100)] 
RELEASE-NOTES: synced

7 months agogetinfo: provide info which auth was used for HTTP and proxy
Daniel Stenberg [Tue, 29 Oct 2024 15:53:32 +0000 (16:53 +0100)] 
getinfo: provide info which auth was used for HTTP and proxy

CURLINFO_HTTPAUTH_USED and CURLINFO_PROXYAUTH_USED

Tested in 590 and 694

Ref: #12668
Idea-by: Ganesh Viswanathan
Closes #15450

7 months agobuild: fix the tidy targets for autotools
Daniel Stenberg [Sun, 22 Dec 2024 23:04:35 +0000 (00:04 +0100)] 
build: fix the tidy targets for autotools

To make them run clang-tidy correctly. clang-tidy occasionally finds
mistakes none of the other static code analyzers we use finds.

Also added the
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling
flag, to make it not complain about memcpy()

"make tidy" in the build root works fine now. The previous clang-tidy CI
job was removed in e43c3b3e3e6c2d580. It is probably time to bring it
back.

Closes #15813

7 months agobuild: drop `-Winline` picky warning
Viktor Szakats [Mon, 23 Dec 2024 17:05:40 +0000 (18:05 +0100)] 
build: drop `-Winline` picky warning

To avoid this in certain debug build cases:
```
./lib/easy_lock.h:72:20: error: inlining failed in call to 'curl_simple_lock_lock': function not considered for inlining [-Werror=inline]
```

Ref: #13596
Reported-by: Rudi Heitbaum
Fixes #15815
Closes #15819

7 months agosrc: add `CURL_STRICMP()` macro, use `_stricmp()` on Windows
Viktor Szakats [Wed, 27 Nov 2024 11:34:38 +0000 (12:34 +0100)] 
src: add `CURL_STRICMP()` macro, use `_stricmp()` on Windows

Add `CURL_STRICMP()` macro that works on all platforms depending on
which lib C function is available.

Make sure to always use `_stricmp()` on Windows, which is the
non-deprecated, official API for this on this platform. Before this
patch it used a MinGW-specific call, or a deprecated compatibility
wrapper with MSVC.

Drop `stricmp` variant detections on Windows with autotools.

https://learn.microsoft.com/cpp/c-runtime-library/reference/stricmp-wcsicmp-mbsicmp-stricmp-l-wcsicmp-l-mbsicmp-l

Ref: #15652
Closes #15788

7 months agoQUIC: 0RTT for gnutls via CURLSSLOPT_EARLYDATA
Stefan Eissing [Mon, 2 Dec 2024 11:50:15 +0000 (12:50 +0100)] 
QUIC: 0RTT for gnutls via CURLSSLOPT_EARLYDATA

When a QUIC TLS session announced early data support and
'CURLSSLOPT_EARLYDATA' is set for the transfer, send initial request and
body (up to the 128k we buffer) as 0RTT when curl is built with
ngtcp2+gnutls.

QUIC 0RTT needs not only the TLS session but the QUIC transport
paramters as well. Store those and the earlydata max value together with
the session in the cache.

Add test case for h3 use of this. Enable quic early data in nghttpx for
testing.

Closes #15667

7 months agongtcp2: fix two cases of value stored never read
Daniel Stenberg [Mon, 23 Dec 2024 07:46:45 +0000 (08:46 +0100)] 
ngtcp2: fix two cases of value stored never read

Detected by clang-tidy

Closes #15812

7 months agoCURLOPT_PROXY.md: clarify the crendential support in proxy URLs
Daniel Stenberg [Sun, 22 Dec 2024 21:56:52 +0000 (22:56 +0100)] 
CURLOPT_PROXY.md: clarify the crendential support in proxy URLs

Ref: #15802
Closes #15805

7 months agoopenssl: fix ECH logic
Daniel Stenberg [Mon, 23 Dec 2024 08:59:33 +0000 (09:59 +0100)] 
openssl: fix ECH logic

- on error, bail out proper
- remove unused #define

Closes #15814

7 months agoGHA: drop codeql
Daniel Stenberg [Sat, 21 Dec 2024 13:58:24 +0000 (14:58 +0100)] 
GHA: drop codeql

We started using codeql for static code analysis in 7183f5acc3d7ca39,
June 2020.

Since then, not a single commit has been merged into the source code
repository citing codeql as source or reason. Yet, it keeps getting
updated and we get constant reminders to upgrade the pinning it to the
latest hash.

During 4.5 years with intense development and significant code churn.
While Coverity, scan-build and CodeSonar have belped us point out many
mistakes, codeql has remained silent (or had false positives).

For this little gain, I think we spend a disproportionate amount of work
on codeql maintanance.

We can try again in a future if we think it improves.

Assisted-by: Viktor Szakats
Closes #15798

7 months agovquic: make vquic_send_packets not return without setting psent
Daniel Stenberg [Sun, 22 Dec 2024 23:01:12 +0000 (00:01 +0100)] 
vquic: make vquic_send_packets not return without setting psent

This is debug code, but since the caller might use the value even when
this function returns error, it needs to be cleared properly here.

Spotted by Clang-tidy

Closes #15807

7 months agovquic: fix 4th function call argument is an uninitialized value
Daniel Stenberg [Sun, 22 Dec 2024 23:11:31 +0000 (00:11 +0100)] 
vquic: fix 4th function call argument is an uninitialized value

As recvmmsg_packets() could fail early and goto out before 'pkts' were
assigned.

Caught by clang-tidy

Closes #15808

7 months agohttp2: fix value stored to 'result' is never read
Daniel Stenberg [Sun, 22 Dec 2024 22:55:22 +0000 (23:55 +0100)] 
http2: fix value stored to 'result' is never read

Detected by clang-tidy

Closes #15806

7 months agocmake/FindLibssh: sync header comment with other modules
Viktor Szakats [Sun, 22 Dec 2024 10:16:24 +0000 (11:16 +0100)] 
cmake/FindLibssh: sync header comment with other modules

Follow-up to f66af623cfbf469ddef493dacca5bc760417021a #15388

7 months agocmake: delete accidental debug message [ci skip]
Viktor Szakats [Sun, 22 Dec 2024 10:45:45 +0000 (11:45 +0100)] 
cmake: delete accidental debug message [ci skip]

Follow-up to 39c741b7b008b5959980b29ac721357ff75de3f5 #15408

7 months agocf-socket: error if address can't be copied
Jay Satiro [Thu, 19 Dec 2024 22:12:02 +0000 (17:12 -0500)] 
cf-socket: error if address can't be copied

- When converting Curl_addrinfo to Curl_sockaddr_ex, if the address
  length is too large then return error CURLE_TOO_LARGE.

Prior to this change the address structure was truncated on copy, and
the length shortened which I think is incorrect.

AFAICS the only time it could conceivably happen is when a UNIX socket
path is too long, and even then curl should've accounted for that by
having a structure that is large enough to store it. This is why I added
a DEBUGASSERT for debug builds, because I don't think it should ever
happen.

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

7 months agogitignore: ignore output files created by mk-ca-bundle.pl
Jay Satiro [Thu, 19 Dec 2024 22:52:11 +0000 (17:52 -0500)] 
gitignore: ignore output files created by mk-ca-bundle.pl

- Ignore mk-ca-bundle.pl's default output files
  ca-bundle.crt and certdata.txt.

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

7 months agoexamples/block-ip: show how to block IP addresses
Jay Satiro [Sun, 15 Dec 2024 08:43:08 +0000 (03:43 -0500)] 
examples/block-ip: show how to block IP addresses

- Show how CURLOPT_OPENSOCKETFUNCTION can be used to block IP addresses.

This is a new example that demonstrates IP blocking.

Ref: https://github.com/curl/curl/discussions/15710#discussioncomment-11534877

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

7 months agoprojects/Windows: remove wolfSSL from legacy projects
Jay Satiro [Fri, 1 Nov 2024 08:24:26 +0000 (04:24 -0400)] 
projects/Windows: remove wolfSSL from legacy projects

- Remove wolfSSL from the legacy projects for Visual Studio 2010 - 2013.

It's no longer possible to maintain the custom build configuration of
wolfSSL for these old versions of Visual Studio.

Note support for wolfSSL was recently added to the winbuild build system
in 4de627ab and the user could possibly make their own wolfSSL build and
attempt to link it using an old version of Visual Studio that way.

Ref: https://gist.github.com/jay/5f6d8d5ba15c12c7457e3216a94da72d

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

7 months agocurl_multibyte: support Windows paths longer than MAX_PATH 13522/head
Jay Satiro [Fri, 3 May 2024 07:40:50 +0000 (03:40 -0400)] 
curl_multibyte: support Windows paths longer than MAX_PATH

- Add a helper function for the Windows file wrapper functions that will
  normalize a long path (or a filename in a long path) and add the
  prefix `\\?\` so that Windows will access the file.

Prior to this change if a filename (when normalized internally by
Windows to its full path) or a path was longer than MAX_PATH (260) then
Windows would not open the path, unless it was already normalized by the
user and had the `\\?\` prefix prepended.

The `\\?\` prefix could not be passed to file:// so for example
something like file://c:/foo/bar/filename255chars could not be opened
prior to this change.

There's some code in tool_doswin that will need to be modified as well
to further remove MAX_PATH (aka PATH_MAX) limitation.

Ref: https://github.com/curl/curl/issues/8361
Ref: https://github.com/curl/curl/pull/13512
Ref: https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats
Ref: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation

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

7 months agollist: survive cleared list better
Daniel Stenberg [Sat, 21 Dec 2024 10:16:09 +0000 (11:16 +0100)] 
llist: survive cleared list better

Make Curl_node_uremove() and Curl_node_take_elem() properly survive
run-time when the ->list field has been cleared previously. Like when
Curl_node_take_elem() is called twice.

We have asserts to catch those situations to make sure we avoid them if
we can, but if they still happen in a non-debug build we should make
sure the functions survive proper.

Pointed out by CodeSonar.

Closes #15791