]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
12 days agobuild: bump minimum required mingw-w64 to v3.0 (from v1.0)
Viktor Szakats [Thu, 24 Jul 2025 00:57:49 +0000 (02:57 +0200)] 
build: bump minimum required mingw-w64 to v3.0 (from v1.0)

mingw-w64 3.0 was released on 2013-09-20. Offered by Debian jessie.

1.0 and 2.0 were released in 2011. It seems unlikely that many people
use them. The oldest downloadable toolchain (that I know of) comes with
3.0. Due to this, older versions weren't CI tested, and probably seldom
tested elsewhere. The last bugfix update for both 1.0 and 2.0 was
released in 2015.

curl can now assume availability of these 3.0 features/fixes:
- 64-bit file offsets.
- `ADDRESS_FAMILY` type.
- `__MINGW_PRINTF_FORMAT` macro. (in public curl headers)

Public curl headers keep supporting older mingw-w64 versions.

Fixes #17984
Closes #18010

12 days agobuild: tidy up compiler definition for tests
Viktor Szakats [Fri, 27 Jun 2025 22:01:49 +0000 (00:01 +0200)] 
build: tidy up compiler definition for tests

- tests: merge cmake commands.
- tests: use `target_compile_definitions()`.
- tests/server: use generator expression for platform-specific macro.
- tests/unit: sync `Makefile.am` comment with cmake.
- tests/unit: merge two `AM_CPPFLAGS` lines to keep synced with cmake.
- tests: move macro definitions to `first.h` headers from build level.
  `CURL_NO_OLDIES`, `CURL_DISABLE_DEPRECATION`, `WITHOUT_LIBCURL`,
  `CURL_STATICLIB` (for servers).
  To share more logic.
  Pass `CURL_STATICLIB` in server on all platforms for simplicity.
  (On non-Windows, it's a no-op. It's already done like this with curlu
  and libcurltool.)

Also for lib:
- lib: merge commands.
- lib: sync macro order with tests (also in `Makefile.am`).

Closes #17768

12 days agocmake: omit linking duplicate/unnecessary libs to tests & examples
Viktor Szakats [Sat, 21 Jun 2025 18:05:39 +0000 (20:05 +0200)] 
cmake: omit linking duplicate/unnecessary libs to tests & examples

Before this patch we explicitly linked the full list of libcurl
dependency libs to tests and examples via `CURL_LIBS`. This was
redundant, because test and example code do not directly use these
dependency libs and for indirect use they are implicitly passed
via libcurl as needed. After this patch, tests and examples only link
explicitly to system libs (e.g. socket).

Also bringing it closer to how `./configure` does this.

Borrow the variable name `CURL_NETWORK_AND_TIME_LIBS` from
`./configure`. However, its content is not exactly the same. With cmake
it also holds `pthread`, but doesn't hold AmiSSL.

Closes #17696

12 days agobuild: fix disable-verbose
Stefan Eissing [Mon, 28 Jul 2025 08:45:18 +0000 (10:45 +0200)] 
build: fix disable-verbose

Fix compile error when building with `--disable-verbose`.

Adjust pytest to skip when curl is not a debug build but needs
traces.

Follow-up to b453a447ce4e6aa2a352b196

Closes #18053

12 days agomulti: fix assert in multi_getsock()
Stefan Eissing [Mon, 28 Jul 2025 08:10:39 +0000 (10:10 +0200)] 
multi: fix assert in multi_getsock()

Now that multi keeps the "dirty" bitset, the detection of possibly
stalling transfers needs to adapt. Before dirty, transfers needed
to expose a socket to poll or a timer to wait for.

Dirty transfer might no longer have a timer, but will run, so do
not need to report a socket. Adjust the assert condition.

Fixes #18046
Reported-by: Viktor Szakats
Closes #18051

12 days agoCURLOPT: bump `CURLFTP*` enums to `long`, drop casts
Viktor Szakats [Tue, 1 Jul 2025 15:15:45 +0000 (17:15 +0200)] 
CURLOPT: bump `CURLFTP*` enums to `long`, drop casts

This patch bumps the size of these constants from `int` to `long`, while
keeping their actual values the same. It may cause incompatibilities in
user code, requiring the bump of holder variables and/or adding casts:

- CURLFTP_CREATE_DIR
- CURLFTP_CREATE_DIR_NONE
- CURLFTP_CREATE_DIR_RETRY
- CURLFTPAUTH_DEFAULT
- CURLFTPAUTH_SSL
- CURLFTPAUTH_TLS
- CURLFTPMETHOD_DEFAULT
- CURLFTPMETHOD_MULTICWD
- CURLFTPMETHOD_NOCWD
- CURLFTPMETHOD_SINGLECWD
- CURLFTPSSL_CCC_ACTIVE
- CURLFTPSSL_CCC_NONE
- CURLFTPSSL_CCC_PASSIVE

Also:
- keep existing casts within the documentation to make sure it applies
  to older curl versions as well.

Closes #17797

12 days agoCURLOPT: drop redundant `long` casts
Viktor Szakats [Tue, 1 Jul 2025 09:31:01 +0000 (11:31 +0200)] 
CURLOPT: drop redundant `long` casts

Also:
- CURLOPT_HSTS_CTRL.md: sync macro definitions with `curl/curl.h`.
  Perhaps it'd be better to delete copies like this?
- keep existing casts within the documentation to make sure it applies
  to older curl versions as well.
- CURLOPT_IPRESOLVE.md: re-add a long cast to man page, for consistency
  with the above.

Closes #17791

12 days agomemanalyze.pl: remove strict+warnings
Daniel Stenberg [Mon, 28 Jul 2025 06:59:26 +0000 (08:59 +0200)] 
memanalyze.pl: remove strict+warnings

These introduced *hundreds* of lines of output in a single test run.

I think this also shows strict+warnigns in perl in their most annoying
way.

Follow-up to 2ec54556d4

Closes #18048

12 days agoDEPRECATE.md: remove leftover "nothing"
Daniel Stenberg [Sun, 27 Jul 2025 22:11:51 +0000 (00:11 +0200)] 
DEPRECATE.md: remove leftover "nothing"

It was just wrong and confusing

Closes #18044

13 days agoconfig-win32.h: do not use winsock2 `inet_ntop()`/`inet_pton()`
Viktor Szakats [Sun, 27 Jul 2025 22:22:36 +0000 (00:22 +0200)] 
config-win32.h: do not use winsock2 `inet_ntop()`/`inet_pton()`

Syncing winbuild and VS Project File builds with the same fix applied
to cmake and autotools builds earlier.

Also fixes these warnings seen in the VisualStudioSolution (VS2013) job
on AppVeyor CI:
```
lib\hostip.c(148): warning C4090: 'function' : different 'const' qualifiers
lib\hostip.c(155): warning C4090: 'function' : different 'const' qualifiers
```
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/52470650/job/gslnjrdxnd8b9mtv#L180

Went unnoticed because warnings are not promoted to error in these builds.
winbuild CI jobs did not hit this warning for some reason.

Follow-up to 8537a5b0bcf4565551774c2b2375c49767e405a7 #16577
Closes #18045

13 days agoinet_pton, inet_ntop: drop declarations when unused
Viktor Szakats [Sun, 27 Jul 2025 22:03:03 +0000 (00:03 +0200)] 
inet_pton, inet_ntop: drop declarations when unused

Do not declare local inet_pton/inet_ntop implementations when they are
not used. In this case the same symbol is defined as a macro and mapped
to the system implementation.

Syncing this with their definitions.

Closes #18043

13 days agoscripts: fix two Perl uninitialized value warnings
Viktor Szakats [Sun, 27 Jul 2025 21:36:33 +0000 (23:36 +0200)] 
scripts: fix two Perl uninitialized value warnings

```
Use of uninitialized value $errors in exit at .github/scripts/badwords.pl line 87.
Use of uninitialized value $o in concatenation (.) or string at ../.github/scripts/randcurl.pl line 99.
```

Follow-up to 2ec54556d4e3f3ab551b5298adab0c703d85a463 #17877
Cherry-picked from #18042
Closes #18047

13 days agobuild: extend GNU C guards to clang where applicable, fix fallouts
Viktor Szakats [Thu, 17 Jul 2025 17:01:42 +0000 (19:01 +0200)] 
build: extend GNU C guards to clang where applicable, fix fallouts

Some GNU C version guards implicitly include the clang compiler, because
clang reports itself as GCC 4.2.1.

This implicit inclusion doesn't happen if the guard requires a GCC
version above 4.2.1.

