]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
4 months agoGHA/macos: verbose cmake in test steps
Viktor Szakats [Tue, 18 Mar 2025 03:02:47 +0000 (04:02 +0100)] 
GHA/macos: verbose cmake in test steps

To sync with other workflows, and autotools. To see build details,
including clang-tidy invocations.

Closes #16757

5 months agolib696: fix building on Windows in non-bundle mode
Viktor Szakats [Mon, 17 Mar 2025 21:10:51 +0000 (22:10 +0100)] 
lib696: fix building on Windows in non-bundle mode

```
FAILED: tests/libtest/lib696.exe
[...] undefined reference to `curlx_write'
```
Ref: https://github.com/curl/curl/actions/runs/13909717720/job/38921073575?pr=16750#step:12:469

Closes #16753

5 months agoruntests: add feature-based filtering
Aquila Macedo [Fri, 7 Mar 2025 21:40:34 +0000 (18:40 -0300)] 
runtests: add feature-based filtering

This commit introduces support for features in the test selection
process by adding them to the keywords list with the `feat:` prefix. It
allows users to specify features to run only tests with them, or exclude
tests using `!feat:<feature>`, similar to how keywords are handled.

Fixes #16533
Closes #16619

Signed-off-by: Aquila Macedo <aquilamacedo@riseup.net>
5 months agotests: git ignore the bundle executables built
Stefan Eissing [Mon, 17 Mar 2025 14:36:34 +0000 (15:36 +0100)] 
tests: git ignore the bundle executables built

Closes #16749

5 months agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 17 Mar 2025 15:45:23 +0000 (16:45 +0100)] 
RELEASE-NOTES: synced

5 months agoGHA/windows: skip flaky test 498
Viktor Szakats [Mon, 17 Mar 2025 13:05:12 +0000 (14:05 +0100)] 
GHA/windows: skip flaky test 498

On suspect of strain on the runtime env/pipes, disable this test, which
is flaky due to `runtests` detecting a 2009 result code from curl, while
curl is returning the expected 56:

```
test 0498...[Reject too large HTTP response headers on endless redirects]

curl returned 2009, when expecting 56
 498: exit FAILED
== Contents of files in the log/5/ dir after test 498
[...]
   0     0    0     0    0     0      0      0 --:--:--  0:00:10 --:--:--     0
 curl: (56) Too large response headers: 6144086 > 6144000
