34918 Commits

Author SHA1 Message Date
Viktor Szakats
e61bbbd8fa
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
2025-03-17 23:20:23 +01:00
Aquila Macedo
912efa2d1c 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>
2025-03-17 11:15:32 -07:00
Stefan Eissing
c6c6ee2a92
tests: git ignore the bundle executables built
Closes #16749
2025-03-17 17:19:15 +01:00
Daniel Stenberg
8c21d0fe30
RELEASE-NOTES: synced 2025-03-17 16:45:23 +01:00
Viktor Szakats
391543f8c6
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
2025-03-17 15:48:08 +01:00
Viktor Szakats
6e5fa7094b
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
2025-03-17 02:06:23 +01:00
Viktor Szakats
a4e0063235
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
2025-03-17 02:06:23 +01:00
Viktor Szakats
f4f25505df
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
2025-03-16 14:02:08 +01:00
Viktor Szakats
d5b403074e
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
2025-03-16 14:02:08 +01:00
Viktor Szakats
4911e7af11
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
2025-03-16 00:09:22 +01:00
Viktor Szakats
6b143d9cc1
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
2025-03-15 23:01:12 +01:00
Stefan Eissing
ebce3f0c02
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
2025-03-15 21:49:38 +01:00
Viktor Szakats
d12129dda5
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
2025-03-14 23:08:22 +01:00
Viktor Szakats
f501d0d5e3
autotools: fix libtest bundle to depend on FIRSTFILES
Closes #16726
2025-03-14 20:50:19 +01:00
Daniel Stenberg
7d679f9ab6
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
2025-03-14 20:10:09 +01:00
Daniel Stenberg
5b6d3291b5
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
2025-03-14 17:59:05 +01:00
Daniel Stenberg
052bfd0a2d
libtest/lib2311: remove "extra" fclose()
Follow-up to 3588df9478d7c27046b34cdb5

Fixes #16721
Reported-by: Viktor Szakats
Closes #16722
2025-03-14 13:37:19 +01:00
Daniel Stenberg
179c0258f5
curl_ws_recv.md: expand a little on the fragments the API delivers
Closes #16720
2025-03-14 13:36:02 +01:00
Daniel Stenberg
e4fbc48a18
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
2025-03-14 13:34:15 +01:00
Viktor Szakats
d36f164e61
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
2025-03-14 13:27:46 +01:00
Viktor Szakats
a16485a42e
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
2025-03-14 12:59:32 +01:00
Viktor Szakats
43b2884655
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
2025-03-14 12:04:39 +01:00
Calvin Ruocco
3588df9478
ws: fix and extend CURLWS_CONT handling
Follow-up to fa3d1e7d43bf0e4f589aeae737

Add test 2311 to verify

Closes #16687
2025-03-14 11:46:36 +01:00
Viktor Szakats
c799f608f2
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
2025-03-14 10:38:28 +01:00
Viktor Szakats
63cf464793
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
2025-03-14 10:00:06 +01:00
Daniel Stenberg
af6ec8e430
RELEASE-NOTES: synced 2025-03-14 09:37:26 +01:00
Daniel Stenberg
116f490c81
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
2025-03-14 09:11:36 +01:00
Daniel Stenberg
27e07b2943
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
2025-03-14 09:09:25 +01:00
Daniel Stenberg
acdb48272a
tool_setopt: reduce use of "code hiding" macros
CODEx, DATAx, CLEANx, DECLx, REM3, CHKRET are all removed now.

Closes #16709
2025-03-13 17:25:33 +01:00
Daniel Stenberg
212f9a9742
tool_setopt: simplify tool_setopt
Since this is only used for object and function pointers now.

Closes #16709
2025-03-13 17:25:33 +01:00
Viktor Szakats
67a7775d12
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
2025-03-13 16:47:02 +01:00
Viktor Szakats
d4f9788593
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
2025-03-13 11:37:30 +01:00
Viktor Szakats
b70357c5f3
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
2025-03-13 11:36:54 +01:00
Viktor Szakats
533ba0089b
tests/server: sync memory callbacks with lib/easy.c
Cherry-picked from #15000
Closes #16699
2025-03-13 11:36:53 +01:00
Viktor Szakats
2283e40fc3
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
2025-03-13 11:36:53 +01:00
Viktor Szakats
91d061725e
tests/server: drop unused headers
Cherry-picked from #15000
Closes #16697
2025-03-13 11:36:53 +01:00
Viktor Szakats
44d4957a6f
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
2025-03-13 11:36:53 +01:00
Viktor Szakats
77401af485
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
2025-03-13 11:36:53 +01:00
Daniel Stenberg
5a26b901d4
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
2025-03-13 08:46:58 +01:00
Viktor Szakats
51d8213579
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
2025-03-13 00:03:25 +01:00
Viktor Szakats
c0a70c564d
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
2025-03-13 00:03:15 +01:00
Viktor Szakats
07f984a776
ntlm: merge ntlm.h into ntlm.c
It's the only user since dropping NTLM_WB support.

Follow-up to 50def7c881ba560ab6e0235990e8f07fa69f4bc8 #13249

Closes #16690
2025-03-13 00:03:15 +01:00
Viktor Szakats
ee73d553ed
build: replace Curl_ prefix with curlx_ for functions used in servers
Closes #16689
2025-03-13 00:03:15 +01:00
Daniel Stenberg
45ce0847f3
runtests: enable the --libcurl feature by default
Follow-up to a14eb26a585e67309066ac8a2
Reported-by: Viktor Szakats
Fixes #16693
Closes #16694
2025-03-12 23:41:40 +01:00
Daniel Stenberg
0bb8465b1e
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
2025-03-12 23:16:46 +01:00
Stefan Eissing
886569e2db
curl: fix --cert parameter clearing
Blank the argument *after* it has been copied.

Reported-by: Jan Macku
Fixes #16686
Closes #16688
2025-03-12 23:15:14 +01:00
Daniel Stenberg
5273ab4e6d
GHA: do a build-only without the --libcurl option enabled
Closes #16682
2025-03-12 15:23:25 +01:00
Daniel Stenberg
a14eb26a58
tests: make --libcurl tests require the --libcurl feature
Closes #16682
2025-03-12 15:23:20 +01:00
Daniel Stenberg
af3fe375b3
src: remove final uses of Curl_ symbol prefixes in tool code
Closes #16678
2025-03-12 14:37:08 +01:00
Daniel Stenberg
67a1cfa5ef
managen: accept more markdown-quote-markers
Lines starting with ``` or ~~~ indicate start and end of a quoted
section.

Closes #16685
2025-03-12 14:36:11 +01:00