Fix two such guards to explicitly include clang where it does support
the guarded feature:

- curl/curl.h: use `typecheck-gcc.h` with clang.
  llvm clang v14+ supports this. The corresponding Apple clang version
  is also v14.
  Ref: https://en.wikipedia.org/wiki/Xcode#Toolchain_versions
  Apple clang v14 tested OK in CI:
  https://github.com/curl/curl/actions/runs/16353901480/job/46207437204

- tool_urlglib: use `__builtin_mul_overflow()` with clang v8+.
  llvm clang v3.8+ supports this, but to accommodate for Apple clang,
  start with v8, the Apple version having the mainline v3.8 feature set.

Also fix compile warnings triggered by the above:
- lib1912: fix duplicate `;`:
  ```
  tests/libtest/lib1912.c:44:57: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
   44 |       print_err(o->name, "CURLOT_LONG or CURLOT_VALUES");
      |                                                         ^
  [...]
  ```
  Ref: https://github.com/curl/curl/actions/runs/16351302841/job/46198524880?pr=17955#step:12:61

- lib2032: silence typcheck warning with a cast:
  ```
  tests/libtest/lib2032.c:145:29: error: sizeof on pointer operation will return size of 'CURL **' (aka 'void **') instead of 'CURL *[3]' (aka 'void *[3]') [-Werror,-Wsizeof-array-decay]
    145 |                   ntlm_easy + num_handles);
        |                   ~~~~~~~~~ ^
  ```
  Ref: https://github.com/curl/curl/actions/runs/16351302841/job/46198524880?pr=17955#step:12:86

Closes #17955

13 days agoconnection: terminate after goaway
Stefan Eissing [Thu, 10 Jul 2025 10:16:40 +0000 (12:16 +0200)] 
connection: terminate after goaway

When a multiplex connection (h2/h3) is shutdown by the server, the
reported number of parallel transfers allowed drops to 0.

Determine that when the last transfer is done and terminate the
connection instead of keeping it in the cache.

We detect the drop to 0 also when we try to reuse such a connection, but
if we know this at the time the last transfer is done, we better
terminate it right away.

Have a consistent trace logging to this with the connections current
hostname and port. Adjust test expectations to carry port numbers.

Closes #17884

13 days agoscripts: enable strict warnings in Perl where missing, fix fallouts
Viktor Szakats [Wed, 9 Jul 2025 19:18:29 +0000 (21:18 +0200)] 
scripts: enable strict warnings in Perl where missing, fix fallouts

- add 'use warnings' and 'use strict' where missing from Perl scripts.
- fix 'Use of uninitialized value'.
- fix missing declarations.
- test1140.pl: fix 'Possible precedence issue with control flow operator'.
- fix other misc issues.

Most actual errors found during this PR were fixed and merged via
separate PRs.

Likely there are remaining warnings not found and fixed in this PR.

Closes #17877

13 days agotidy-up: prefer `ifdef`/`ifndef` for single checks
Viktor Szakats [Fri, 25 Jul 2025 12:31:16 +0000 (14:31 +0200)] 
tidy-up: prefer `ifdef`/`ifndef` for single checks

Closes #18018

13 days agotidy-up: move literal to the right side of comparisons
Viktor Szakats [Tue, 8 Jul 2025 12:10:35 +0000 (14:10 +0200)] 
tidy-up: move literal to the right side of comparisons

Closes #17876

13 days agodoh: rename symbols to avoid collision with mingw-w64 headers
Viktor Szakats [Sun, 27 Jul 2025 13:09:08 +0000 (15:09 +0200)] 
doh: rename symbols to avoid collision with mingw-w64 headers

Collision happens when building with mingw-w64 v3 or v2 while targeting
Vista or newer. `iphlpapi.h` includes `windns.h` in this case, which
defines macros named `DNS_TYPE_*`, colliding with curl doh enums.

The issue was fixed in mingw-w64 v4:
https://github.com/mirror/mingw-w64/commit/ea95d55e3387353e453d6ae8fc5cb8f7503947c2

Fixes:
```
lib/doh.h:54:3: error: expected identifier before numeric constant
   DNS_TYPE_A = 1,
   ^
```
Ref: https://github.com/curl/curl/actions/runs/16551209676/job/46806303365?pr=18009#step:10:17

This workaround seems harmless and generally good practice, but
another option is to require mingw-w64 v4.

Ref: #18009
Closes #18041

13 days agomulti: replace remaining EXPIRE_RUN_NOW
Stefan Eissing [Thu, 10 Jul 2025 08:55:43 +0000 (10:55 +0200)] 
multi: replace remaining EXPIRE_RUN_NOW

Remove EXPIRE_RUN_NOW completely. Replace the remaining use of
EXPIRE_RUN_NOW with marking transfers as dirty.

Closes #17883

13 days agomulti: don't insert a node into the splay tree twice
David Zhuang [Wed, 23 Jul 2025 10:18:37 +0000 (03:18 -0700)] 
multi: don't insert a node into the splay tree twice

Closes #18005

13 days agotool_getparam: add support for `--longopt=value`
Daniel Stenberg [Mon, 30 Jun 2025 21:53:29 +0000 (23:53 +0200)] 
tool_getparam: add support for `--longopt=value`

If the long option name ends with an equals sign (`=`), the argument is
the text following on its right side.

This makes the command line parser accept this common style in addition
to the existing way to accept option arguments more similar to how other
command line tools do.

Example: `curl --user-agent=curl-2000 https://example.com/`

Change a few existing tests to use this syntax: 206, 1333, 1335, 1442

Closes #17789

13 days agonetrc: use the NETRC environment variable (first) if set
Daniel Stenberg [Sun, 22 Jun 2025 22:09:18 +0000 (00:09 +0200)] 
netrc: use the NETRC environment variable (first) if set

Add test 755 to verify.

Proposed-by: Berthin Torres CallaƱaupa
URL: https://curl.se/mail/lib-2025-06/0015.html

Closes #17712

13 days agotls: make default TLS version be minimum 1.2
Daniel Stenberg [Fri, 11 Jul 2025 06:14:42 +0000 (08:14 +0200)] 
tls: make default TLS version be minimum 1.2

This still allows users to explictily ask for 1.0 or 1.1 as the minimum
version. If the TLS library allows it.

Starting with this change, the CURL_SSLVERSION_DEFAULT value is no
longer used as minimum version when the TLS backend are called.

This also makes curl set the minimum version to 1.2 independently of
libcurl for the rare case where a newer curl tool would use an older
libcurl.

URL: https://curl.se/mail/lib-2025-07/0007.html
Assisted-by: Stefan Eissing
Closes #17894

13 days agoRELEASE-NOTES: synced
Daniel Stenberg [Sun, 27 Jul 2025 16:03:13 +0000 (18:03 +0200)] 
RELEASE-NOTES: synced

Working towards 8.16.0 now

13 days agovquic: drop msh3
Daniel Stenberg [Tue, 24 Jun 2025 06:34:58 +0000 (08:34 +0200)] 
vquic: drop msh3

It has never been properly functional in curl while there are several
alternatives that are.

Closes #17729

13 days agocurl_addrinfo: drop workaround for old-mingw
Viktor Szakats [Sun, 27 Jul 2025 08:57:07 +0000 (10:57 +0200)] 
curl_addrinfo: drop workaround for old-mingw

Follow-up to a3585c9576abccddbd27200058912cef900c3c0f #15543

Closes #18038

13 days agocf-https-connect: delete unused declaration
Viktor Szakats [Sun, 27 Jul 2025 08:43:40 +0000 (10:43 +0200)] 
cf-https-connect: delete unused declaration

Closes #18036

13 days agoGHA/windows: add minimal mingw-w64 v3 job
Viktor Szakats [Sat, 26 Jul 2025 18:00:28 +0000 (20:00 +0200)] 
GHA/windows: add minimal mingw-w64 v3 job

Also document mingw-w64 versions for dl-mingw jobs.

Cherry-picked from #18010
Closes #18037

13 days agoGHA: skip building certs, build more tests, one minor fix
Viktor Szakats [Sat, 26 Jul 2025 20:27:56 +0000 (22:27 +0200)] 
GHA: skip building certs, build more tests, one minor fix

- GHA/windows: disable building certs in the MSVC job that's not running
  tests. Saves 4-5 seconds for MSVC, makes logs shorter for the rests.

- GHA/linux: build tests in two more jobs (LTO, CM Rustls), 5s each.

- GHA/linux: skip 'install test prereqs' for `skiprun` jobs.
  (there were no such jobs before this patch.)