```

In such cases the number of log lines for this single test is 4800. In
comparison the total number of log lines for a clear test run is 3800.

Seen with mingw, dl-mingw, msvc CI jobs.

Follow-up to 4911e7af119c1b7efd46a742d47bca44832c3041 #16735
Ref: https://github.com/curl/curl/discussions/14854#discussioncomment-12503065

Closes #16748

5 months agomemdebug: revert setting gcc 11+ deallocator attribute
Viktor Szakats [Mon, 17 Mar 2025 00:05:14 +0000 (01:05 +0100)] 
memdebug: revert setting gcc 11+ deallocator attribute

These attributes were causing unexplained warnings while playing with
PR #16738: In `CURLDEBUG` builds with mingw, gcc (14.2.0), and `-O3`,
while building `libcurlu`. `-O3` is required. May be related to having
the `CURLDEBUG` allocators in the same source file as their callers
(unity mode). PR #16738 moves `memdebug.c` into the main unity unit.
Unclear why it doesn't affect `libcurl`.

E.g. CI job `mingw, CM ucrt-x86_64 schannel R TrackMemory` CI job:
https://github.com/curl/curl/actions/runs/13888662354/job/38856868429

It also reproduces in an isolated example.

Drop this attribute till we learn more about it.

Ref: https://github.com/curl/curl/pull/16737#issuecomment-2727681306
Partial revert of d5b403074ed2b28e41e0c17dcd436252d38adfa3 #16737

Closes #16740

5 months agoGHA/windows: drop redundant manual changes to MSYS2 config
Viktor Szakats [Sun, 16 Mar 2025 22:14:31 +0000 (23:14 +0100)] 
GHA/windows: drop redundant manual changes to MSYS2 config

It's done automatically by the `msys2/setup-msys2` action.

Suggested-by: Jeremy Drake
Ref: https://github.com/curl/curl/pull/16672#discussion_r1997699803

Closes #16739

5 months agotests/server: support bundle binary
Viktor Szakats [Sun, 8 Sep 2024 22:33:04 +0000 (00:33 +0200)] 
tests/server: support bundle binary

Extend existing `--enable-test-bundles` and `-DCURL_TEST_BUNDLES=ON`
options to also bundle test server programs into a single binary. With
autotools, also bundle auxiliary libcurl sources for a "unity"-style
build.

It saves almost 10 minutes per run, across all CI jobs.
On average it makes `build tests` steps 25% faster.

With CMake, it brings down `testdeps` build steps to 32 to 37, from
45 to 64 before this patch, with unity. Without unity it brings it down
from 400-420 to 280-300. For comparison, without unity and bundles,
the number of build steps is around 1850.

With autotools the gain is possibly larger because this patch does unity
and bundle for test servers.

The total reduction of build steps / log lines is 12000. It's 44% of
reduction on average across all CI jobs.

Follow-up to 77401af4852103b215fe74989e89be61bbf435d2 #16695
Follow-up to 71cf0d1fca9e1f53524e1545ef0c08d174458d80 #14772

Comparison of 'build tests' targets in S(econds) and L(ines/steps),
between before and after this patch:

CI job                                    |BefS|AftS|Gain|BefL|AftL|Gain| Comments
:---------------------------------------- | -: | -: | -: | --:| --:| --:| :-------
GHA/windows                               |    |    |    |    |    |    |
Cygwin AM                                 |110 | 95 | 15 | 237|  88| 149| l(ines)
Cygwin CM                                 | 34 | 27 |  7 |  63|  36|  27| s(teps, with Ninja)
msys2, AM x86_64 !proxy                   | 35 | 21 | 14 | 255| 108| 147| l
msys2, AM x86_64 default                  | 35 | 22 | 13 | 255| 108| 147| l
msys2, CM x86_64 default                  | 14 | 11 |  3 |  63|  36|  27| s
msys2, AM x86_64 default R                | 41 | 29 | 12 | 245|  96| 149| l
mingw, AM x86_64 default                  | 69 | 33 | 36 | 331| 156| 175| l
mingw, AM x86_64 c-ares U                 | 69 | 33 | 36 | 331| 156| 175| l
mingw, CM x86_64 schannel c-ares U        | 32 | 24 |  8 |  63|  36|  27| s
mingw, CM clang-x86_64 gnutls             |  9 |  6 |  3 |  63|  36|  27| s
mingw, CM ucrt-x86_64 schannel R TrackMem | 43 | 35 |  8 |  64|  37|  27| s
mingw, CM clang-x86_64 openssl            | 20 | 18 |  2 |  63|  36|  27| s
mingw, CM ucrt-x86_64 schannel uwp        | 36 | 34 |  2 |  47|  34|  13| s
mingw, CM x86_64 schannel dev debug       | 32 | 24 |  8 |  64|  37|  27| s
mingw, CM i686 schannel R                 | 38 | 37 |  1 |  47|  34|  13| s
dl-mingw, CM 9.5.0-x86_64 schan           |102 | 94 |  8 |  63|  36|  27| s
dl-mingw, CM 7.3.0-x86_64 schan mbedtls U | 32 | 24 |  8 |  94|  60|  34| l
dl-mingw, CM 6.4.0-i686 schannel !unity   | 42 | 31 | 11 | 427| 297| 130| l (no unity, yes bundle)
linux-mingw, AM gcc                       |  - |  - |    |   -|   -|    |
linux-mingw, CM gcc                       | 12 | 10 |  2 |  46|  33|  13| s
mingw32ce, AM 4.4.0-arm schannel          |  - |  - |    |   -|   -|    |
mingw32ce, CM 4.4.0-arm schannel          | 30 | 31 | -1 |  81|  61|  20| l
msvc, CM x64-uwp openssl +examples        | 13 | 10 |  3 | 102|  68|  34| l
msvc, CM x64-windows openssl              | 13 | 10 |  3 | 102|  68|  34| l
msvc, CM x64-windows schannel MultiSSL U  | 13 | 10 |  3 | 102|  68|  34| l
msvc, CM x64-windows libressl             | 14 | 13 |  1 | 102|  68|  34| l
msvc, CM x64-windows boringssl            | 11 | 11 |  0 |  84|  64|  20| l
msvc, CM x64-windows wolfssl +examples    | 13 | 10 |  3 | 102|  68|  34| l
msvc, CM x64-windows mbedtls libssh       | 14 | 10 |  4 | 102|  68|  34| l
GHA/old-linux:                            |    |    |    |    |    |    |
linux (cmake & autoconf) AM               | 14 | 11 |  3 | 217|  75| 142| l
linux (cmake & autoconf) CM               | 15 | 13 |  2 | 545| 380| 165| l
GHA/non-native:                           |    |    |    |    |    |    |
AmigaOS, AM gcc AmiSSL m68k               |  - |  - |    |   -|   -|    |
AmigaOS, CM gcc AmiSSL m68k               |  8 |  7 |  1 |  78|  58|  20| l
Android 21, AM openssl arm64              |  7 |  5 |  2 | 222|  80| 142| l
Android 21, CM openssl arm64              |  4 |  5 | -1 |  81|  61|  20| l
Android 35, AM openssl arm64              |  7 |  5 |  2 | 222|  80| 142| l
Android 35, CM boringssl !zstd arm64      |  4 |  3 |  1 |  81|  61|  20| l
Android 35, CM openssl arm64              |  5 |  4 |  1 |  81|  61|  20| l
FreeBSD, AM clang openssl arm64           |  - |  - |    |   -|   -|    |
FreeBSD, AM clang openssl x86_64          |  7 |  3 |  4 | 513| 133| 380| l
FreeBSD, CM clang openssl !unity !bundle..| 49 | 47 |  2 |1841|1841|    | s (no unity, no bundle)
FreeBSD, CM clang openssl arm64           |  - |  - |    |   -|   -|    |
MS-DOS, AM djgpp openssl i586             |  - |  - |    |   -|   -|    |
MS-DOS, CM djgpp openssl i586             |  6 |  7 | -1 |  45|  32|  13| s
NetBSD, CM clang openssl x86_64           | 15 | 13 |  2 |  62|  35|  27| s
OmniOS, AM gcc openssl amd64              | 20 | 11 |  9 | 216|  74| 142| l
OpenBSD, CM clang libressl x86_64         |  9 |  7 |  2 |  62|  35|  27| s
iOS, AM libressl arm64                    |  6 |  3 |  3 | 217|  68| 149| l
iOS, CM libressl arm64                    | 10 | 10 |  0 | 236| 175|  61| l
iOS, CM-Xcode libressl arm64              | 13 |  8 |  5 | 899| 627| 272| l
GHA/linux:                                |    |    |    |    |    |    |
AM bearssl                                |  9 |  8 |  1 | 258| 111| 147| l
AM bearssl clang                          |  6 |  4 |  2 | 258| 111| 147| l
AM libressl heimdal                       | 11 |  8 |  3 | 267| 120| 147| l
CM libressl heimdal valgrind              |  8 |  5 |  3 |  62|  35|  27| s
AM libressl clang                         |  7 |  4 |  3 | 258| 111| 147| l
AM wolfssl-all                            | 11 |  8 |  3 | 258| 111| 147| l
AM wolfssl-opensslextra valgrind          | 11 |  7 |  4 | 258| 111| 147| l
AM mbedtls valgrind                       | 10 |  7 |  3 | 258| 111| 147| l
AM mbedtls clang                          |  6 |  3 |  3 | 258| 111| 147| l
CM mbedtls                                |  7 |  6 |  1 |  62|  35|  27| s
CM mbedtls-pkg                            |  7 |  7 |  0 |  62|  35|  27| s
CM mbedtls-pkg !pc                        |  - |  - |    |   -|   -|    |
AM msh3                                   | 10 |  7 |  3 | 258| 111| 147| l
CM msh3                                   |  7 |  7 |  0 |  62|  35|  27| s
AM awslc                                  | 18 | 15 |  3 | 247|  98| 149| l
CM awslc                                  | 13 | 11 |  2 | 400| 277| 123| s (no unity, yes bundle)
AM openssl default                        | 10 |  7 |  3 | 258| 111| 147| l
AM openssl libssh2 sync-resolver valgrind | 10 |  7 |  3 | 258| 111| 147| l
AM openssl                                | 11 |  7 |  4 | 258| 111| 147| l
AM openssl -O3 valgrind                   | 26 | 21 |  5 | 258| 111| 147| l
AM openssl clang krb5                     |  7 |  3 |  4 | 265| 118| 147| l
CM openssl clang krb5 LTO                 |  - |  - |    |   -|   -|    |
AM openssl !ipv6 !--libcurl               | 10 |  7 |  3 | 258| 111| 147| l
AM openssl https-only                     | 11 |  8 |  3 | 258| 111| 147| l
CM openssl torture !FTP                   |  7 |  6 |  1 |  62|  35|  27| s
CM openssl torture FTP                    |  8 |  6 |  2 |  62|  35|  27| s
AM openssl i686                           | 12 |  9 |  3 | 258| 111| 147| l
AM !ssl !http !smtp !imap                 | 10 |  7 |  3 | 258| 111| 147| l
AM clang-tidy                             |  - |  - |    |   -|   -|    |
AM scanbuild                              |  - |  - |    |   -|   -|    |
AM address-sanitizer                      | 10 |  6 |  4 | 258| 111| 147| l
AM thread-sanitizer                       |  7 |  4 |  3 | 258| 111| 147| l
AM memory-sanitizer                       | 10 |  6 |  4 | 258| 111| 147| l
AM event-based                            | 10 |  7 |  3 | 253| 106| 147| l
AM duphandle                              | 10 |  8 |  2 | 253| 106| 147| l
AM rustls valgrind                        | 10 |  8 |  2 | 258| 111| 147| l
CM rustls                                 |  7 |  5 |  2 |  62|  35|  27| s
AM IntelC openssl                         | 18 | 14 |  4 | 572| 282| 290| l
AM Slackware openssl gssapi gcc           | 17 | 14 |  3 | 252| 103| 149| l
AM Alpine MUSL https-rr                   | 15 | 11 |  4 | 266| 119| 147| l
AM Alpine MUSL c-ares https-rr            | 15 | 11 |  4 | 266| 119| 147| l
GHA/linux-http3:                          |    |    |    |    |    |    |
AM quictls                                | 12 |  8 |  4 | 258| 111| 147| l
AM gnutls                                 | 11 |  8 |  3 | 257| 110| 147| l
AM wolfssl                                | 11 |  9 |  2 | 257| 110| 147| l
CM wolfssl                                |  8 |  7 |  1 |  62|  35|  27| s
AM openssl-quic                           | 11 |  8 |  3 | 257| 110| 147| l
AM quiche                                 | 11 |  9 |  2 | 257| 110| 147| l
CM quiche                                 |  8 |  6 |  2 |  62|  35|  27| s
GHA/macos:                                |    |    |    |    |    |    |
AM clang !ssl !debug brotli zstd          |  5 |  3 |  2 | 218|  69| 149| l
AM clang !ssl                             |  4 |  5 | -1 | 227|  80| 147| l
AM clang !ssl libssh2 AppleIDN            |  5 |  1 |  4 | 227|  80| 147| l
AM clang OpenSSL libssh c-ares            |  4 |  2 |  2 | 227|  80| 147| l
AM clang !ssl c-ares                      |  4 |  5 | -1 | 227|  80| 147| l
AM clang !ssl HTTP-only                   |  4 |  2 |  2 | 222|  75| 147| l
AM clang SecureTransport libssh2          |  3 |  3 |  0 | 227|  80| 147| l
AM clang SecureTransport libssh2 10.12    |  4 |  2 |  2 | 227|  80| 147| l
AM clang LibreSSL +examples               |  5 |  2 |  3 | 227|  80| 147| l
AM clang OpenSSL                          |  6 |  1 |  5 | 227|  80| 147| l
AM clang OpenSSL event-based              |  5 |  3 |  2 | 227|  80| 147| l
AM clang quictls libssh2 !ldap 10.15      |  4 |  2 |  2 | 227|  80| 147| l
CM clang OpenSSL gsasl rtmp AppleIDN      |  2 |  2 |  0 |  45|  32|  13| s
CM clang OpenSSL AppleIDN clang-tidy +e   |150 | 76 | 74 | 400| 277| 123| s (clang-tidy)
CM clang quictls +static libssh +examples |  2 |  2 |  0 |  45|  32|  13| s
CM clang SecureTransport debug            |  2 |  2 |  0 |  62|  35|  27| s
CM clang LibreSSL !ldap heimdal c-ares +e |  4 |  2 |  2 |  45|  32|  13| s
CM clang wolfSSL !ldap brotli zstd        |  1 |  2 | -1 |  45|  32|  13| s
CM clang mbedTLS openldap brotli zstd     |  1 |  2 | -1 |  45|  32|  13| s
CM clang GnuTLS !ldap krb5                |  0 |  1 |  0 |  45|  32|  13| s
CM clang OpenSSL torture !FTP             |  2 |  1 |  1 |  61|  34|  27| s
CM clang OpenSSL torture FTP              |  2 |  1 |  1 |  61|  34|  27| s
AM llvm@15 OpenSSL libssh                 |  5 |  4 |  1 | 227|  80| 147| l
CM llvm@15 OpenSSL gsasl rtmp AppleIDN    |  3 |  2 |  1 |  45|  32|  13| s
CM llvm@15 quictls +static libssh +e      |  2 |  2 |  0 |  45|  32|  13| s
CM llvm@15 SecureTransport debug          |  3 |  2 |  1 |  62|  35|  27| s
CM llvm@15 LibreSSL !ldap heimdal c-ares..|  3 |  1 |  2 |  45|  32|  13| s
CM llvm@15 wolfSSL !ldap brotli zstd      |  3 |  2 |  1 |  45|  32|  13| s
CM llvm@15 mbedTLS openldap brotli zstd   |  2 |  2 |  0 |  45|  32|  13| s
CM llvm@15 GnuTLS !ldap krb5              |  2 |  1 |  1 |  45|  32|  13| s
AM gcc-12 !ssl !debug                     | 18 | 12 |  6 | 218|  69| 149| l
AM gcc-12 SecureTransport libssh2         | 13 |  6 |  7 | 227|  80| 147| l
CM gcc-12 OpenSSL gsasl rtmp AppleIDN     |  7 |  5 |  2 |  45|  32|  13| s
CM gcc-12 quictls +static libssh +e       |  8 |  6 |  2 |  45|  32|  13| s
CM gcc-12 SecureTransport debug           |  8 |  6 |  2 |  62|  35|  27| s
CM gcc-12 LibreSSL !ldap heimdal c-ares...|  7 |  6 |  1 |  45|  32|  13| s
CM gcc-12 wolfSSL !ldap brotli zstd       | 16 |  6 | 10 |  45|  32|  13| s
CM gcc-12 mbedTLS openldap brotli zstd    | 11 |  6 |  5 |  45|  32|  13| s
CM gcc-12 GnuTLS !ldap krb5               |  7 |  5 |  2 |  45|  32|  13| s
AppVeyor:                                 |    |    |    |    |    |    |
VS2008 D x86 OpenSSL + Schannel SH +e     | 56 | 39 | 17 |  21|  14|   7| s (VCBuild)
VS2010 D x64 Schannel SH +e               | 14 | 12 |  2 | 105|  78|  27| l
VS2012 R x86 OpenSSL + Schannel SH        | 23 | 21 |  2 |  84|  64|  20| l
VS2013 D x64 OpenSSL SH Build-only        |  - |  - |    |   -|   -|    | (no build tests)
VS2015 D x64 OpenSSL ST Build-only        |  - |  - |    |   -|   -|    | (no build tests)
VS2017 D x64 OpenSSL SH Build-only        |  - |  - |    |   -|   -|    | (no build tests)
VS2019 D x64 OpenSSL + Schannel SH        | 33 | 26 |  7 |  81|  61|  20| l
VS2022 D x64 !SSL ST                      | 32 | 25 |  7 |  79|  59|  20| l
VS2022 D x64 !SSL ST HTTP-only            | 33 | 22 | 11 |  79|  59|  20| l
VS2022 R arm64 Schannel ST                | 74 | 69 |  5 |  79|  59|  20| l
VS2022 R x64 Schannel SH U DBGBLD !CURLDBG| 66 | 61 |  5 |  78|  58|  20| l
VS2022 D x64 Schannel ST U                | 34 | 25 |  9 |  79|  59|  20| l
VS2022 D x64 Schannel ST U clang-cl +e    | 42 | 34 |  8 |  53|  40|  13| l
VS2022 R x64 OpenSSL SH                   | 60 | 58 |  2 |  83|  63|  20| l
Total                                     |2394|1807|-587| 26k| 14k|-12k|
in %                                      |    |    |-24%|    |    |-45%|
in minutes                                |    |    |9m47|    |    |    |

Before:
GHA/windows: https://github.com/curl/curl/actions/runs/13854983424
GHA/old-linux: https://github.com/curl/curl/actions/runs/13854983399
GHA/non-native: https://github.com/curl/curl/actions/runs/13854983427
GHA/linux-http3: https://github.com/curl/curl/actions/runs/13854983409
GHA/linux: https://github.com/curl/curl/actions/runs/13854983406
GHA/macos: https://github.com/curl/curl/actions/runs/13854983401
Appveyor: https://ci.appveyor.com/project/curlorg/curl/builds/51703551

After:
GHA/windows: https://github.com/curl/curl/actions/runs/13860433850?pr=15000
GHA/old-linux: https://github.com/curl/curl/actions/runs/13860433809?pr=15000
GHA/non-native: https://github.com/curl/curl/actions/runs/13860433828?pr=15000
GHA/linux-http3: https://github.com/curl/curl/actions/runs/13860433806?pr=15000
GHA/linux: https://github.com/curl/curl/actions/runs/13860433848?pr=15000
GHA/macos: https://github.com/curl/curl/actions/runs/13860433835?pr=15000
Appveyor: https://ci.appveyor.com/project/curlorg/curl/builds/51704222

Closes #15000

5 months agomemdebug: set gcc 11+ deallocator attribute, extend alloc attributes to clang
Viktor Szakats [Sat, 15 Mar 2025 22:22:19 +0000 (23:22 +0100)] 
memdebug: set gcc 11+ deallocator attribute, extend alloc attributes to clang

To make `-Wfree-nonheap-object` and `-Wmismatched-dealloc` work in
`CURLDEBUG` builds.

Also extend `ALLOC_FUNC` and `ALLOC_SIZE` attribute support
to llvm/clang.

llvm/clang is missing the deallocator attribute, tracked here:
https://github.com/llvm/llvm-project/issues/129068

Ref: https://gcc.gnu.org/onlinedocs/gcc-11.1.0/gcc/Common-Function-Attributes.html#Common-Function-Attributes
Ref: https://www.gnu.org/software/gcc/gcc-11/changes.html
Ref: 6b143d9cc13fcd208480f678dfd06bf97bde4998 #16734

Closes #16737

5 months agoGHA/windows: unignore 2310, disable SCP/FTP for vcpkg `libssh2[core]`
Viktor Szakats [Sat, 15 Mar 2025 11:03:56 +0000 (12:03 +0100)] 
GHA/windows: unignore 2310, disable SCP/FTP for vcpkg `libssh2[core]`

Skipping these tests saves time and reduces test logs from 11500 lines
to 3800.

Tests are permanently broken due to `curl: (67) Authentication failure`.
This libssh2 is built with WinCNG. Builds using libcrypto from OpenSSL
work fine.

Closes #16735

5 months agoasyn-thread: drop `free()` on non-heap address
Viktor Szakats [Sat, 15 Mar 2025 01:39:05 +0000 (02:39 +0100)] 
asyn-thread: drop `free()` on non-heap address

seen with mingw-w64 gcc 14.2.0 while playing with other modifications:
```
lib/asyn-thread.c: In function 'init_resolve_thread':
lib/asyn-thread.c:447:5: warning: 'free' called on pointer 'data' with nonzero offset 3264 [-Wfree-nonheap-object]
  447 |     free(td);
      |     ^~~~~~~~
