16068 Commits

Author SHA1 Message Date
Viktor Szakats
aef128ef50 hostip: fix unreachable code in rare build configuration
with cmake options:
```
-DCMAKE_UNITY_BUILD=OFF -DCURL_DISABLE_HTTP=ON -DENABLE_THREADED_RESOLVER=OFF
```

Fixing (seen with Apple clang 17):
```
lib/hostip.c:939:16: error: code will never be executed [-Werror,-Wunreachable-code]
  940 |       *entry = dns;
      |                ^~~
```

Closes #20344
2026-01-18 12:45:39 +01:00
Daniel Stenberg
6aaac9dd38 vquic: drop support for OpenSSL-QUIC
- It is slower and uses more memory than the alternatives and is only
  experimental in curl.
- We disable a few tests for OpenSSL-QUIC because of flakiness
- It gets little attention from OpenSSL and we have no expectation of the
  major flaws getting corrected anytime soon.
- No one has spoken up for keeping it
- curl users building with vanilla OpenSSL can still use QUIC through the
  means of ngtcp2

Closes #20226
2026-01-17 22:49:34 +01:00
Daniel Stenberg
6c31df453b mqtt: initial support for MQTTS
Closes #19418
2026-01-17 22:43:36 +01:00
Viktor Szakats
1730407b74 windows: add build option to use the native CA store
With the same semantics as Apple SecTrust, in both libcurl and the curl
tool, when using non-Schannel TLS backends. In practice it means that
it makes TLS work without manually or implicitly configuring a CA bundle
`.crt` file, such as `curl-ca-bundle.crt`.

To enable:
- autotools: `--enable-ca-native`
- cmake: `-DCURL_CA_NATIVE=ON`
- CPPFLAGS: `-DCURL_CA_NATIVE`

When enabled:
- enables `CURLSSLOPT_NATIVE_CA` (libcurl) / `--ca-native`
  and `--proxy-ca-native` (curl tool) options by default.
- unsafe search for an on-disk CA bundle gets disabled by default.
  Equivalent to `--disable-ca-search` with autotools,
  `-DCURL_DISABLE_CA_SEARCH=ON` with CMake.
- build-time detection of CA bundle and CA path gets disabled. As with
  Apple SecTrust. This was already the default for Windows.
- native CA can be disabled at run-time with the `--no-ca-native`
  and/or `--no-proxy-ca-native` command-line options.

Rationale: This build option:
- has a repeat and active interest from packagers and users.
- helps integrating curl with Windows for those who need this.
- it also applies to macOS: #17525
  Shipped in curl 8.17.0.
- makes it trivial to use custom certs configured on the OS.
- frees applications/packagers/users from the task of securely
  distributing, and keeping up-to-date, a CA bundle.
- frees potentially many curl tool from configuring a CA bundle manually
  to access HTTPS (and other TLS) URLs. This is traditionally difficult
  on Windows because there is no concept of a universal, protected,
  non-world-writable, location on the file system to securely store
  a CA bundle.
- allows using modern features regardless of Windows version. Some of
  these features are not supported with Schannel (e.g. HTTP/3, ECH) on
  any Windows version.
- is necessary for HTTP/3 builds, where bootstrapping a CA bundle is not
  possible with Schannel, because MultiSSL is not an option, and HTTP/3
  is not supported with Schannel.

Ref: #16181 (previous attempt)
Ref: https://github.com/curl/curl/discussions/9348
Ref: https://github.com/curl/curl/issues/9350
Ref: https://github.com/curl/curl/pull/13111
Ref: https://github.com/microsoft/vcpkg/pull/46459#issuecomment-3162068701
Ref: 22652a5a4c #14582
Ref: eefd03c572 #18703

Closes #18279
2026-01-17 19:18:52 +01:00
Viktor Szakats
85c841cb45 msvc: drop exception, make BIT() a bitfield with Visual Studio
Add casts to `bool`, or use `bit` type in local variables, where
neccessary to avoid MSVC compiler warnings C4242.

Note: There may remain places needing the above updates, where not
tested in CI, and missed in manual review.

Also:
- urldata: convert struct field `connect_only` to bitfield to match its
  counterpart in another struct.
- rename curl-specific `bit` type to `curl_bit`.

Closes #20142
2026-01-17 11:46:31 +01:00
Viktor Szakats
57ff2d6c91 dns: flatten the include tree
Closes #20106
2026-01-17 11:45:18 +01:00
Viktor Szakats
b17ef873ae windows: bump minimum to Vista (from XP)
After this patch curl requires targeting Vista or newer, and a toolchain
with Vista support.