Closes #18034

2 weeks agoDEPRECATE.md: drop support for Windows XP/2003
Viktor Szakats [Fri, 25 Jul 2025 01:33:17 +0000 (03:33 +0200)] 
DEPRECATE.md: drop support for Windows XP/2003

Dropped from curl-for-win on August 28, 2022:
https://github.com/curl/curl-for-win/commit/6976612160075c1e9ee967964d5dec1a25c5ac6c

https://en.wikipedia.org/wiki/Windows_XP
https://en.wikipedia.org/wiki/Windows_Server_2003

Ref: #17985
Closes #18016

2 weeks agoGHA: Update dependency awslabs/aws-lc to v1.56.0
renovate[bot] [Wed, 23 Jul 2025 14:23:54 +0000 (14:23 +0000)] 
GHA: Update dependency awslabs/aws-lc to v1.56.0

Closes #18006

2 weeks agoGHA: update dependency ngtcp2/nghttp3 to v1.11.0
renovate[bot] [Fri, 25 Jul 2025 18:17:03 +0000 (18:17 +0000)] 
GHA: update dependency ngtcp2/nghttp3 to v1.11.0

Closes #18021

2 weeks agohttp: silence `-Warray-bounds` with gcc 13+
Viktor Szakats [Fri, 25 Jul 2025 17:54:39 +0000 (19:54 +0200)] 
http: silence `-Warray-bounds` with gcc 13+

This became an issue after promoting curl compiler warnings to errors in
curl-for-win. The code is correct. It over-allocates a struct to store
variable sized data past its length. Similar code is present in
`lib/smb.c`, silenced earlier.

Seen in linux-musl-debian-testing-gcc curl-for-win builds, gcc 14.2.0,
RISC-V (but not amd64/aarch64), unity, debian:testing (trixie):

musl:
```
In file included from /curl/_r64-linux-musl-bld/lib/CMakeFiles/libcurl_object.dir/Unity/unity_0_c.c:184:
In function 'Curl_http_req_make',
    inlined from 'Curl_http_proxy_create_CONNECT' at /curl/lib/http_proxy.c:252:12:
/curl/lib/http.c:4373:3: error: 'memcpy' offset [137, 142] from the object at 'req' is out of the bounds of
referenced subobject 'method' with type 'char[1]' at offset 136 [-Werror=array-bounds=]
 4373 |   memcpy(req->method, method, m_len);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /curl/lib/urldata.h:182,
                 from /curl/lib/altsvc.c:32,
                 from /curl/_r64-linux-musl-bld/lib/CMakeFiles/libcurl_object.dir/Unity/unity_0_c.c:4:
/curl/lib/http.h: In function 'Curl_http_proxy_create_CONNECT':
/curl/lib/http.h:230:8: note: subobject 'method' declared here
  230 |   char method[1];
      |        ^~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/16527769182/job/46745369844?pr=18025#step:3:5798
Ref: https://github.com/curl/curl-for-win/actions/runs/16525969694/job/46739239206#step:3:5958

glibc (with unity batch):
```
In file included from /usr/riscv64-linux-gnu/include/string.h:548,
                 from /curl/lib/curl_setup_once.h:33,
                 from /curl/lib/curl_setup.h:823,
                 from /curl/lib/http.c:25,
                 from /curl/_r64-linux-gnu-bld/lib/CMakeFiles/libcurl_object.dir/Unity/unity_2_c.c:4:
In function 'memcpy',
    inlined from 'Curl_http_req_make' at /curl/lib/http.c:4373:3,
    inlined from 'Curl_http_proxy_create_CONNECT' at /curl/lib/http_proxy.c:252:12:
/usr/riscv64-linux-gnu/include/bits/string_fortified.h:29:10: error: '__builtin_memcpy' offset [137, 142]
from the object at 'req' is out of the bounds of
referenced subobject 'method' with type 'char[1]' at offset 136 [-Werror=array-bounds=]
   29 |   return __builtin___memcpy_chk (__dest, __src, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   30 |                                  __glibc_objsize0 (__dest));
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /curl/lib/urldata.h:182,
                 from /curl/lib/http.c:50:
/curl/lib/http.h: In function 'Curl_http_proxy_create_CONNECT':
/curl/lib/http.h:230:8: note: subobject 'method' declared here
  230 |   char method[1];
      |        ^~~~~~
```
Ref: https://github.com/curl/curl-for-win/actions/runs/16538174468/job/46775731055#step:3:5936

Ref: https://github.com/curl/curl-for-win/commit/f45df099f38f83f2def8344e335f73cc33eea51b
Follow-up to 14f26f5ee78204c15bf906f3cf7480308e2feb28 #16187
Cherry-picked from #18025
Closes #18030

2 weeks agoGHA/http3-linux: bump to ngtcp2 1.14.0, fix local build
Viktor Szakats [Fri, 25 Jul 2025 19:35:57 +0000 (21:35 +0200)] 
GHA/http3-linux: bump to ngtcp2 1.14.0, fix local build

ngtcp2 1.14.0 added crypto dependencies to the ngtcp2 crypto `.pc`
files. It broke GHA builds, because how curl's `configure` is setting up
the per-dependency custom prefixes for pkg-config.

`configure` uses `PKG_CONFIG_LIBDIR` to set per-dependency custom
prefixes, as specified via `--with-ngtcp2=<custom-dir>`. In classic
`pkg-config` this overrides any previously configured `PKG_CONFIG_DIR`.
This in turn break detecting transitive pkg-config modules unless they
are found at locations `pkg-config` is searching by default. This
doesn't affect `pkgconf` because it appends `PKG_CONFIG_LIBDIR` to
the custom `PKG_CONFIG_DIR`, according to its man page.

It may make sense to fix this in`acinclude.m4`, to make sure to honor
global custom pkg-config paths while detecting components at custom
locations, regardless of pkg-config implementation. But this PR doesn't
do this.

Instead it drops the ngtcp2 custom path and lets detection rely on
`PKG_CONFIG_DIR` that's already set up for all custom-built dependencies
anyway.

Also:
- fix `openssl-quic` job to use the custom-built nghttp2 (like other
  jobs do) instead of the system default.
- configure nghttp3 via `PKG_CONFIG_DIR` in the `openssl-quic` job,
  to sync with other jobs. And drop `--with-nghttp3` option.

https://github.com/curl/curl/blob/cb9b1a4c4e875ac4eac2209d8686acef3114abdf/acinclude.m4#L1376-L1381
https://manpages.debian.org/unstable/pkg-config/pkg-config.1.en.html
https://man.archlinux.org/man/pkgconf.1.en

Ref: https://github.com/ngtcp2/ngtcp2/pull/1689#issuecomment-3121576712
Closes #18022
Closes #18028

2 weeks agocurl_ossl: extend callback table for nghttp3 1.11.0
Viktor Szakats [Fri, 25 Jul 2025 17:22:01 +0000 (19:22 +0200)] 
curl_ossl: extend callback table for nghttp3 1.11.0

```
../../lib/vquic/curl_osslq.c:1091:1: error: missing initializer for field 'recv_origin' of 'nghttp3_callbacks' [-Werror=missing-field-initializers]
 1091 | };
      | ^
In file included from ../../lib/vquic/curl_osslq.c:33:
/home/runner/nghttp3/build/include/nghttp3/nghttp3.h:2082:23: note: 'recv_origin' declared here
 2082 |   nghttp3_recv_origin recv_origin;
      |                       ^~~~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/16527325587/job/46743893924?pr=18021#step:18:35

Follow-up to 1055144063ca5f8c67ae6b7d727f76c9bdad88ba #18019

Closes #18026

2 weeks agocurl_ngtcp2: extend callback tables for nghttp3 1.11.0 and ngtcp2 1.14.0
Viktor Szakats [Fri, 25 Jul 2025 14:40:26 +0000 (16:40 +0200)] 
curl_ngtcp2: extend callback tables for nghttp3 1.11.0 and ngtcp2 1.14.0

An emergency update to initialize callbacks to NULL.

May need further updates, e.g. to provide the recommended random
generator callback for nghttp3.

Fixing potential crashes at runtime in curl-for-win 8.15.0_3, and these
build warnings:
```
/home/appveyor/projects/curl-for-win/curl/lib/vquic/curl_ngtcp2.c:836:1:
warning: missing field 'begin_path_validation' initializer [-Wmissing-field-initializers]
  836 | };
      | ^
/home/appveyor/projects/curl-for-win/curl/lib/vquic/curl_ngtcp2.c:1186:1:
warning: missing field 'recv_origin' initializer [-Wmissing-field-initializers]
 1186 | };
      | ^
2 warnings generated.
```
Ref: https://ci.appveyor.com/project/curlorg/curl-for-win/builds/52462852#L14821