```

Where `td` is:
```c
  struct thread_data *td = &data->state.async.thdata;
```

Follow-up to d9fc64d3ab289a84548e952183d7eba79ccc846e #16241
Closes #16734

5 months agoftp/sftp: strdup data info memory
Stefan Eissing [Sat, 15 Mar 2025 10:20:15 +0000 (11:20 +0100)] 
ftp/sftp: strdup data info memory

Fix the broken implementation to have `data->state` carry pointers into
connectdata members. Always dup the memory and free when easy handle
closes.

Closes #16733

5 months agoGHA/non-native: drop building docs with autotools on emulated CPU
Viktor Szakats [Fri, 14 Mar 2025 21:01:49 +0000 (22:01 +0100)] 
GHA/non-native: drop building docs with autotools on emulated CPU

It saves about 1 minute (10%) per run.
Also reduces log length from 3800 to 2800 lines.

Keep building docs on native CPU.

Closes #16731

5 months agoautotools: fix `libtest` bundle to depend on `FIRSTFILES`
Viktor Szakats [Fri, 14 Mar 2025 02:24:49 +0000 (03:24 +0100)] 
autotools: fix `libtest` bundle to depend on `FIRSTFILES`

Closes #16726

5 months agohttp: remove a HTTP method size restriction
Daniel Stenberg [Fri, 14 Mar 2025 16:30:09 +0000 (17:30 +0100)] 
http: remove a HTTP method size restriction

By allocating the method string as part of the struct, the previous
fixed size limit (23 bytes) can be avoided. It would previously make
"curl -X [long string]" work against http://localhost but fail against
https://curl.se with no clear error message.

Closes #16729

5 months agohttp: remove the space requirement after status-code
Daniel Stenberg [Fri, 14 Mar 2025 15:57:33 +0000 (16:57 +0100)] 
http: remove the space requirement after status-code

It was introduced in 294136b75411893c5, but not shipped in a release. It
has caused problems and after checking, the browsers don't insist on it
even if RFC 9112 says it is mandatory.

Adjust test 2 to do a response without the space.

Closes #16728

5 months agolibtest/lib2311: remove "extra" fclose()
Daniel Stenberg [Fri, 14 Mar 2025 11:31:17 +0000 (12:31 +0100)] 
libtest/lib2311: remove "extra" fclose()

Follow-up to 3588df9478d7c27046b34cdb5

Fixes #16721
Reported-by: Viktor Szakats
Closes #16722

5 months agocurl_ws_recv.md: expand a little on the fragments the API delivers
Daniel Stenberg [Fri, 14 Mar 2025 10:52:05 +0000 (11:52 +0100)] 
curl_ws_recv.md: expand a little on the fragments the API delivers

Closes #16720

5 months agodynbuf: bump the max CRLFILE size to 400MB
Daniel Stenberg [Fri, 14 Mar 2025 11:49:31 +0000 (12:49 +0100)] 
dynbuf: bump the max CRLFILE size to 400MB

Follow-up to 00fc55677f693f569b1a176279f

Ref: https://github.com/curl/curl/pull/16716#issuecomment-2724429278

> I have some tooling leftover from when I was implementing CRL support
> in the webpki crate that downloaded every CRL I could find referenced
> in ccadb (without doing any special filtering for defunct CAs/CRLs
> mind you) and found CRLs that spanned the range from very small
> (<1mb), to medium sized (11 .. 22mb) to very large (100mb).

Reported-by: Daniel McCarney
Closes #16724

5 months agoautotools: use `CURLDEBUG` to exclude TrackMemory code from unity
Viktor Szakats [Fri, 14 Mar 2025 02:37:37 +0000 (03:37 +0100)] 
autotools: use `CURLDEBUG` to exclude TrackMemory code from unity

Before this patch, autotools builds excluded TrackMemory sources
(`lib/memdebug.c` and `lib/curl_multibyte.c`) based on the `DEBUGBUILD`
setting. This works in most cases because its value is the same as
`CURLDEBUG` by default, but the correct condition is `CURLDEBUG`.

It should fix `--disable-debug --enable-curldebug --enable-unity`
builds. (not tested in CI)

It also syncs behavior with cmake builds.

Ref: #16705
Closes #16723

5 months agobuild: do not apply curl debug macros to `tests/server` by default
Viktor Szakats [Wed, 12 Mar 2025 21:41:57 +0000 (22:41 +0100)] 
build: do not apply curl debug macros to `tests/server` by default

It seems unnecessary and possibly unexpected to build test servers with
debug-enabled features and memory tracking whenever the tested curl is
built like that (which is a requirement for some tests, so curl is
mostly built like that when running tests.) It also makes building
servers a little bit faster with cmake for the most common cases.

You can apply debug options to `tests/server` with these new options:
- `./configure`: `--enable-server-debug`.
- cmake: `-DENABLE_SERVER_DEBUG`.

Also sync the way we pass these macros in autotools, with CMake builds.
Before this patch, autotools passed them via `curl_config.h`. After this
patch it passes them on the command-line, like cmake builds do.

This patch also make these option no longer passed to examples and
`http/client` in cmake builds, where they were no-ops anyway.

Ref: #15000
Closes #16705

5 months agotests/server: give global `path` variable a more descriptive name
Viktor Szakats [Wed, 12 Mar 2025 21:35:23 +0000 (22:35 +0100)] 
tests/server: give global `path` variable a more descriptive name

Use a more descriptive global variable name in server code, also
to avoid colliding with this name used elsewhere in libcurl.

This isn't causing an issue at this time, but makes the code prone
to `-Wshadow` warnings in unity mode, if the global variable is
compiled first. This specific variable could collide with the `path`
argument of the `curlx_win32_stat()` function.

Closes #16719

5 months agows: fix and extend CURLWS_CONT handling
Calvin Ruocco [Mon, 10 Mar 2025 16:19:58 +0000 (17:19 +0100)] 
ws: fix and extend CURLWS_CONT handling

Follow-up to fa3d1e7d43bf0e4f589aeae737

Add test 2311 to verify

Closes #16687

5 months agoautotools: fix `dllmain.c` in unity builds
Viktor Szakats [Thu, 13 Mar 2025 22:53:40 +0000 (23:53 +0100)] 
autotools: fix `dllmain.c` in unity builds

Sync it with cmake to:
- exclude it from all builds except Windows and Cygwin.
- exclude it from unity builds for Cygwin to avoid the included
  `windows.h` header interfere with the rest of the code.

Also:
- fix to trim ending spaces from `CSOURCES` for the `tidy` target.
  The solution requires a non-POSIX `-E` `sed` option. Supported by BSD
  and GNU implementations.
  Follow-up to 37523c91bc418fc734ee54f329677dc7123eb465 #16480

Follow-up to 60c3d0446546332e1645541f2dc2c072cd019fe9 #14815
Follow-up to 7860f575fe9e527ced66b31ec076914bbadd64a4 #12408

Closes #16712

5 months agotests/server: drop unused `base64.pl`
Viktor Szakats [Fri, 14 Mar 2025 00:40:12 +0000 (01:40 +0100)] 
tests/server: drop unused `base64.pl`

When committed in 2004, it served as a developer helper tool while
`coreutils` was yet missing a `base64` command.

Assisted-by: Dan Fandrich
Closes #16713

5 months agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 14 Mar 2025 08:37:26 +0000 (09:37 +0100)] 
RELEASE-NOTES: synced

5 months agorustls: cap maximum allowed CRL file size to 8MB
Daniel Stenberg [Fri, 14 Mar 2025 07:28:02 +0000 (08:28 +0100)] 
rustls: cap maximum allowed CRL file size to 8MB

Allowing 4GB on a 32-bit system is just asking for problems and could in
theory cause integer overflow in the dynbuf code.

The dynbuf now has an assert to catch code trying to set a max larger
than half SIZE_T_MAX.

Reported-by: Rinku Das
Closes #16716

5 months agodoh: remove wrong but unreachable exit path from doh_decode_rdata_name
Daniel Stenberg [Thu, 13 Mar 2025 22:28:42 +0000 (23:28 +0100)] 
doh: remove wrong but unreachable exit path from doh_decode_rdata_name

The condition could not happen, as the function is only called from a
single place where the caller already made sure it can't happen. This
change still removes the flawed logic.

Reported-by: Ronald Crane
Closes #16710

5 months agotool_setopt: reduce use of "code hiding" macros
Daniel Stenberg [Thu, 13 Mar 2025 14:23:17 +0000 (15:23 +0100)] 
tool_setopt: reduce use of "code hiding" macros

CODEx, DATAx, CLEANx, DECLx, REM3, CHKRET are all removed now.

Closes #16709

5 months agotool_setopt: simplify tool_setopt
Daniel Stenberg [Thu, 13 Mar 2025 14:09:15 +0000 (15:09 +0100)] 
tool_setopt: simplify tool_setopt

Since this is only used for object and function pointers now.

Closes #16709

5 months agoGHA/windows: replace OpenSSH-Windows-Prelease job with standard openssh
Viktor Szakats [Thu, 13 Mar 2025 02:06:09 +0000 (03:06 +0100)] 
GHA/windows: replace OpenSSH-Windows-Prelease job with standard openssh

After restricting OpenSSH-Windows to a single job, and bumping it to
the pre-release version, that job started hanging then timing out with
reasonable consistency.

Since we saw similar hangs before with OpenSSH-Windows stable, in all
jobs, drop OpenSSH-Windows from CI, and replace it with MSYS openssh.

After this patch, all Windows jobs use MSYS2 or Cygwin openssh.

Follow-up to 0ec72c1ef8d87a29bf2eaa5e36ab173147a4d015 #16672
Closes #16704

5 months agoGHA: fix configure disable options
Viktor Szakats [Thu, 13 Mar 2025 02:37:57 +0000 (03:37 +0100)] 
GHA: fix configure disable options

Linux AM openssl https-only:
```
configure: WARNING: unrecognized options: --disable-rtmp, --disable-scp, --disable-sftp
```
Ref: https://github.com/curl/curl/actions/runs/13823209634/job/38673119106#step:31:34

macOS AM clang !ssl HTTP-only:
```
configure: WARNING: unrecognized options: --disable-rtmp, --disable-scp, --disable-sftp, --without-ntlm-auth
```
Ref: https://github.com/curl/curl/actions/runs/13823209638/job/38673115560#step:7:54

Closes #16701

5 months agoresolve: fix building without Unix sockets and `CURLDEBUG`
Viktor Szakats [Thu, 13 Mar 2025 02:15:46 +0000 (03:15 +0100)] 
resolve: fix building without Unix sockets and `CURLDEBUG`

```
In file included from server_bundle.c:7:
../../../tests/server/resolve.c:110:5: error: unknown type name 'curl_socket_t'; did you mean 'curl_socklen_t'?
    curl_socket_t s = socket(PF_INET6, SOCK_DGRAM, 0);
    ^~~~~~~~~~~~~
    curl_socklen_t