Supported MSVC compilers (VS2010+) all support Vista:
- VS2012+ target Win8 (or later) by default.
- VS2010 targets Win7 by default.

Supported mingw-w64 versions (v3+) all support Vista:
- mingw-w64 v9+ target Win10 by default.
- mingw-w64 v8 and older target Server 2003 (~XP) by default.
  After this patch it may be necessary to override the default Windows
  target version to Vista (or newer) via:
  autotools: `CPPFLAGS=-D_WIN32_WINNT=0x0600`
  cmake: `-DCURL_TARGET_WINDOWS_VERSION=0x0600`
- mingw-w64 v6+ allow changing the default at toolchain build-time.

Notes:
- For non-MSVC, non-mingw-w64 toolchains, `if_nametoindex` needs to be
  allowlisted in `curl_setup.h`, if they do support it.

Fixes #17985 (discussion)
Closes #18009
2026-01-17 11:41:49 +01:00
Stefan Eissing
6c8956c1cb socketpair: cleaner interface
Declutter the ifdefs in socketpair.h. Introduce Curl_wakeup_*()
function that encapsulate the details about how the socketpair
is implemented.

This moves the EVENTFD specials from the using code into socketpair
implemenatation, avoiding duplications in three places.

Closes #20340
2026-01-16 16:43:43 +01:00
Stefan Eissing
1a57302d1a ratelimit: download finetune
When a download size is known and rate limiting is in effect, adjust the
duration of each measurement step and its rate for maximum precision.

Since it is unpredictable how long the last bytes of a download will
take, download speed can be thrown off if the "last bytes" are a
significant amount of the total download. Make the "last bytes" small in
comparision to the rest and "stretch" the rate limit intervals to
accommodate the difference.

Fix ngtcp2 receive data acknowldgements to be based on a local window
size tracking. This allows window updates controlled by rate limits.

Fix ratelimit wait time calculation to accomodate negative tokens.

h3 rate limit, update timeers

Make download rate limits work correctly in ngtcp2. Fix multi handling
of rate limits to set a timer for when limits will update again.

Without running the transfer on limit updates, protocols like h2/h3 may
stall if the server does not send due to stream windows being too small.

scorecard: measure download speedlimits

When running scorecard with --limit-rate=n, show the reported download
speed averages plus percentage deviation from the limit.

Closes #20228
2026-01-16 16:42:31 +01:00
Daniel Stenberg
af274feabf lib: use STRCONST() when possible in curlx_strcopy() calls
Follow-up to a535be4ea0

Closes #20335
2026-01-16 10:55:10 +01:00
Daniel Stenberg
493e3d6166 hostip6: remove debug-only code
Introduced in 021e786c71. Not used these days.

Closes #20334
2026-01-16 10:52:02 +01:00
Daniel Stenberg
7755df3a48 mbedtls: remove newline from failf() call
Follow-up from 1dc6ddde06

Closes #20333
2026-01-16 08:35:34 +01:00
Daniel Stenberg
65714f8130 easy: fix build with --disable-form-api and --disable-mime
Follow-up to 44312b4b11

Closes #20332
2026-01-15 23:32:52 +01:00
Michał Antoniak
75c7d2aeba mbedtls: no pinnedpubkey wo MBEDTLS_SSL_KEEP_PEER_CERTIFICATE
Behavior similar to when MBEDTLS_PK_WRITE_C is not defined.

Closes #20319
2026-01-15 22:41:07 +01:00
calm329
de69e67793 imap: skip literals inside quoted strings
Fixes #20320
Closes #20322
2026-01-15 22:38:15 +01:00
Viktor Szakats
84ff0f6474 lib: fix two CURLDEBUG guards to be DEBUGBUILD
Both guard the use of `CURL_DNS_SERVER` debug env.

Follow-up to df2b4ccc22 #18157
Follow-up to 02e9690c3e #17015
Follow-up to 59dc9f7e69 #13718

Closes #20328
2026-01-15 13:08:19 +01:00
Viktor Szakats
ac6264366f tidy-up: miscellaneous
- tool_bname: scope an include.
- `endif` comments.
- Markdown fixes.
- comment tidy-ups.
- whitespace, newlines, indent.

Closes #20309
2026-01-15 13:06:13 +01:00
Viktor Szakats
82e0d387a2 build: drop more forward function declarations
Most by moving functions around. Also delete unused ones.
Reducing their number from 83 to 33.