Also causing all `GHA/curl-for-win` jobs to fail:
https://github.com/curl/curl/actions/runs/16523625082?pr=18010

Ref: https://github.com/ngtcp2/nghttp3/releases/tag/v1.11.0
Ref: https://github.com/ngtcp2/ngtcp2/releases/tag/v1.14.0
Ref: https://github.com/curl/curl-for-win/commit/ff788c81e44f998d0d41f362d442a7e97cc0fd46

Closes #18019

2 weeks agotidy-up: more whitespace/indent, comments
Viktor Szakats [Mon, 14 Jul 2025 15:08:05 +0000 (17:08 +0200)] 
tidy-up: more whitespace/indent, comments

Also a couple of minor formatting updates in the root `CMakeLists.txt`.
One swap to `#ifdef`.

Closes #17929

2 weeks agoCODE_STYLE: sync with recent `checksrc.pl` updates
Viktor Szakats [Fri, 25 Jul 2025 00:41:21 +0000 (02:41 +0200)] 
CODE_STYLE: sync with recent `checksrc.pl` updates

Follow-up to ef2ccf862f8fbfe5cb86cb716aead57694a95ef5 #17840
Follow-up to f9656445ba275efca02994808f1a89cf055e5e44 #17764

Closes #18015

2 weeks agowindows: include `wincrypt.h` before `iphlpapi.h` for mingw-w64 <6
Viktor Szakats [Thu, 24 Jul 2025 12:44:03 +0000 (14:44 +0200)] 
windows: include `wincrypt.h` before `iphlpapi.h` for mingw-w64 <6

Required for mingw-w64 5.x (and older) builds targeting a Windows 7+.

mingw-w64 6+ fixed `mprapi.h` (included indirectly via `iphlpapi.h`)
to include `wincrypt.h` for the missing types.

MSVC is not affected because SDK 7.1a (the oldest MS SDK curl supports),
`mprapi.h` does include `wincrypt.h`.

Make sure to include `wincrypt.h` before including `iphlpapi.h` as
a workaround. `wincrypt.h` is used unconditionally even though it's
not available in UWP. This is safe in this context, because we use
`iphlpapi.h` for `if_nametoindex`, which is not supported and used
in UWP builds.

This fixes auto-detection that missed detecting `if_nametoindex` in
the affected combination, and this build error in non-unity builds:
```
In file included from D:/my-cache/mingw32/i686-w64-mingw32/include/iprtrmib.h:9:0,
                 from D:/my-cache/mingw32/i686-w64-mingw32/include/iphlpapi.h:17,
                 from D:/a/curl/curl/lib/url.c:63:
D:/my-cache/mingw32/i686-w64-mingw32/include/mprapi.h:865:3: error: unknown type name 'CERT_NAME_BLOB'
   CERT_NAME_BLOB *certificateNames;
   ^~~~~~~~~~~~~~
D:/my-cache/mingw32/i686-w64-mingw32/include/mprapi.h:887:3: error: unknown type name 'CRYPT_HASH_BLOB'
   CRYPT_HASH_BLOB certBlob;
   ^~~~~~~~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/16497057672/job/46645264552?pr=18012#step:10:140

This combination is not normally tested in CI. It was caught in
the `dl-mingw, CM 6.4.0-i686 schannel !unity Win7` job while working
on another PR.

Follow-up to 0d71b18153c8edb996738f8a362373fc72d0013b #17413
Ref: #18009
Closes #18012

2 weeks agocurl_setup.h: move UWP detection after `config-win32.h` (revert)
Viktor Szakats [Thu, 24 Jul 2025 19:05:26 +0000 (21:05 +0200)] 
curl_setup.h: move UWP detection after `config-win32.h` (revert)

This change wasn't good because `config-win32.h` does rely on the UWP
detection result to set `USE_WIN32_CRYPTO` and LDAP macros. While it
fixed one issue, it created another.

It seems better to revert, and focus on reducing and/or eventually
dropping the logic within `config-win32.h` that alters `_WIN32_WINNT`.
It may not be necessary anymore with a minimum of VS2008 (soon VS2010).
The logic is also absent from cmake builds, without causing issues.

Could affect UWP winbuild/project-file builds. These are theoretical
builds because neither build method is prepared to target UWP.

Reverts 792a61e2047782b85da0332cf298a747ce11e8e6 #17980
Ref: https://github.com/curl/curl/pull/17980#issuecomment-3114462492

Closes #18014

2 weeks agowindows: drop unused `curlx/version_win32.h` includes
Viktor Szakats [Thu, 24 Jul 2025 09:06:32 +0000 (11:06 +0200)] 
windows: drop unused `curlx/version_win32.h` includes

- lib/connect.c: unused since:
  71b7e0161032927cdfb4e75ea40f65b8898b3956 #10141

- lib/curl_sspi.c: unused since:
  0d71b18153c8edb996738f8a362373fc72d0013b #17413

Cherry-picked from #18009
Closes #18011

2 weeks agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 23 Jul 2025 21:14:21 +0000 (23:14 +0200)] 
RELEASE-NOTES: synced

2 weeks agohmac: return error if init fails
Daniel Stenberg [Wed, 23 Jul 2025 14:50:22 +0000 (16:50 +0200)] 
hmac: return error if init fails

They can actually happen in OOM situtations.

Reported-by: Philippe Antoine
Closes #18008

2 weeks agowindows: target version macro tidy-ups
Viktor Szakats [Sun, 20 Jul 2025 21:24:26 +0000 (23:24 +0200)] 
windows: target version macro tidy-ups

- autotools: stop checking for `WINVER` to detect thread-safety.
  To sync with implementation in `easy_lock.h` and with cmake.

- replace numeric version with `_WIN32_WINNT_VISTA`.

- `_WIN32_WINNT_VISTA` is always defined via `setup-win32.h`,
  don't check for it.

Closes #17981

2 weeks agotests: unset some envs instead of blanking them
Viktor Szakats [Tue, 22 Jul 2025 01:14:43 +0000 (03:14 +0200)] 
tests: unset some envs instead of blanking them

After 7cf8414fabc3063cc3d2121eacec4a6daa4164a8 #12862, `VAR=` no longer
removes the env variable, but sets it to an empty/blank value instead.
To remove an env, `VAR` shall be used (without the assigment operator.)

`SSL_CERT_FILE`, `CURL_HOME`, `HOME`, `XDG_CONFIG_HOME`, were added
before the change above. Make tests unset these envs again, as their
commit messages suggest, instead of blanking them. It does not change
the outcome of the tests.

Ref: 764e4f066d5719e68fa0d6b0b0d9efa0625c5c15 #8213
Ref: e992770e8d16e4be2a3da8aa2cef5cfc12e22372 #6600

Folllow-up to 7cf8414fabc3063cc3d2121eacec4a6daa4164a8 #12862
Cherry-picked from #17988
Closes #17994

2 weeks agotest428: re-enable for Windows
Viktor Szakats [Tue, 22 Jul 2025 00:54:46 +0000 (02:54 +0200)] 
test428: re-enable for Windows

The unexplained error in AppVeyor CI tests are not hit in CI after
moving those tests to GHA. Re-enable to run this test on Windows.

Revisit if the error is seen again on Windows.

Errors seen earlier in AppVeyor CI:
https://ci.appveyor.com/project/curlorg/curl/builds/49120834
https://ci.appveyor.com/project/curlorg/curl/builds/49123802 (with debug lines)

In these jobs:
CMake, VS2010, Debug, x64, no SSL, Static
CMake, mingw-w64, gcc 7, Debug, x64, Schannel, Static, Unicode
CMake, mingw-w64, gcc 9, Debug, x64, Schannel, Static, Unity
CMake, mingw-w64, gcc 6, Debug, x86, Schannel, Static

Test log from the 'gcc 9` job above (with debug lines):
```
 test 0428...[Expand environment variables within config file]

  428: protocol FAILED!
  There was no content at all in the file log/server.input.
  Server glitch? Total curl failure? Returned: 26
 == Contents of files in the log/ dir after test 428
 === Start of file cmd
  --variable %FUNVALUE
  --variable %VALUE2
  --variable %BLANK
  --variable %curl_NOT_SET=default
  --expand-data 1{{FUNVALUE}}2{{VALUE2}}3{{curl_NOT_SET}}4{{BLANK}}5\{{verbatim}}6{{not.good}}7{{}}
 === End of file cmd
 === Start of file commands.log
  ../src/curl.exe --output log/curl428.out  --include --trace-ascii log/trace428 --trace-time http://127.0.0.1:1593/428 -K log/cmd > log/stdout428 2> log/stderr428
 === End of file commands.log
 === Start of file server.cmd
  Testnum 428
 === End of file server.cmd
 === Start of file stderr428
  getenv of 'FUNVALUE' returned 0xee65d2
  getenv of 'VALUE2' returned 0xee7a42
  getenv of 'BLANK' returned (nil)
  curl: Variable 'BLANK' import fail, not set
  curl: log/cmd:3: '--variable' variable expansion failure
  curl: cannot read config from 'log/cmd'
  curl: option -K: error encountered when reading a file
  curl: try 'curl --help' for more information
 === End of file stderr428
```