../../../include/curl/system.h:392:38: note: 'curl_socklen_t' declared here
  typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
                                     ^
In file included from server_bundle.c:7:
../../../tests/server/resolve.c:111:13: error: use of undeclared identifier 'CURL_SOCKET_BAD'
    if(s == CURL_SOCKET_BAD)
            ^
```
Ref: https://github.com/curl/curl/actions/runs/13825438937/job/38679418428?pr=15000#step:14:47

Cherry-picked from #15000
Closes #16700

5 months agotests/server: sync memory callbacks with `lib/easy.c`
Viktor Szakats [Wed, 12 Mar 2025 16:55:52 +0000 (17:55 +0100)] 
tests/server: sync memory callbacks with `lib/easy.c`

Cherry-picked from #15000
Closes #16699

5 months agotests/server: do not redefine standard functions in `sockfilt`
Viktor Szakats [Tue, 11 Mar 2025 18:29:14 +0000 (19:29 +0100)] 
tests/server: do not redefine standard functions in `sockfilt`

Use a namespaced macro instead. To avoid confusion when other headers
also redefine these functions. And to improve readability by making it
apparent that the code sometimes overrides these functions.

Cherry-picked from #15000
Closes #16698

5 months agotests/server: drop unused headers
Viktor Szakats [Tue, 11 Mar 2025 08:04:42 +0000 (09:04 +0100)] 
tests/server: drop unused headers

Cherry-picked from #15000
Closes #16697

5 months agomemdebug.h: avoid `-Wredundant-decls` with an extra guard
Viktor Szakats [Wed, 12 Mar 2025 21:59:53 +0000 (22:59 +0100)] 
memdebug.h: avoid `-Wredundant-decls` with an extra guard

Add an extra guard for the function and variable declarations to avoid
redundant redeclaration warnings when including this header multiple
times. This can happen in unity builds when including it again after
`curl_memory.h`.

Fixes:
```
bld/tests/server/CMakeFiles/servers.dir/Unity/unity_0_c.c
In file included from lib/mprintf.c:32,
                 from bld/tests/server/CMakeFiles/servers.dir/Unity/unity_0_c.c:7:
lib/memdebug.h:52:14: error: redundant redeclaration of â€˜curl_dbg_logfile’ [-Werror=redundant-decls]
   52 | extern FILE *curl_dbg_logfile;
      |              ^~~~~~~~~~~~~~~~
In file included from tests/server/resolve.c:50,
                 from bld/tests/server/server_bundle.c:7,
                 from bld/tests/server/CMakeFiles/servers.dir/Unity/unity_0_c.c:4:
lib/memdebug.h:52:14: note: previous declaration of â€˜curl_dbg_logfile’ with type â€˜FILE *’
   52 | extern FILE *curl_dbg_logfile;
      |              ^~~~~~~~~~~~~~~~
[...]
lib/memdebug.h:110:17: error: redundant redeclaration of â€˜curl_dbg_fclose’ [-Werror=redundant-decls]
  110 | CURL_EXTERN int curl_dbg_fclose(FILE *file, int line, const char *source);
      |                 ^~~~~~~~~~~~~~~
lib/memdebug.h:110:17: note: previous declaration of â€˜curl_dbg_fclose’ with type â€˜int(FILE *, int,  const char *)’
  110 | CURL_EXTERN int curl_dbg_fclose(FILE *file, int line, const char *source);
      |                 ^~~~~~~~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/13822010778/job/38669360980#step:39:55

Cherry-picked from #15000
Closes #16696

5 months agocmake: unity mode optimization for non-`CURLDEBUG` `testdeps` targets
Viktor Szakats [Thu, 13 Mar 2025 00:20:52 +0000 (01:20 +0100)] 
cmake: unity mode optimization for non-`CURLDEBUG` `testdeps` targets

Include more sources in unity mode to optimize libtest and tests/server
builds for non-debug-enabled builds, syncing this pattern with `lib` and
`src`.

It reduces build steps from 62 to 47 (-14, -24%) with test bundles.
Without test bundles, from 680 to 642 (-38, -6%).

Follow-up to de0693f24943cd65f26a7b421a4304cbadb875a0 #16274
Follow-up to 3efba94f773db5d8ae19e33aa749ab7914cafeea #14765
Cherry-picked from #15000
Closes #16695

5 months agocookie: accept "high byte" cookie content
Daniel Stenberg [Thu, 13 Mar 2025 07:22:11 +0000 (08:22 +0100)] 
cookie: accept "high byte" cookie content

Regression from 597ee915c4c6da132dbd1735345 (not shipped in a release)
Reported-by: Carlos Henrique Lima Melara
Assisted-by: Scott Talbert
Added such a cookie to test 31.

Fixes #16692
Closes #16703

5 months agocore: stop redefining `E*` macros on Windows, map `EACCES`, related fixes
Viktor Szakats [Sat, 8 Mar 2025 01:18:35 +0000 (02:18 +0100)] 
core: stop redefining `E*` macros on Windows, map `EACCES`, related fixes

Before this patch, standard `E*` errno codes were redefined on Windows,
onto matching winsock2 `WSA*` error codes, which have different values.
This broke uses where using the `E*` value in non-socket context, or
other places expecting a POSIX `errno`, e.g. file I/O, threads, IDN or
interfacing with dependencies.

Fix it by introducing a curl-specific `SOCKE*` set of macros that map to
`WSA*` on Windows and standard POSIX codes on other platforms. Then
verify and update the code to use `SOCKE*` or `E*` macro depending on
context.

- Add `SOCKE*` macros that map to either winsock2 or POSIX error codes.
  And use them with `SOCKERRNO` or in contexts requiring
  platform-dependent socket error codes.

  This fixes `E*` uses which were supposed be POSIX values, not `WSA*`
  socket errors, on Windows:
  - lib/curl_multibyte.c
  - lib/curl_threads.c
  - lib/idn.c
  - lib/vtls/gtls.c
  - lib/vtls/rustls.c
  - src/tool_cb_wrt.c
  - src/tool_dirhie.c

- Ban `E*` codes having a `SOCKE*` mapping, via checksrc.
Authored-by: Daniel Stenberg
- Add exceptions for `E*` codes used in file I/O, or other contexts
  requiring POSIX error codes.

Also:
- ftp: fix missing `SOCKEACCES` mapping for Windows.
- add `SOCKENOMEM` for `Curl_getaddrinfo()` via `asyn-thread.c`.
- tests/server/sockfilt: fix to set `SOCKERRNO` in local `select()`
  override on Windows.
- lib/inet_ntop: fix to return `WSAEINVAL` on Windows, where `ENOSPC` is
  used on other platforms. To simulate Windows' built-in `inet_ntop()`,
  as tested on a Win10 machine.
  Note:
  - WINE returns `STATUS_INVALID_PARAMETER` = `0xC000000D`.
  - Microsoft documentation says it returns `WSA_INVALID_PARAMETER`
    (= `ERROR_INVALID_PARAMETER`) 87:
    https://learn.microsoft.com/windows/win32/api/ws2tcpip/nf-ws2tcpip-inet_ntop#return-value
- lib/inet_ntop: drop redundant `CURL_SETERRNO(ENOSPC)`.
  `inet_ntop4()` already sets it before returning `NULL`.
- replace stray `WSAEWOULDBLOCK` with `USE_WINSOCK` macro to detect
  winsock2.
- move existing `SOCKE*` mappings from `tests/server` to
  `curl_setup_once.h`.
- add missing `EINTR`, `EINVAL` constants for WinCE.

Follow-up to abf80aae384319ef9b19ffbd0d69a1fbe7421f1f #16612
Follow-up to d69425ed7d0918aceddd96048b146a9df85638ec #16615
Bug: https://github.com/curl/curl/pull/16553#issuecomment-2704679377

Closes #16621

5 months agobase64: drop `BUILDING_CURL` macro, always include in tests/server
Viktor Szakats [Wed, 12 Mar 2025 18:39:06 +0000 (19:39 +0100)] 
base64: drop `BUILDING_CURL` macro, always include in tests/server

Before this patch, building tests/server (or curl with winbuild) was
broken in rare builds when many features were explicitly disabled.

Fix it by enabling base64 functions unconditionally when building
for anything other than libcurl.

Closes #16691

5 months agontlm: merge ntlm.h into ntlm.c
Viktor Szakats [Wed, 12 Mar 2025 18:49:46 +0000 (19:49 +0100)] 
ntlm: merge ntlm.h into ntlm.c

It's the only user since dropping NTLM_WB support.

Follow-up to 50def7c881ba560ab6e0235990e8f07fa69f4bc8 #13249

Closes #16690

5 months agobuild: replace Curl_ prefix with curlx_ for functions used in servers
Viktor Szakats [Wed, 12 Mar 2025 14:36:47 +0000 (15:36 +0100)] 
build: replace Curl_ prefix with curlx_ for functions used in servers