Remaining ones due to:
- circular dependencies.
- H3 code, that I did not attempt to update and likely the above applies.
- static declarations with attributes (`CURL_PRINTF`, `WARN_UNUSED_RESULT`).
- OS400 code.

Closes #20321
2026-01-14 23:34:05 +01:00
Viktor Szakats
2623e333fd build: drop stray ifndef guards for local/internal macros
For:
- lib/vtls: `MAX_PINNED_PUBKEY_SIZE`.
- src: `UNPRINTABLE_CHAR`.
- tests/server/tftpd: `PKTSIZE`.

Closes #20314
2026-01-14 12:53:14 +01:00
Viktor Szakats
59a5fd8518 build: drop redundant unused variable suppressions
Also:
- digest_sspi: merge some `ifdef`s.

Closes #20310
2026-01-14 10:38:34 +01:00
Daniel Stenberg
134fb66121 digest: handle quotes in the path
- The 'uri' component needs to be escaped as well
- Rewrote the quote function to use dynbuf
- Build the digest at least partly with dynbuf
- Use goto as a general error mechanism
- Make test 64 use a double quote in the URL

Closes #20295
2026-01-14 09:57:00 +01:00
Viktor Szakats
4651d4c76b badwords: catch and fix more variants of NN-bit
Closes #20304
2026-01-14 02:35:00 +01:00
Viktor Szakats
7d9004ee47 build: drop duplicate C includes
- `stdlib.h` and `string.h` is included via `curl_setup_once.h`,
  allowing to drop from `tests/server` sources and `tool_doswin.c`.

- `stdlib.h` is also included via `setup-vms.h` (earlier than above),
  allowing to drop it from `curl_addrinfo.h` on VMS.

Closes #20303
2026-01-14 00:55:05 +01:00
Viktor Szakats
ea94afe318 ldap: silence potential unused variable warning (OS400)
Also:
- add `endif` comment.
- unfold a line.

Follow-up to 64350280d3 #20197

Closes #20302
2026-01-14 00:55:04 +01:00
Viktor Szakats
0431cbe71a build: globally suppress DJGPP warnings in FD_SET()
Replacing the many local `#pragma` used before this patch,
reducing the number of `__DJGPP__` guards from 58 to 13.

Closes #20299
2026-01-13 23:17:10 +01:00
Viktor Szakats
1593eeb264 mime: drop fallback for unused R_OK macro
Follow-up to fc81bf42be #13497

Closes #20298
2026-01-13 21:15:36 +01:00
Viktor Szakats
60f9d3dd7b build: omit forward declarations
- drop redundant forward declarations.
- reorder local functions to not need forward declarations.
- tftpd: merge two `ifdef` blocks.

Closes #20297
2026-01-13 21:15:36 +01:00
Viktor Szakats
df246eeb8f url.h: fix -Wdocumentation
Seen when testing `-Weverything`:
```
lib/url.h:84:11: warning: parameter 'nowp' not found in the function declaration [-Wdocumentation]
   84 |  * @param nowp      NULL or pointer to time being checked against.
      |           ^~~~
```

Follow-up to 2de22a00c7 #19961

Closes #20294
2026-01-13 18:13:33 +01:00
Viktor Szakats
60186cec78 openldap: avoid forward declarations in ldaps code
Follow-up to b85cb8cb4e #18485

Closes #20293
2026-01-13 18:13:32 +01:00
Viktor Szakats
c446ada2a6 md4, md5: drop redundant forward declarations
Closes #20291
2026-01-13 17:43:35 +01:00
Viktor Szakats
f6a83894eb lib: reorder protocol functions to avoid forward declarations (ssh)
Move protocol handler table to the end of sources, rearrange static
functions in reverse dependency order as necessary.

Closes #20290
2026-01-13 17:43:35 +01:00
Viktor Szakats
7d2c65e6ee lib: reorder protocol functions to avoid forward declarations (misc cont.)
For protocols: ldap, openldap, rtmp, rtsp, telnet

Move protocol handler table to the end of sources, rearrange static
functions in reverse dependency order as necessary.

Closes #20289
2026-01-13 17:43:34 +01:00
Viktor Szakats
060e479a19 imap: check imap_sendf() printf masks at compile-time
Closes #20287
2026-01-13 14:27:27 +01:00
Daniel Stenberg
db86f2de9b tftp: correct the filename length check
Reported-by: z2_
Bug: https://hackerone.com/reports/3508321
Closes #20283
2026-01-13 11:16:47 +01:00
Daniel Stenberg
8582ecf5bb setopt: split up setopt_long and setopt_cptr
- Split setopt_long() into multiple functions
  (setopt_long_bool/net/http/proxy/ssl/proto/misc) and dispatch them
  using a small function table