Env comparison:
Fail: https://ci.appveyor.com/project/curlorg/curl/builds/49123802/job/2a4w7i21npys9pd3
```
-- curl version=[8.6.1-DEV]
-- The C compiler identification is GNU 9.1.0
-- Found Perl: C:/msys64/usr/bin/perl.exe (found version "5.30.0").
-- Found _WIN32_WINNT=0x0601
* curl 8.6.1-DEV (Windows).
* libcurl/8.6.1-DEV Schannel zlib/1.2.11
* Features: alt-svc AsynchDNS Debug HSTS HTTPS-proxy IPv6 Kerberos Largefile libz NTLM SPNEGO SSL SSPI threadsafe TrackMemory UnixSockets
* Disabled: xattr
* System: MSYS_NT-10.0-14393 APPVYR-WIN 3.0.7-338.x86_64 2019-07-11 10:58 UTC x86_64 Msys
```

OK (this PR): https://github.com/curl/curl/actions/runs/16439564668/job/46456976494
```
-- curl version=[8.15.1-DEV]
-- The C compiler identification is GNU 9.5.0
-- Found Perl: C:/msys64/usr/bin/perl.exe (found version "5.38.4")
-- Found _WIN32_WINNT=0x0601
* curl 8.15.1-DEV (Windows).
* libcurl/8.15.1-DEV Schannel libpsl/0.21.5
* Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp ws wss
* Features: alt-svc AsynchDNS Debug HSTS HTTPS-proxy IPv6 Kerberos Largefile NTLM PSL SPNEGO SSL SSPI threadsafe TrackMemory UnixSockets
* Disabled: xattr, win32-ca-search-safe, override-dns
* System: MINGW64_NT-10.0-20348 runnervm51nrn 3.6.3-ab81aae6.x86_64 2025-07-01 18:20 UTC x86_64 Msys
```

Follow-up to 7cf8414fabc3063cc3d2121eacec4a6daa4164a8
Ref: https://github.com/curl/curl/pull/12862#issuecomment-1929548070
Ref: 0f0edc283c340e8ddddc763b48d2f835b2270ab4 #12862

Closes #17991

2 weeks agotests: fix UTF-8 detection, per-test `LC_*` settings, CI coverage
Viktor Szakats [Wed, 16 Jul 2025 02:25:08 +0000 (04:25 +0200)] 
tests: fix UTF-8 detection, per-test `LC_*` settings, CI coverage

- runtests: fix `codeset-utf8` feature detection. Before this patch it
  detected if the calling environment had UTF-8 enabled. If not, UTF-8
  tests were all skipped. After this patch, it detects if UTF-8 is
  supported by the calling environment regardless of what's currently
  enabled.
  Follow-up to 0b70b23ef4d007031bc2ae4fc63d5ed9136bc2b5 #15039

- GHA/linux: sync `codeset-test` to also reset `LC_CTYPE` and
  `LC_NUMBER`. To give it more spin.
  Follow-up to c221c0ee5935497168c52686a9d8cc87b45bbca9 #17938

- GHA/macos: fix to actually enable `codeset-test`. Also set `LC_ALL`,
  which seems necessary to trigger issues.
  Follow-up to c221c0ee5935497168c52686a9d8cc87b45bbca9 #17938

- tests/data: replace `LC_CTYPE` env with `LC_ALL` in all tests
  requiring a locale. Also to avoid potential issues with a blank or
  unset `LC_ALL`, as seen earlier. And to ensure that the override works
  on all platforms (as tested in CI.)
  Slight downside is that this now resets the language/culture to `C`.
  Ref: b4c9982382469398115cc0e3e0747e79db083455 #4743
  Ref: 23208e330ac0c2164d59971baf79e87c45da1840 #4738

- replace `en_US.UTF-8` with `C.UTF-8` to be language/culture-agnostic.

- TEST-SUITE.md: drop `UTF-8` as a requirement for tests.
  Tests shall work (or least be skipped) without UTF-8 support.

Tests requiring UTF-8 locale:
165, 962, 963, 964, 965, 966, 967, 1448, 1560, 2046, 2047
Tests requiring UTF-8 locale, but passing without one anyway:
955, 956, 957, 958, 959, 960, 961, 968, 1034, 1035

Spec 1997: https://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html
Spec 2008: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html

Ref: c221c0ee5935497168c52686a9d8cc87b45bbca9 #17938
Ref: 7cf8414fabc3063cc3d2121eacec4a6daa4164a8
Ref: 4c140a56283703161e5f26ae022bad694a481603
Ref: 28faaacee287b019bcf2961da3bf2f91d331bcbd #2436
Ref: ecd1d020abdae3c3ce3643ddab3106501e62e7c0

Closes #17988

2 weeks agobuild: fix build errors/warnings in rare configurations
Viktor Szakats [Fri, 18 Jul 2025 16:17:06 +0000 (18:17 +0200)] 
build: fix build errors/warnings in rare configurations

- vtls: fix unused variable and symbols.
- ftp: fix unused variable.
- http: fix unused variables.
- smtp: fix unsued variable.
- wolfssl: fix unused variable with !proxy.
- libssh: fix unused argument.
- curl_trc: sync guards between declaration and definition.
- curl_trc: add missing guard for `Curl_trc_ssls` when !verbose.
- curl_trc: fix errors with !http + http3.
- curl_trc: fix missing function with !http + nghttp2.
- cf-h2-proxy: disable when !http + nghttp2, to avoid calling undeclared
  functions.
- sha256: fix missing declaration in rare configs.
- md4: fix symbol conflict when building GnuTLS together with AWS-LC or
  wolfSSL. By prioritizing the latter two. AWS-LC has no option
  to disable the clashing symbol. wolfSSL does, but the most seamless is
  to skip including GnuTLS's standalone `md4.h` to avoid the clash.
- build: fix errors with !http + nghttp2.
- build: catch !ssl + ssls-export combination in source. Convert
  build-level errors to warnings.
- build: fix errors with !http + http3.
- build: fix building curl tool and unit1302 in rare combinations.
  By always compiling base64 curlx functions.

- cmake: add `_CURL_SKIP_BUILD_CERTS` internal option.
  To disable automatically building certs with the testdeps target.
  To improve performance when testing builds.
  (used locally to find the failing builds fixed in this PR.)

Closes #17962

2 weeks agoCI: update glibc in linux-old build 18007/head
Dan Fandrich [Wed, 23 Jul 2025 18:24:07 +0000 (11:24 -0700)] 
CI: update glibc in linux-old build

Also, change the host because Debian itself is no longer hosting Buster
packages.

Reported-by: nevakrien on Github
Ref: #17997
Closes #18007

2 weeks agocmake: fix to disable Schannel and SSPI for non-Windows targets
Viktor Szakats [Fri, 18 Jul 2025 21:43:32 +0000 (23:43 +0200)] 
cmake: fix to disable Schannel and SSPI for non-Windows targets

Fixing:
```
In file included from lib/vtls/vtls.c:50:
In file included from lib/vtls/../urldata.h:314:
lib/vtls/../curl_sspi.h:41:10: fatal error: 'security.h' file not found
   41 | #include <security.h>
      |          ^~~~~~~~~~~~
1 error generated.

lib/curl_sspi.h:41:10: fatal error: 'security.h' file not found
   41 | #include <security.h>
      |          ^~~~~~~~~~~~
1 error generated.
```

Cherry-picked from #17988

2 weeks agocmake: fix `ENABLE_UNIX_SOCKETS=OFF` with pre-fill enabled on unix
Viktor Szakats [Sat, 19 Jul 2025 22:16:09 +0000 (00:16 +0200)] 
cmake: fix `ENABLE_UNIX_SOCKETS=OFF` with pre-fill enabled on unix