Closes #16689

5 months agoruntests: enable the --libcurl feature by default
Daniel Stenberg [Wed, 12 Mar 2025 22:21:05 +0000 (23:21 +0100)] 
runtests: enable the --libcurl feature by default

Follow-up to a14eb26a585e67309066ac8a2
Reported-by: Viktor Szakats
Fixes #16693
Closes #16694

5 months agomulti: call protocol handler done() if PROTOCONNECT or later
Daniel Stenberg [Wed, 12 Mar 2025 10:22:49 +0000 (11:22 +0100)] 
multi: call protocol handler done() if PROTOCONNECT or later

The protocol handlers' done() function would previous get called
unconditionally in multi_done(), no matter how far the easy handle's
state machine has transitioned.

This caused problems in IMAP which in imap_connect() initializes things
that the imap_done() function assumes has occured. I think that seems
like a correct assumption and we should rather make sure that the done()
function is only called if we have reached the PROTOCONNECT state.

This problem was found using OSS-Fuzz.

Assisted-by: Catena cyber
Closes #16681

5 months agocurl: fix --cert parameter clearing
Stefan Eissing [Wed, 12 Mar 2025 13:42:19 +0000 (14:42 +0100)] 
curl: fix --cert parameter clearing

Blank the argument *after* it has been copied.

Reported-by: Jan Macku
Fixes #16686
Closes #16688

5 months agoGHA: do a build-only without the --libcurl option enabled
Daniel Stenberg [Wed, 12 Mar 2025 10:31:59 +0000 (11:31 +0100)] 
GHA: do a build-only without the --libcurl option enabled

Closes #16682

5 months agotests: make --libcurl tests require the --libcurl feature
Daniel Stenberg [Wed, 12 Mar 2025 13:58:41 +0000 (14:58 +0100)] 
tests: make --libcurl tests require the --libcurl feature

Closes #16682

5 months agosrc: remove final uses of Curl_ symbol prefixes in tool code
Daniel Stenberg [Wed, 12 Mar 2025 08:03:45 +0000 (09:03 +0100)] 
src: remove final uses of Curl_ symbol prefixes in tool code

Closes #16678

5 months agomanagen: accept more markdown-quote-markers
Daniel Stenberg [Wed, 12 Mar 2025 12:09:30 +0000 (13:09 +0100)] 
managen: accept more markdown-quote-markers