- Extract proxy string option handling into setopt_cptr_proxy() and call
  it early from setopt_cptr()

- Reorder options to simplify #ifdef blocks and reduce per-function size

- Updates code paths to return CURLE_UNKNOWN_OPTION from helper defaults
  so dispatching can continue cleanly

Closes #20280
2026-01-13 09:55:09 +01:00
Daniel Stenberg
f057ed05be checksrc: warn for leading spaces before the preprocessor hash
Fix the 40+ fallouts

Closes #20282
2026-01-13 09:52:26 +01:00
Daniel Stenberg
dac98ccfa2 mqtt: better too-big-message-check
Reported-by: gudyuu on hackerone
Reviewed-by: Daniel Gustafsson
Bug: https://hackerone.com/reports/3508500
Closes #20281
2026-01-13 09:46:49 +01:00
Viktor Szakats
9570d53b75 lib: reorder protocol functions to avoid forward declarations (ftp)
There remains 4 forward declarations.

Move protocol hander table to the end of sources, rearrange static
functions is reverse dependency order as possible.

Closes #20276
2026-01-13 01:31:27 +01:00
Viktor Szakats
2ded1e3c6e lib: reorder protocol functions to avoid forward declarations (email)
For protocols: imap, pop3, smtp.

Move protocol hander table to the end of sources, rearrange static
functions is reverse dependency order as necessary.

Closes #20275
2026-01-13 01:31:27 +01:00
Viktor Szakats
07926b5982 lib: reorder protocol functions to avoid forward declarations (misc)
For protocols: dict, file, gopher, tftp, http, mqtt, smb.

Move protocol hander table to the end of sources, rearrange static
functions is reverse dependency order as necessary.

Closes #20274
2026-01-13 01:31:27 +01:00
Viktor Szakats
3ee1d3b573 tidy-up: merge root packages directory into projects
To simplify the directory layout.

- OS400 and vms support move from `packages` to `projects`.

- Windows README and `generate.bat` files move from `projects`
  to `projects/Windows`.

Closes #20271
2026-01-12 23:49:35 +01:00
Patrick Monnerat
c326506115 rtsp: match connection_check procedure with required signature
Follow-up to e3691612ea

Closes #20265
2026-01-12 16:29:32 +01:00
Daniel Stenberg
44312b4b11 mimepost: allocate main struct on-demand
This makes the easy handle 432 bytes smaller (totally 5352 bytes on my
rather maximized Linux 64 bit build). The 440 byte mimepost struct is
now allocated only when needed.

Closes #20260
2026-01-12 16:21:02 +01:00
Daniel Stenberg
9e0b02c19c urldata: change 'keep_post' into three distinct bitfields
Closes #20262
2026-01-12 16:20:14 +01:00
Daniel Stenberg
31fbbb322e altsvc: only accept 17 byte dates from files
Since the date format is fixed there is no need to accept more data.

Update test355 to verify reject of too long date in alt-svc file

This test case was originally supposed to verify alt-svc loading from a
file but never did because it was done incorrectly.

Now it verifies that a too long date in the input file makes curl
disregard the entry.

Closes #20259
2026-01-12 13:49:57 +01:00
Daniel Stenberg
bd3b2a626a libssh: simplify myssh_statemach_act()
Reduce complexity by splitting out sub functions.

Made myssh_quote_error() to reduce code duplication.

Closes #20252
2026-01-11 23:28:54 +01:00
Daniel Stenberg
0596357584 wolfssl: fix build without USE_BIO_CHAIN
Reported-by: Megamouse on github
Fixes #20250
Closes #20251
2026-01-11 11:52:40 +01:00
Daniel Stenberg
2725d3cb85 altsvc: move logic from setopt into Curl_altsvc_ctrl()
To keep it all in one place.

Closes #20247
2026-01-11 10:44:43 +01:00
Viktor Szakats
bfacfb2355 plan9: drop special build and orphaned references
Would need 64-bit support.

Ref: https://github.com/curl/curl/pull/20233#issuecomment-3732556015
Follow-up to 0159100f4f #20233

Closes #20243
2026-01-10 23:03:17 +01:00
Daniel Stenberg
7433a6eb3f urldata: restore bitfield to unsigned int
Bug: https://github.com/curl/curl/pull/20209#pullrequestreview-3647160739

Reported-by: Patrick Monnerat
Follow-up to e3691612ea
Closes #20244
2026-01-10 22:42:05 +01:00