Cherry-picked from #17988

2 weeks agocmake: keep websockets disabled if HTTP is disabled
Viktor Szakats [Sat, 19 Jul 2025 21:46:01 +0000 (23:46 +0200)] 
cmake: keep websockets disabled if HTTP is disabled

Syncing with autotools, and fixing the `Protocols:` verifier test.

Cherry-picked from #17988

2 weeks agocmake: capitalize 'Rustls' in the config summary
Viktor Szakats [Sun, 20 Jul 2025 00:38:02 +0000 (02:38 +0200)] 
cmake: capitalize 'Rustls' in the config summary

Cherry-picked from #17988

2 weeks agopytest: add SOCKS tests and scoring
Stefan Eissing [Mon, 21 Jul 2025 10:23:06 +0000 (12:23 +0200)] 
pytest: add SOCKS tests and scoring

Configure curl with `--with-test-sockd=<path to sockd>` for a locally
installed dante sockd server and new `test_40_*` will verify that
down- and uploads work via SOCKS.

Invoke scorecard.py with `--socks4` or `--socks5` to run performance
tests with SOCKS. Note that SOCKS is not supported for HTTP/3.

Ref: #17969
Closes #17986

2 weeks agohttp: const up readonly H2_NON_FIELD
CaolĆ”n McNamara [Tue, 22 Jul 2025 13:48:26 +0000 (14:48 +0100)] 
http: const up readonly H2_NON_FIELD

Closes #17996

2 weeks agotest1: raise alloc limits
Stefan Eissing [Wed, 23 Jul 2025 07:41:23 +0000 (09:41 +0200)] 
test1: raise alloc limits

After failures on certain build/platform combinations.

See: https://github.com/curl/curl/actions/runs/16464320627/job/46537983882?pr=17992

Closes #18004

2 weeks agodocs: fix name in curl_easy_ssls_export man page
Stefan Eissing [Tue, 22 Jul 2025 11:10:13 +0000 (13:10 +0200)] 
docs: fix name in curl_easy_ssls_export man page

The name of the man page was wrongly given as curl_easy_sssl_export
which seems to have confused our HTTML man page generation.

Reported-by: Qriist on github
Ref: https://github.com/curl/curl-www/issues/458

Closes #17995

2 weeks agotest1148: drop redundant `LC_NUMBER=` env setting
Viktor Szakats [Tue, 22 Jul 2025 10:19:22 +0000 (12:19 +0200)] 
test1148: drop redundant `LC_NUMBER=` env setting

No longer necessary after a previous change made sure to strip
the '100.0%' number from the result, before checking it. The dot is
a regex character catching any decimal separator.

Follow-up to 17c18fbc3015b5dc0580d16a4ff5bcf2fd88b449 #5194
Ref: #2436
Cherry-picked from #17988
Closes #17993

2 weeks agoGHA/non-native: FreeBSD 14.3
Viktor Szakats [Tue, 22 Jul 2025 17:48:38 +0000 (19:48 +0200)] 
GHA/non-native: FreeBSD 14.3

Follow-up to f097eaea183e7c1f7c8f765f3074e725e58bb652 #18000
Closes #18001

2 weeks agoGHA: update cross-platform-actions/action action to v0.29.0
renovate[bot] [Tue, 22 Jul 2025 15:18:21 +0000 (15:18 +0000)] 
GHA: update cross-platform-actions/action action to v0.29.0

Closes #18000

2 weeks agoGHA: update debian:bookworm-slim Docker digest to 2424c18
renovate[bot] [Tue, 22 Jul 2025 15:18:15 +0000 (15:18 +0000)] 
GHA: update debian:bookworm-slim Docker digest to 2424c18

Closes #17999

2 weeks agolib1560: fix memory leak when run without UTF-8 support
Viktor Szakats [Tue, 22 Jul 2025 14:44:45 +0000 (16:44 +0200)] 
lib1560: fix memory leak when run without UTF-8 support

The issue is missed in CI, because valgrind jobs all run with UTF-8
support.

Fixing:
```
test 1560...[URL API]
 valgrind ERROR ==13362== 104 bytes in 1 blocks are definitely lost in loss record 1 of 1
==13362==    at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==13362==    by 0x48E1302: curl_dbg_calloc (in /curl/bld/lib/libcurl.so.4.8.0)
==13362==    by 0x4931D12: curl_url (in /curl/bld/lib/libcurl.so.4.8.0)
==13362==    by 0x14F658: get_parts (in /curl/bld/tests/libtest/libtests)
==13362==    by 0x150AC6: test_lib1560 (in /curl/bld/tests/libtest/libtests)
==13362==    by 0x17F5D5: main (in /curl/bld/tests/libtest/libtests)
```
Ref: https://github.com/curl/curl/actions/runs/16446352985/job/46479298080?pr=17988#step:41:3007

Follow-up to 7d1ca2e7e1a3b9d3ba70f587f6bc5e83f905afd5 #17933

Closes #17998

2 weeks agocurl: tool_read_cb fix of segfault
Stefan Eissing [Mon, 21 Jul 2025 13:56:19 +0000 (15:56 +0200)] 
curl: tool_read_cb fix of segfault

When transfers read client input without an upload file, the check if
upload file is '.' strcompared a NULL.

Add test 1548 to reproduce and verify fix.

Reported-by: d1r3ct0r
Fixes #17978
Closes #17987

2 weeks agotest1560: set locale/codeset with `LC_ALL` (was: `LANG`), test in CI
Viktor Szakats [Tue, 15 Jul 2025 19:37:51 +0000 (21:37 +0200)] 
test1560: set locale/codeset with `LC_ALL` (was: `LANG`), test in CI

To fix running test 1560 when `LC_ALL` is set to something unexpected
(e.g. `C`). Also syncing it with the rest of tests.

Also:
- GHA/linux: enable `libidn2` in more jobs.
  Also to enable test 1560 reproducing this issue in more jobs.
- GHA/linux: run tests with `LC_ALL=C` in one of the jobs.
- GHA/linux: switch to the non-deprecated package name for libidn2.
- GHA/macos: run tests with non-default locale settings in one job.
- GHA/macos: enable AppleIDN in that job.

Ref: https://github.com/curl/curl/pull/17933#issuecomment-3074582840
Follow-up to f27262b17965aefa7c6bf41bd40b01b4f97407bd #10196

Closes #17938

2 weeks agotidy-up: `Curl_thread_create()` callback return type
Viktor Szakats [Thu, 10 Jul 2025 15:59:59 +0000 (17:59 +0200)] 
tidy-up: `Curl_thread_create()` callback return type

Replace repeat `#ifdef` code with a macro for the return type of
the thread function.

Also:
- always define `CURL_STDCALL`, allowing to use it without guards.
- lib1307: drop single-use macro `CAINFO`.

Closes #17889

2 weeks agocurl_fnmatch, servers: drop local macros in favour of `sizeof()`
Viktor Szakats [Fri, 11 Jul 2025 11:48:13 +0000 (13:48 +0200)] 
curl_fnmatch, servers: drop local macros in favour of `sizeof()`

Closes #17898

2 weeks agoGHA/checksrc: expand spellcheck, fix issues found
Viktor Szakats [Fri, 11 Jul 2025 19:50:23 +0000 (21:50 +0200)] 
GHA/checksrc: expand spellcheck, fix issues found

- codespell: break logic out into its own runnable script. Allowing
  to run it on local machines.
- codespell: install via `pip`, bump to latest version.
- codespell: show version number in CI log.
- codespell: drop no longer needed word exception: `msdos`.
- codespell: include all curl source tree, except `packages` and
  `winbuild`. Drop an obsolete file exclusion.
- add new spellchecker job using the `typos` tool. It includes
  the codespell dictionary and a couple more. Use linuxbrew to install
  it. This takes 10 seconds, while installing via `cargo` from source
  would take over a minute.
- codespell: introduce an inline ignore filter compatible with `cspell`
  Make `typos` recognize it, too. Move single exceptions inline.

Fix new typos found. Also rename variables and words to keep
spellchecking exceptions at minumum. This involves touching some tests.
Also switch base64 strings to `%b64[]` to avoid false positives.

Ref: https://github.com/crate-ci/typos/blob/master/docs/reference.md
Ref: https://github.com/codespell-project/codespell?tab=readme-ov-file#inline-ignore
Ref: https://github.com/codespell-project/codespell/issues/1212#issuecomment-1721152455
Ref: https://cspell.org/docs/Configuration/document-settings