Lines starting with ``` or ~~~ indicate start and end of a quoted
section.

Closes #16685

5 months agosendf: client reader line conversion: do not change data->state.infilesize
Stefan Eissing [Wed, 12 Mar 2025 10:31:21 +0000 (11:31 +0100)] 
sendf: client reader line conversion: do not change data->state.infilesize

The line conversion reader, added in crfl and prefer_ascii mode was
incrementing data->state.infilesize for every line end converted. This
results in the wrong size to start a retry of an upload.

Eliminate the increment and check upload size in FTP less precise when
conversions are done.

Bug: https://issues.oss-fuzz.com/issues/402476456

Closes #16683

5 months agotool_operate: fix build with --libcurl support disabled
Daniel Stenberg [Wed, 12 Mar 2025 10:35:35 +0000 (11:35 +0100)] 
tool_operate: fix build with --libcurl support disabled

A compiler warning for unused argument.

Reported-by: Marcel Raad
Closes #16684

5 months agoGHA/windows: change openssh server, non-debug-enabled MSVC job, other improvements
Viktor Szakats [Tue, 11 Mar 2025 13:13:07 +0000 (14:13 +0100)] 
GHA/windows: change openssh server, non-debug-enabled MSVC job, other improvements

MSVC:

- switch jobs to standard openssh server. Reduce exceptions.
- make the SCP/SFTP ignore list more specific and comment with details.
- keep using OpenSSH-Windows for the OpenSSL job, and bump to the
  prerelease version.
- disable `ENABLE_DEBUG` for BoringSSL to have such build tested. (This
  is the first Windows non-ENABLE_DEBUG build with test runs.)

Takeaways:

- test 612 broken on Windows.
- test 613 broken on Windows with the standard openssh server.
- test 614 broken with libssh and OpenSSH-Windows.
- test 3022 broken with libssh2 and OpenSSH-Windows.
- tests broken with OpenSSH-Windows:
  601 603 617 619 621 641 665 2004.
- vcpkg `libssh2[core,zlib]` broken due to:
  curl: (67) Authentication failure

MSVC prep steps:

- install base msys2 package to simplify configuration, align with other
  jobs and allow to use msys2 packages for tests.
- add support for msys2 openssh server. Keep OpenSSH-Windows as per-job
  option. Add support for OpenSSH prerelease versions.
  Prerelease does not make a difference in test results, but, stable was
  last updated in 2019 (v8.0.0.1) and it seems better to use maintained
  release track, with its latest from April 2024 (v9.5.0).
  https://community.chocolatey.org/packages/openssh/8.0.0.1
  https://community.chocolatey.org/packages/openssh
  https://github.com/PowerShell/Win32-OpenSSH
  https://github.com/PowerShell/openssh-portable
- add 'libssh' to its job name.
- make `ENABLE_DEBUG` a per-job option.

msys/mingw:

- install `openssh` later and only when necessary.
- downgrade msys2 runtime later. (to follow other jobs)
- disable `CheckSpace` earlier. Also to untie it from the runtime
  downgrade step, which we would hopefully drop.

Closes #16672

5 months agocurltime: use libcurl time functions in src and tests/server
Viktor Szakats [Sun, 9 Mar 2025 12:14:31 +0000 (13:14 +0100)] 
curltime: use libcurl time functions in src and tests/server

The curl tool and tests/server used 2 parallel implementations
of libcurl's `Curl_now()` and `Curl_timediff()` functions.

Make them use the libcurl one.

Closes #16653

5 months agomulti: kill off remaining internal handles in curl_multi_cleanup
Daniel Stenberg [Tue, 11 Mar 2025 16:40:21 +0000 (17:40 +0100)] 
multi: kill off remaining internal handles in curl_multi_cleanup

- if there are pending internal handles left in the list, they are
  leftovers (from for example Doh) and must be freed.

- unlink_all_msgsent_handles() did not properly move all msgsent
  handles over to the process list as intended

Fixes a DoH memory leak found by oss-fuzz.

Add test 2101 that can reproduce and verify.

Closes #16674

5 months agocurl_setup: drop `ERANGE` (for WinCE), no longer used
Viktor Szakats [Tue, 11 Mar 2025 15:10:18 +0000 (16:10 +0100)] 
curl_setup: drop `ERANGE` (for WinCE), no longer used

Follow-up to 29ed1f9834047887a232423e715b0f2b72d744e9 #16671

Closes #16673

5 months agotests/server: use `curlx_str_numblanks()` to avoid `errno`
Viktor Szakats [Tue, 11 Mar 2025 10:09:43 +0000 (11:09 +0100)] 
tests/server: use `curlx_str_numblanks()` to avoid `errno`

Replacing `strtoul()` calls and glue code.

Closes #16671

5 months agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 11 Mar 2025 15:02:18 +0000 (16:02 +0100)] 
RELEASE-NOTES: synced

5 months agocurl: add my_setopt_long() and _offt()
Daniel Stenberg [Tue, 11 Mar 2025 09:34:47 +0000 (10:34 +0100)] 
curl: add my_setopt_long() and _offt()

Two new dedicated functions for setting long and curl_off_t options with
curl_easy_setopt(). These make it easier to make sure we pass on the
right option (types) so that the --libcurl code also gets right.

Corrected a few errors.

Closes #16669

5 months agowolfssh: fix freeing of resources in disconnect
Stefan Eissing [Tue, 11 Mar 2025 09:04:50 +0000 (10:04 +0100)] 
wolfssh: fix freeing of resources in disconnect

ssh's disconnect assumed that the session to the server could be
shut down successfully during disconnect. When this failed, e.g.
timed out, memory was leaked.

Closes #16668

5 months agotest489: set output dir
Stefan Eissing [Tue, 11 Mar 2025 11:13:13 +0000 (12:13 +0100)] 
test489: set output dir

Set output dir to %LOGIDR so that generated files are ignored by git.

Closes #16670

5 months agotftpd: prefix TFTP protocol error `E*` constants with `TFTP_`
Viktor Szakats [Fri, 7 Mar 2025 17:24:43 +0000 (18:24 +0100)] 
tftpd: prefix TFTP protocol error `E*` constants with `TFTP_`

To avoid mistaking them for `errno` error codes.

Closes #16666

5 months agoGHA: enable OpenSSL QUIC in a macOS and MinGW job
Viktor Szakats [Tue, 11 Mar 2025 00:16:11 +0000 (01:16 +0100)] 
GHA: enable OpenSSL QUIC in a macOS and MinGW job

Closes #16665

5 months agotool_operate: fix a stray Curl_ symbol use
Daniel Stenberg [Mon, 10 Mar 2025 22:05:49 +0000 (23:05 +0100)] 
tool_operate: fix a stray Curl_ symbol use

5 months agosrc: s/Curl_safefree/curlx_safefree
Daniel Stenberg [Mon, 10 Mar 2025 22:03:09 +0000 (23:03 +0100)] 
src: s/Curl_safefree/curlx_safefree

Towards using curlx_ prefix for all libcurl code that is used in the
tool outside of the "real" API.

Closes #16664

5 months agocurl_memrchr: enable in all builds
Daniel Stenberg [Mon, 10 Mar 2025 21:41:15 +0000 (22:41 +0100)] 
curl_memrchr: enable in all builds

It is used in the URL parser since bc24c60512

Reported-by: Justin Steventon
Fixes #16661
Closes #16663

5 months agosrc: use curlx_dyn_ prefix, not Curl_dyn_
Daniel Stenberg [Mon, 10 Mar 2025 15:57:42 +0000 (16:57 +0100)] 
src: use curlx_dyn_ prefix, not Curl_dyn_

Closes #16658

5 months agosrc: remove Curl_ prefix from tool-specific function
Daniel Stenberg [Mon, 10 Mar 2025 15:54:16 +0000 (16:54 +0100)] 
src: remove Curl_ prefix from tool-specific function

Since that's a prefix we use for library-private functions

Curl_execpath is now tool_execpath

Closes #16657

5 months agolibssh: fix freeing of resources in disconnect
Stefan Eissing [Mon, 10 Mar 2025 16:08:57 +0000 (17:08 +0100)] 
libssh: fix freeing of resources in disconnect

ssh's disconnect assumed that the session to the server could be shut
down successfully during disconnect. When this failed, e.g. timed out,
memory was leaked.

Closes #16659

5 months agolibssh2: fix freeing of resources in disconnect
Stefan Eissing [Mon, 10 Mar 2025 15:34:10 +0000 (16:34 +0100)] 
libssh2: fix freeing of resources in disconnect

ssh's disconnect assumed that the session to the server could be shut
down successfully during disconnect. When this failed, e.g. timed out,
memory was leaked.

Closes #16656

5 months agobuild: enable `-Wcast-qual`, fix or silence compiler warnings
Viktor Szakats [Fri, 31 Jan 2025 22:20:46 +0000 (23:20 +0100)] 
build: enable `-Wcast-qual`, fix or silence compiler warnings

The issues found fell into these categories, with the applied fixes:

- const was accidentally stripped.
  Adjust code to not cast or cast with const.

- const/volatile missing from arguments, local variables.
  Constify arguments or variables, adjust/delete casts. Small code
  changes in a few places.

- const must be stripped because an API dependency requires it.
  Strip `const` with `CURL_UNCONST()` macro to silence the warning out
  of our control. These happen at API boundaries. Sometimes they depend
  on dependency version, which this patch handles as necessary. Also
  enable const support for the zlib API, using `ZLIB_CONST`. Supported
  by zlib 1.2.5.2 and newer.

- const must be stripped because a curl API requires it.
  Strip `const` with `CURL_UNCONST()` macro to silence the warning out
  of our immediate control. For example we promise to send a non-const
  argument to a callback, though the data is const internally.

- other cases where we may avoid const stripping by code changes.
  Also silenced with `CURL_UNCONST()`.

- there are 3 places where `CURL_UNCONST()` is cast again to const.
  To silence this type of warning:
  ```
  lib/vquic/curl_osslq.c:1015:29: error: to be safe all intermediate
    pointers in cast from 'unsigned char **' to 'const unsigned char **'
    must be 'const' qualified [-Werror=cast-qual]
  lib/cf-socket.c:734:32: error: to be safe all intermediate pointers in
    cast from 'char **' to 'const char **' must be 'const' qualified
    [-Werror=cast-qual]
  ```
  There may be a better solution, but I couldn't find it.

These cases are handled in separate subcommits, but without further
markup.

If you see a `-Wcast-qual` warning in curl, we appreciate your report
about it.

Closes #16142

5 months agoDISABLED: add 313 for sectransp (move from GHA/macos)
Viktor Szakats [Mon, 10 Mar 2025 18:26:40 +0000 (19:26 +0100)] 
DISABLED: add 313 for sectransp (move from GHA/macos)

Closes #16660

5 months agotidy-up: replace `Curl_safefree` with `free` before re-assignment
Viktor Szakats [Sun, 9 Mar 2025 23:31:20 +0000 (00:31 +0100)] 
tidy-up: replace `Curl_safefree` with `free` before re-assignment

Also drop `NULL` assignments after `Curl_safefree()`.

Closes #16640

5 months agolibssh: fix scp large file upload for 32-bit size_t systems
Jay Satiro [Mon, 10 Mar 2025 02:20:01 +0000 (22:20 -0400)] 
libssh: fix scp large file upload for 32-bit size_t systems

- Use ssh_scp_push_file64 instead of ssh_scp_push_file.

The former uses uint64_t for file size and the latter uses size_t which
may be 32-bit.

Ref: https://github.com/curl/curl/pull/16194

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

5 months agourlapi: treat 0 alone as decimal number in IPv4 address
Daniel Stenberg [Mon, 10 Mar 2025 12:42:42 +0000 (13:42 +0100)] 
urlapi: treat 0 alone as decimal number in IPv4 address

Not as a broken octcal. Regression from b4538ec522

Extended test 1560 to verify this behavior.

Reported-by: Carlos Henrique Lima Melara
Closes #16652

5 months agotidy-up: whitespace, tests/server Makefile.inc, timeval in VS project
Viktor Szakats [Sat, 8 Mar 2025 22:32:10 +0000 (23:32 +0100)] 
tidy-up: whitespace, tests/server Makefile.inc, timeval in VS project

- VS projects: drop unused `timediff`.
  (used by curltool library, but this build method doesn't build that.)
- tests/server/sws: reflow an `if` for greppability.
- tests/server/Makefile.inc: indent, format
- tests/server/Makefile.inc: merge `USEFUL` and `UTIL` lists.

Closes #16651

5 months agohostip: don't use alarm() for DoH resolves
Daniel Stenberg [Mon, 10 Mar 2025 11:02:58 +0000 (12:02 +0100)] 
hostip: don't use alarm() for DoH resolves

When built to use the synch resolver and DoH is used for a transfer, do
not use alarm() for timeout since DoH resolving is not blocking.

Closes #16649

5 months agolib: clear up CURLRES_ASYNCH vs USE_CURL_ASYNC use
Daniel Stenberg [Mon, 10 Mar 2025 10:55:01 +0000 (11:55 +0100)] 
lib: clear up CURLRES_ASYNCH vs USE_CURL_ASYNC use

CURLRES_ASYNCH - is for when built to use an async name resolver; threaded or
c-ares

USE_CURL_ASYNC - is for when built to use either an async name resolver OR DoH

Reported-by: Lars Karlitski
Fixes #16645
Closes #16648

5 months agosocks: remove bad assert from do_SOCKS5()
Daniel Stenberg [Mon, 10 Mar 2025 11:09:00 +0000 (12:09 +0100)] 
socks: remove bad assert from do_SOCKS5()

It verified the auth bits wrongly. We don't need this assert anymore
since the input is verified in *setopt().

Bug: https://issues.oss-fuzz.com/issues/401869346

Closes #16650

5 months agoSTRPARSE: amend with recently added functions
Daniel Stenberg [Mon, 10 Mar 2025 08:54:37 +0000 (09:54 +0100)] 
STRPARSE: amend with recently added functions

Closes #16647

5 months agolib: rename curlx_strtoofft to Curl_str_numblanks()
Daniel Stenberg [Mon, 10 Mar 2025 07:12:05 +0000 (08:12 +0100)] 
lib: rename curlx_strtoofft to Curl_str_numblanks()

The function is no longer used via the curlx shortcut.

Remove the strtoofft.[ch] files.

Closes #16642

5 months agoeasy: fix warning about possible comma misuse
Christian Schmitz [Mon, 10 Mar 2025 08:22:22 +0000 (09:22 +0100)] 
easy: fix warning about possible comma misuse

Closes #16644

5 months agoconfigure: call the blocking resolver "blocking", not "default"
Daniel Stenberg [Mon, 10 Mar 2025 09:15:11 +0000 (10:15 +0100)] 
configure: call the blocking resolver "blocking", not "default"

On most systems the default is actually the threaded resolver.

Closes #16646

5 months agomprintf: switch three number parsers to use strparse
Daniel Stenberg [Sat, 8 Mar 2025 21:51:09 +0000 (22:51 +0100)] 
mprintf: switch three number parsers to use strparse

Also add more const char pointers and reduced the scope for some
variables.

Closes #16628

5 months agosrc: replace strto[u][ld] with curlx_str_ parsers
Daniel Stenberg [Sun, 9 Mar 2025 11:49:24 +0000 (12:49 +0100)] 
src: replace strto[u][ld] with curlx_str_ parsers

- Better error handling (no errno mess), better limit checks.

- Also removed all uses of curlx_strtoofft()

Closes #16634

5 months agoGHA/windows: enable H3 in GnuTLS MinGW job
Viktor Szakats [Sun, 9 Mar 2025 16:35:33 +0000 (17:35 +0100)] 
GHA/windows: enable H3 in GnuTLS MinGW job

Closes #16635

5 months agolibssh2: fix memory leak in `SSH_SFTP_REALPATH` state
Viktor Szakats [Sun, 9 Mar 2025 22:12:10 +0000 (23:12 +0100)] 
libssh2: fix memory leak in `SSH_SFTP_REALPATH` state

Seen in MSVC libssh2 CI job:
```
test 0615...[SFTP put remote failure]
test 0616...[SFTP retrieval of empty file]
test 0618...[SFTP retrieval of two files]
test 0620...[SFTP retrieval of missing file followed by good file]
test 0622...[SFTP put failure]
test 0637...[SFTP retrieval with invalid X- range]
test 0640...[SFTP --head retrieval]
  ** MEMORY FAILURE
  Leak detected: memory still allocated: 22 bytes
  At 2ae5b8a7ab8, there's 22 bytes.
   allocated by D:/a/curl/curl/lib/vssh/libssh2.c:2006