Closes #17905

2 weeks agocurl_setup.h: move UWP detection after `config-win32.h`
Viktor Szakats [Sun, 20 Jul 2025 20:52:31 +0000 (22:52 +0200)] 
curl_setup.h: move UWP detection after `config-win32.h`

To honor a `_WIN32_WINNT` set by `config-win32.h`.

Closes #17980

2 weeks agowindows: fix `if_nametoindex()` detection with autotools, improve with cmake
Viktor Szakats [Sun, 20 Jul 2025 23:57:26 +0000 (01:57 +0200)] 
windows: fix `if_nametoindex()` detection with autotools, improve with cmake

- autotools: fix auto-detection on the Windows platform.
  It was mis-detected when targeting Windows XP/2003 64-bit.
  It was permanently undetected when building for Windows 32-bit.
  ```
  lib/url.c: In function 'zonefrom_url':
  lib/url.c:1802:18: error: implicit declaration of function 'if_nametoindex' [-Wimplicit-function-declaration]
   1802 |       scopeidx = if_nametoindex(zoneid);
        |                  ^~~~~~~~~~~~~~
  lib/url.c:1802:18: error: nested extern declaration of 'if_nametoindex' [-Werror=nested-externs]
  ```
  Ref: https://github.com/curl/curl/actions/runs/16405598782/job/46351023138?pr=17982#step:10:29

Reported-by: LoRd_MuldeR
  Fixes #17979

  Without this patch the workaround for the 8.15.0 release is:
  `export ac_cv_func_if_nametoindex=0` for Windows XP/2003 64-bit.

  Background: Checking for the `if_nametoindex()` function via
  `AC_CHECK_FUNCS()` (autotools) or `check_function_exists()` (cmake) do
  not work on Windows, for two reasons:
  - the function may be disabled at compile-time in Windows headers
    when targeting old Windows versions (XP or WS2003 in curl context)
    via `_WIN32_WINNT`. But it's always present in the system implib
    `iphlpapi` where these checks are looking.
  - for 32-bit Windows the function signature in the implib requires
    a 4-byte argument, while these checks always use no arguments,
    making them always fail.

- cmake: call `if_nametoindex` dynamically with mingw-w64 v1.0.
  This mingw-w64 version lacks prototype and implib entry for it.

- cmake: add auto-detection for Windows and use as a fallback for
  non-pre-fill cases.

- cmake: disable pre-fill with `_CURL_PREFILL=OFF`. (for testing)

- cmake: disable pre-fill for untested compilers. (i.e. non-MSVC,
  non-mingw64)

- GHA/windows: make an autotools job build for Windows XP.

Follow-up to 0d71b18153c8edb996738f8a362373fc72d0013b #17413

Closes #17982

2 weeks agomulti event: remove only announced
Stefan Eissing [Thu, 17 Jul 2025 11:31:44 +0000 (13:31 +0200)] 
multi event: remove only announced

When a socket is closed, only inform the application
socket callback about it if the socket had been announced
before to the callback.

Reported-by: yaoy6 on github
Fixes #17949
Closes #17950

2 weeks agopytest: increase server KeepAliveTimeout
Stefan Eissing [Sat, 19 Jul 2025 11:37:54 +0000 (13:37 +0200)] 
pytest: increase server KeepAliveTimeout

When CI is not able to give clients enough cpu, the default Apache
KeepAliveTimeout of 5 seconds may trigger and cause tests to fail.

Increase the timeout to 30 seconds for reliability.

Ref: #17963
Closes #17968

2 weeks agobuild: enable _GNU_SOURCE on GNU/Hurd
Pino Toscano [Sun, 20 Jul 2025 07:24:37 +0000 (09:24 +0200)] 
build: enable _GNU_SOURCE on GNU/Hurd

Unconditionally enable _GNU_SOURCE when building on GNU/Hurd; this way
it is possible to properly use/rely on GNU extensions e.g. accept4(),
memrchr(), and the GNU strerror_r().

Closes #17975

2 weeks agoeasy handle: check validity on external calls
Stefan Eissing [Fri, 18 Jul 2025 07:15:00 +0000 (09:15 +0200)] 
easy handle: check validity on external calls

In each external API function passing a `CURL *` into the library, check
`GOOD_EASY_HANDLE()` if its magic is still there.

Ref: #17957
Closes #17958

2 weeks agovquic-tls: fix SSL backend type for QUIC connections using gnutls
Stefan Eissing [Sun, 20 Jul 2025 07:46:46 +0000 (09:46 +0200)] 
vquic-tls: fix SSL backend type for QUIC connections using gnutls

Fix the copy&paste error when querying ssl info for gnutls
on QUIC connections.

Reported-by: Harry Sintonen
Closes #17976

2 weeks agomultissl: initialize when requesting a random number
Viktor Szakats [Sat, 19 Jul 2025 13:21:31 +0000 (15:21 +0200)] 
multissl: initialize when requesting a random number

To fix test 1308 in MultiSSL builds.

Failure was caused by the random number generator virtual function being
NULL, instead of pointing to the implementation in the runtime-selected
TLS backend. This could happen in MultiSSL builds when a functionality
was asking for a random number without triggering a VTLS function table
initialization first. Such functionality is MIME, or form data via MIME.

The reason CI did not catch it in an earlier MultiSSL GHA/windows job,
is that it was a debug-enabled one. In debug-enabled builds the test
runner was overriding the random number generator for all tests.

Fixed this by moving the override to the tests requiring it, via
1fcf22585fa3d87a50c9dddc688d962978c0c120 #17971, enabling debug builds
to catch this issue.

Enable MultiSSL in two CI jobs, to verify this patch.

Fixing:
```
test 1308...[formpost tests]

libtests returned 44, when expecting 0
 1308: exit FAILED
[...]
=== Start of file stderr1308
 URL: log/3/test-1308
 tests/libtest/lib1308.c:70 Assertion 'res == 0' FAILED: curl_formget returned error
 tests/libtest/lib1308.c:72 Assertion 'total_size == 518' FAILED: curl_formget got wrong size back
 tests/libtest/lib1308.c:88 Assertion 'res == 0' FAILED: curl_formget returned error
 tests/libtest/lib1308.c:89 Assertion 'total_size == 899' FAILED: curl_formget got wrong size back
```
Ref: https://github.com/curl/curl/actions/runs/16387693424/job/46309536359?pr=17963#step:16:2515

Bug: https://github.com/curl/curl/pull/17963#issuecomment-3092282057

Closes #17970

2 weeks agoGHA/macos: drop redundant build option
Viktor Szakats [Sun, 20 Jul 2025 09:20:56 +0000 (11:20 +0200)] 
GHA/macos: drop redundant build option

Follow-up to 7c23e88d17e0939b4e01c8d05f430e167e148f4b #17973

3 weeks agoGHA/macos: enable QUIC API with OpenSSL
Viktor Szakats [Sat, 19 Jul 2025 20:53:08 +0000 (22:53 +0200)] 
GHA/macos: enable QUIC API with OpenSSL

In one autotools and one cmake job.

Also:
- enable OpenSSL QUIC in two more jobs.
- pytest: add checks to skip h3 tests when there is no h3 server to
  tests 26, 27a, 27b, 27c, 29 in test_02_download. Fixing:
  ```
  FAILED tests/http/test_02_download.py::TestDownload::test_02_26_session_shared_reuse[h3] - AssertionError: expected exit code 0, got 1
  [...]
  ```
  Ref: https://github.com/curl/curl/actions/runs/16392680316/job/46320739635?pr=17973

Ref: https://github.com/Homebrew/homebrew-core/pull/230515
Ref: https://github.com/Homebrew/homebrew-core/commit/6c8e3eed129ed362da8b97b94f1a5372b2289e09

Closes #17973

3 weeks agocmake: make `runtests` targets build the curl tool
Viktor Szakats [Sat, 19 Jul 2025 11:28:48 +0000 (13:28 +0200)] 
cmake: make `runtests` targets build the curl tool

To allow running tests just by building the `test-full` (or similar) in
a single step.

Closes #17967

3 weeks agoGHA/macos: add Rustls, aws-lc jobs
Viktor Szakats [Fri, 18 Jul 2025 21:09:15 +0000 (23:09 +0200)] 
GHA/macos: add Rustls, aws-lc jobs

Bind them to the (arbitrary choice of) Apple clang and gcc compilers,
respectively.

Also:
- bind existing mbedTLS job to the llvm compiler, to keep the number of
  jobs the same as before this patch.
- move OpenLDAP from mbedTLS over to LibreSSL to keep testing it with
  all 3 compilers.
- simplify exclusions for clang-tidy and torture jobs.
- tag clang-tidy and torture jobs via `install_steps`.
  To avoid keeping around special bool fields.

Closes #17963

3 weeks agotest1560: skip some URLs if UTF-8 is not supported
Sergio Durigan Junior [Thu, 17 Jul 2025 09:38:10 +0000 (05:38 -0400)] 
test1560: skip some URLs if UTF-8 is not supported

Debian CI found that `lib1560` implements tests that will fail when
UTF-8 isn't supported.  We can detect that with `nl_langinfo` and skip
the specific URLs that fail (i.e., those whose `getflags` are either
`CURLU_PUNYCODE` or `CURLU_PUNY2IDN`).

Co-authored-by: Viktor Szakats
Closes #17933

3 weeks agotests: set `CURL_ENTROPY` per test, not globally
Viktor Szakats [Sat, 19 Jul 2025 16:45:25 +0000 (18:45 +0200)] 
tests: set `CURL_ENTROPY` per test, not globally

Setting `CURL_ENTROPY` in debug-enabled builds overrides the code paths
responsible for random number generation. To avoid masking issue there,
this patch moves `CURL_ENTROPY` settings to each test that requires it,
and stop setting it by default for all tests (in `runner.pm`).

This makes it possible to catch random generator issues in debug-enabled
builds; extending test coverage.

To keep offering a well-defined state for tests, make `runner.pm` delete
the `CURL_ENTROPY` env, if present.

Ref: #17970

Closes #17971

3 weeks agotests: drop unused `CURL_FORCEHOST` envs
Viktor Szakats [Sat, 19 Jul 2025 17:47:36 +0000 (19:47 +0200)] 
tests: drop unused `CURL_FORCEHOST` envs

Also match case of the `Debug` feature name in comments.

Closes #17972

3 weeks agoGHA: update dependency wolfSSL/wolfssl to v5.8.2
renovate[bot] [Thu, 17 Jul 2025 22:33:11 +0000 (22:33 +0000)] 
GHA: update dependency wolfSSL/wolfssl to v5.8.2

Closes #17956

3 weeks agocurl/system.h: fix for GCC 3.3.x and older
Viktor Szakats [Thu, 17 Jul 2025 16:13:37 +0000 (18:13 +0200)] 
curl/system.h: fix for GCC 3.3.x and older

The guards implicitly and intentionally include clang, which reports
itself as GCC 4.2.1.

Ref: https://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Other-Builtins.html#Other-Builtins
Ref: https://www.haiku-os.org/guides/building/gcc-hybrid (Haiku uses gcc 2.95.3)

Follow-up to 909af1a43b5a7fed8b5a4ca145e39f46b2f50325 #16761

Reported-by: Schrijvers Luc
Fixes #17951
Closes #17954

3 weeks agoDISTROS.md: add Haiku
Viktor Szakats [Thu, 17 Jul 2025 15:32:37 +0000 (17:32 +0200)] 
DISTROS.md: add Haiku

Closes #17953

3 weeks agobuild: link to Apple frameworks required by static wolfSSL
Viktor Szakats [Wed, 16 Jul 2025 21:44:13 +0000 (23:44 +0200)] 
build: link to Apple frameworks required by static wolfSSL

To fix linking a static wolfSSL library for Apple targets.
Also stop linking `m` and `dl` on Apple platforms.

Matching logic in wolfSSL build code:
https://github.com/wolfSSL/wolfssl/blob/8bde512676fd425d72682fa020362eb9916476ad/CMakeLists.txt#L2520-L2544

Reported-by: Kai Pastor
Reported-by: Tal Regev
Bug: https://github.com/microsoft/vcpkg/pull/46444#pullrequestreview-3026575393
Ref: https://github.com/microsoft/vcpkg/pull/46444/commits/3a845c4b15066e8167bb4708007180fb6bedf40d

Closes #17945

3 weeks agognutls: some small cleanups
Stefan Eissing [Wed, 16 Jul 2025 10:22:30 +0000 (12:22 +0200)] 
gnutls: some small cleanups

- de-complex Curl_gtls_verifyserver() by splitting of static
  functions for parts of it.
- follow the `goto out` style with common deallocation code

Closes #17941

3 weeks agoopenssl: some small cleanups
Stefan Eissing [Wed, 16 Jul 2025 09:10:13 +0000 (11:10 +0200)] 
openssl: some small cleanups

- rename Curl_oss_check_peer_cert() to Curl_ossl_check_peer_cert()
- leave altname match loop after the first success when the match
  was an ip address
- remove static subj_alt_hostcheck() since it did not really do much
- use length based infof() output of altname, even though it does
  seem always to be nul terminated

Closes #17940

3 weeks agosocks: do_SOCKS5: Fix invalid buffer content on short send
Ammar Faizi [Wed, 16 Jul 2025 13:22:43 +0000 (20:22 +0700)] 
socks: do_SOCKS5: Fix invalid buffer content on short send

Ahmad Gani intercepts the sendto syscall to simulate short send, but
curl incorrectly handles it. It keeps resending the version:

  sendto(4, "\x05", 1, MSG_NOSIGNAL, NULL, 0) = 1
  sendto(4, "\x05", 1, MSG_NOSIGNAL, NULL, 0) = 1

Don't restart the buffer in the `CONNECT_SOCKS_INIT` case if
`sx->outstanding` is not zero. It should continue sending the
advanced buffer.

Fixes #17942
Reported-by: Ahmad Gani <reyuki@gnuweeb.org>
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Closes #17943

3 weeks agocurlver: bump to 8.15.1 (for now?)
Daniel Stenberg [Thu, 17 Jul 2025 22:37:51 +0000 (00:37 +0200)] 
curlver: bump to 8.15.1 (for now?)

3 weeks agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 17 Jul 2025 22:36:15 +0000 (00:36 +0200)] 
RELEASE-NOTES: synced

And bump version

3 weeks agotool_operate: avoid superfluous strdup'ing output
Daniel Stenberg [Wed, 16 Jul 2025 22:06:55 +0000 (00:06 +0200)] 
tool_operate: avoid superfluous strdup'ing output

Closes #17946

3 weeks agoRELEASE-NOTES: synced curl-8_15_0
Daniel Stenberg [Wed, 16 Jul 2025 06:19:39 +0000 (08:19 +0200)] 
RELEASE-NOTES: synced

8.15.0 release

3 weeks agoTHANKS: new contributors in 8.15.0
Daniel Stenberg [Wed, 16 Jul 2025 06:19:39 +0000 (08:19 +0200)] 
THANKS: new contributors in 8.15.0

3 weeks agoautotools: stop checking for the `pw32` platform
Viktor Szakats [Tue, 15 Jul 2025 15:41:52 +0000 (17:41 +0200)] 
autotools: stop checking for the `pw32` platform

It's most likely a reference to Posix-over-Win32 layer:

https://pw32.sourceforge.net/main.html (last updated: 2001-05-01)
https://sourceforge.net/projects/pw32/
https://sourceforge.net/projects/pw32/files/ (latest date: 2001-10-12)

Closes #17936

3 weeks agorelease-notes.pl: ignore dupes on input and output
Daniel Stenberg [Tue, 15 Jul 2025 15:43:57 +0000 (17:43 +0200)] 
release-notes.pl: ignore dupes on input and output

Re-running this script now makes it track the already mentioned
changelog entries and not add them again even if the git log contains
them.

This makes the script better handle reruns in a release branch after
rebasing on a later version of master.

Closes #17937

3 weeks agoci: consolidate openldap step into openssl krb5
Max Dymond [Tue, 15 Jul 2025 11:27:53 +0000 (12:27 +0100)] 
ci: consolidate openldap step into openssl krb5

Closes #17891

3 weeks agoci: fix ldap install location and add renovate rule for openldap
Max Dymond [Sat, 12 Jul 2025 16:04:43 +0000 (17:04 +0100)] 
ci: fix ldap install location and add renovate rule for openldap

3 weeks agoci: install libssl-dev in the openldap static test
Max Dymond [Thu, 10 Jul 2025 19:49:29 +0000 (20:49 +0100)] 
ci: install libssl-dev in the openldap static test

3 weeks agoconfigure: order LDAP after the SSL libraries
Max Dymond [Thu, 10 Jul 2025 19:39:55 +0000 (20:39 +0100)] 
configure: order LDAP after the SSL libraries