```
https://github.com/curl/curl/actions/runs/13752652590/job/38455575042?pr=16636#step:14:3907
https://github.com/curl/curl/actions/runs/13752879003/job/38456075461
https://github.com/curl/curl/actions/runs/13753706458/job/38457888479

Bug: https://github.com/curl/curl/pull/16636#issuecomment-2709086838
Co-authored-by: Daniel Stenberg
Closes #16639

5 months agoruntests: fix SSH server not starting in cases, re-ignore failing vcpkg CI jobs
Viktor Szakats [Sun, 9 Mar 2025 12:14:31 +0000 (13:14 +0100)] 
runtests: fix SSH server not starting in cases, re-ignore failing vcpkg CI jobs

Replace `Cwd::abs_path()` with `File::Spec->rel2abs()`. The former
requires the file to exist, but in some cases, it's missing.

Seen in MSVC vcpkg jobs using Chocolatey OpenSSH v8.0.0.1 ending up with
`$path=/d/a/curl/curl/bld/tests/log/3/server/ssh_server.pid`, which does
not exist while converting to an absolute path (the path is already
absolute, but the conversion is done unconditionally):
```
Use of uninitialized value in subroutine entry at D:/a/curl/curl/tests/pathhelp.pm line 128.
can't convert empty path at D:/a/curl/curl/tests/pathhelp.pm line 128.
```
Ref: https://github.com/curl/curl/actions/runs/13747741797/job/38444844173#step:14:1233 (master)
Ref: https://github.com/curl/curl/actions/runs/13751862952/job/38453816737#step:14:3185 (trace)

Also ignore 3 new libssh2 jobs failing due to memleak.

Partial revert of 1bd5ac998bbc943dbf812b2824ad0f532201734c #16570

Closes #16636

5 months agotests/server: sync `wait_ms()` with the libcurl implementation
Viktor Szakats [Sat, 8 Mar 2025 21:15:07 +0000 (22:15 +0100)] 
tests/server: sync `wait_ms()` with the libcurl implementation

It contains a series of bugfixes and updates applied to libcurl's
`Curl_wait_ms()` over the years, but missed from the copy in
`tests/server/util.c`:
d65321f93916e60f65b89d9bcb502341ea5c5939,
  52e822173aa3cd4f610531d32fbf943f026cdca6,
  5912da253b64de3cb2a1a229558077219b2c8a35
4a8f459837e2b7dc146825fc9a864045f7d1ae4a
1ad49feb71418f26aa6114c7a20ce1463beb3ea9

It fixes `wait_ms()` to check for, and return `SOCKERRNO`. Fixing error
handling on Windows.

Also:
- tests/server: change callers to check `SOCKERRNO`.
- `wait_ms()`: fix to check for the correct error code on Windows.
  Pending for `Curl_wait_ms()`: #16621.
- `Curl_wait_ms()`: tidy-up `Sleep()` argument cast (nit).
- lib/curl_trc: drop an unused header.

Closes #16627

5 months agotests/servers.pm: remove unused variable 'portrange'
Samuel Henrique [Sun, 9 Mar 2025 10:19:48 +0000 (10:19 +0000)] 
tests/servers.pm: remove unused variable 'portrange'

Its usage was dropped at 4efa0b5749bb7c366e1c3bda90650ef864d3978e
(https://github.com/curl/curl/pull/11220)

Grepping the tests folder for "portrange" returns only this as a result.

Closes #16632

5 months agolib2302: fix crash due to stack overflow on MSVC and clang Windows
Viktor Szakats [Sat, 8 Mar 2025 23:32:22 +0000 (00:32 +0100)] 
lib2302: fix crash due to stack overflow on MSVC and clang Windows

It fixes test 2302, 2303, 2307 with MSVC and clang on Windows.
GCC Windows builds were not affected.

Failure was caused by stack overflow due to a 1MB+ sized test struct on
stack. Replace it with dynamic allocation.

Also unignore affected tests in GHA/windows.

As seen under WINE with llvm-mingw:
```
$ wine64 libtests.exe lib2302 ws://127.0.0.1:59964/2302 > stdout2302 2> stderr2302
Test: lib2302
URL: ws://127.0.0.1:59964/2302
wine: Unhandled stack overflow at address 000000014007486A (thread 0024), starting debugger...
Unhandled exception: stack overflow in 64-bit code (0x000000014007486a).
```

Ref: #16629 (discovery)
Ref: 1bd5ac998bbc943dbf812b2824ad0f532201734c #16570

Closes #16630

5 months agoGHA/windows: add GnuTLS job, drop default OpenSSL for Cygwin/MSYS2 jobs
Viktor Szakats [Sat, 8 Mar 2025 23:01:17 +0000 (00:01 +0100)] 
GHA/windows: add GnuTLS job, drop default OpenSSL for Cygwin/MSYS2 jobs

To allow selecting the TLS backend(s) for each individual job.

Closes #16629

5 months agoGHA/windows: re-add GnuTLS for vcpkg, improve perf by building examples less
Viktor Szakats [Sat, 8 Mar 2025 02:31:45 +0000 (03:31 +0100)] 
GHA/windows: re-add GnuTLS for vcpkg, improve perf by building examples less

The GnuTLS MSVC/vcpkg build doesn't actually work on Windows. Let's
restore the build itself, to keep it fit for more testing. With disabled
tests (and examples) to keep it fast and not add to flakiness.

Also:
- enable GnuTLS in the MultiSSL job.
- limit building examples to one normal and one UWP job. It saves
  6 x 1-1.5 minutes. Coverage remains the same, because example builds
  only depend on the toolchain / target, not on the actual features
  (except IPv6, but that's enabled for all.)

Closes #16623

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

5 months agotest1022: add support for rc releases
Samuel Henrique [Sat, 8 Mar 2025 12:47:21 +0000 (12:47 +0000)] 
test1022: add support for rc releases

 Fix the following test failure:
 curl-config: illegal value

Closes #16626

5 months agogtls: fix uninitialized variable
Viktor Szakats [Sat, 8 Mar 2025 03:25:03 +0000 (04:25 +0100)] 
gtls: fix uninitialized variable

Fix uninitialized variable (warning by MSVC):
```
lib\vtls\gtls.c(1207,1): error C2220: the following warning is treated as an error
lib\vtls\gtls.c(1207,1): warning C4701: potentially uninitialized local variable 'result' used
```
Ref: https://github.com/curl/curl/actions/runs/13733139148/job/38413553053#step:9:31

Closes #16625

5 months agoGHA: update dependency cloudflare/quiche to v0.23.4
renovate[bot] [Fri, 7 Mar 2025 22:33:20 +0000 (22:33 +0000)] 
GHA: update dependency cloudflare/quiche to v0.23.4

Closes #16618

5 months agoRELEASE-PROCEDURE.md: explain release candidates
Daniel Stenberg [Sat, 8 Mar 2025 09:38:49 +0000 (10:38 +0100)] 
RELEASE-PROCEDURE.md: explain release candidates

Closes #16622

5 months agocurl_setup_once: stop redefining `ENAMETOOLONG` to winsock2 error code
Viktor Szakats [Sat, 8 Mar 2025 01:02:22 +0000 (02:02 +0100)] 
curl_setup_once: stop redefining `ENAMETOOLONG` to winsock2 error code

The only user is error display code following an `mkdir()` call. In this
case the redefinition didn't cause an issue, but was unnecessary.

Follow-up to d69425ed7d0918aceddd96048b146a9df85638ec #16615
Closes #16620