37678 Commits

Author SHA1 Message Date
Viktor Szakats
795433b923
cmake: enable binutils ld workaround for all toolchains at build-time
To make it available for GCC if used when consuming libcurl.

Also add comment to `curl-config.cmake` explaining why these odd targets
are defined there.

Bug: https://github.com/curl/curl/pull/20382#discussion_r2716660108
Follow-up to 3e841630ece59c04e26058a761302f38370fd0cc #20427
Follow-up to ef3101d1819928a7799309a16cc531818778e5c7 #20382
Follow-up to 16f073ef49f94412000218c9f6ad04e3fd7e4d01 #16973

Closes #20434
2026-01-25 22:37:56 +01:00
Viktor Szakats
3e841630ec
cmake: fix logic for openssl/zlib binutils ld workaround
While working #16973, the binutils ld lib order workaround logic
regressed so that it modified the wrong target, writing into the system
`ZLIB::ZLIB` and `OpenSSL::Crypto` ones a `INTERFACE_LINK_LIBRARIES`
property, instead of creating CURL-namespaced targets. Oddly enough,
this also fixed the binutils ld lib ordering issue. It seems this
property makes CMake insert each referenced library in two more
positions (not at the very end though), which allows ld to resolve all
symbols in the cases tested in CI.

Fix by creating the indented namespaced targets, and also creating
these in `curl-config.cmake` to be available when consuming libcurl.

Note that the logic continues doing `get_target_property()` on the two
system targets above. If these targets are defined manually and miss
the `LOCATION` propery, or are defined as aliases, this command may
fail. curl expects these targets be created by CMake's `FindZLIB` and
`FindOpenSSL` built-in Find modules (or ones compatible). Ref: #20419

The binutils ld issue is reproduced by these CI jobs:
 - Linux gcc glibc (amd64, arm64)
- Windows gcc zlib-classic (x64)

Currently using this curl-for-win revision:
7d12669daf
Examples:
https://github.com/curl/curl/actions/runs/21332437230/job/61399234023?pr=20427
https://github.com/curl/curl/actions/runs/21332437230/job/61399234033?pr=20427

Comparison of lib orders, as passed by CMake to the linker:

without workaround (possibly breaking binutils `ld`):
```diff
 -framework [...]
 libssl.dylib
 libcrypto.dylib
 libz.tbd
 -lssh2 -lidn2
 libldap.tbd
 liblber.tbd
 -lbrotlidec -lbrotlicommon -lzstd -lnghttp2 -lpsl -lrtmp
 -lz
 -lssl
 -lcrypto
```

before this patch:
```diff
 -framework [...]
 libssl.dylib
 libcrypto.dylib
 libz.tbd
+libcrypto.dylib <== inserted via `INTERFACE_LINK_LIBRARIES`
+libz.tbd        <== inserted via `INTERFACE_LINK_LIBRARIES`
 -lssh2 -lidn2
 libldap.tbd
 liblber.tbd
+libcrypto.dylib <== inserted via `INTERFACE_LINK_LIBRARIES`
+ibz.tbd         <== inserted via `INTERFACE_LINK_LIBRARIES`
 -lbrotlidec -lbrotlicommon -lzstd -lnghttp2 -lpsl -lrtmp
 -lz
 -lssl
 -lcrypto
```

after this patch:
```diff
 -framework [...]
 libssl.dylib
 libcrypto.dylib
 libz.tbd
 -lssh2 -lidn2
 libldap.tbd
 liblber.tbd
 -lbrotlidec -lbrotlicommon -lzstd -lnghttp2 -lpsl -lrtmp
 -lz
 -lssl
 -lcrypto
+libcrypto.dylib <== inserted via `CURL::OpenSSL_Crypto`
+libz.tbd        <== inserted via `CURL::ZLIB`
```

Bug: https://github.com/curl/curl/pull/20382#discussion_r2716660108
Reverts: 615c43eae8
Follow-up to 16f073ef49f94412000218c9f6ad04e3fd7e4d01 #16973

Closes #20427
2026-01-25 20:49:04 +01:00
Viktor Szakats
4516023152
GHA: switch 3 more small jobs to ubuntu-slim
Follow-up to 30c49db6f7ad64c6819181283fd0baff44815441 #20431

Closes #20433
2026-01-25 19:29:24 +01:00
Viktor Szakats
30c49db6f7
GHA: use ubuntu-slim image in 3 jobs
For small jobs using no parallelism, and which still use x64 for faster
`apt install`. x64 1-core (vs. 4), 5GB RAM (vs. 16), no Linuxbrew,
no arm64.

Refs:
https://docs.github.com/en/actions/reference/runners/github-hosted-runners
https://github.blog/changelog/2026-01-22-1-vcpu-linux-runner-now-generally-available-in-github-actions/
285cf722f0/images/ubuntu-slim/ubuntu-slim-Readme.md

Closes #20431
2026-01-25 18:54:12 +01:00
Daniel Stenberg
d0dc6e2ec0
tool: return code variable consistency
- ParameterError variables are named 'err'
- CURLcode variables are named 'result'

For naming consistency across functions

Closes #20426
2026-01-25 15:58:56 +01:00
Viktor Szakats
4e5908306a
build: constify memchr()/strchr()/etc result variables (cont.)
Assisted-by: Rudi Heitbaum
Fixes #20420
Follow-up to 7dc60bdb90c710c2e36b2d05aa3686ff491a9bbe #20425
Follow-up to 0e2507a3c65376d6bda860ff20bd94ada9bbb9fd #20421

Closes #20428
2026-01-25 14:20:37 +01:00
Viktor Szakats
6974bd7cc8
curlx: dedupe basename copies into curlx_basename()
Also stop redefining system `basename()` symbol. Call `curlx_basename()`
instead, and map that to `basename()` if available.

Closes #20424
2026-01-25 12:21:54 +01:00
Viktor Szakats
0e2507a3c6
build: constify memchr()/strchr()/etc result variables
And a few variables around.

There remain cases where the accepted pointer is const, yet the returned
pointer is written to.

Partly addressing (glibc 2.43):
```
* For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
  strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return
  pointers into their input arrays now have definitions as macros that
  return a pointer to a const-qualified type when the input argument is
  a pointer to a const-qualified type.
```
Ref: https://lists.gnu.org/archive/html/info-gnu/2026-01/msg00005.html

Reported-by: Rudi Heitbaum
Ref: #20420

Closes #20421
2026-01-25 12:21:54 +01:00
Daniel Stenberg
7dc60bdb90
noproxy: simplify, don't mix const non-const in strchr()
Ref: #20420
Closes #20425
2026-01-25 11:02:24 +01:00
Viktor Szakats
6f7ce1e45f
GHA: set --enable-option-checking=fatal where missing
Closes #20422
2026-01-25 04:54:16 +01:00
Dan Fandrich
c585282a1c docs: Update CodeSonar link 2026-01-24 13:24:37 -08:00
Viktor Szakats
64728418ff
GHA/codeql: improve perf on Windows, enable CURL_WERROR=ON, and more
- set `CURL_DROP_UNUSED=ON` for Windows (MSVC) to make the analysis step
  faster: 1m30s -> 1m15s

- enable `CURL_WERROR=ON` in all builds, to catch potential build issues
  in addition to running CodeQL. To make these builds useful as regular
  build tests too.

- add links to CodeQL Actions documentation.

- delete test data C files after checkout in an attempt to remove them
  from CodeQL code coverage stats.

Closes #20418
2026-01-24 13:10:26 +01:00
Viktor Szakats
3150ac7000
build: fix unused variables/values/code in non-verbose builds
Seen in GHA/codeql builds.

One of them also affected wolfSSL < 3.9.10 builds.

61093e2a819d26b7ddf309baef264b9e50c6c56f #20353
Cherry-picked from #20404
Closes #20417
2026-01-24 02:12:54 +01:00
Michał Antoniak
55ea2b424d setopt: fix checking range for CURLOPT_MAXCONNECTS
- Use upper limit INT_MAX instead of UINT_MAX.

UINT_MAX doesn't work as the max value for the variable since it is
passed as a long and becomes -1 on platforms that have same sized
int and long, like Windows.

Closes https://github.com/curl/curl/pull/20414
2026-01-23 16:30:09 -05:00
Viktor Szakats
7c3a4a4b4c
GHA/windows: install stunnel manually, enable for Cygwin
Replace Chocolatey install with direct download and unpack. To reduce
CI dependencies (Chocolatey, NuGet), improve install performance
(10s -> 1s) and hopefully reliability. Last but not least to enable it
for the Cygwin CI job.

Caveats:
- Need to bump stunnel versions manually (2-3 times a year).
  Renovate could likely do it, but I failed to understand its
  documentation and miss tooling/interface to make tests.
- FIPS not enabled. (can be done if necessary)
- Possibly losing checksum verification (not sure if Chocolatey did it
  automatically for this package.)

Also:
- Increase minimum tests by 100 for the Cygwin job.

Ref: #16819 (earlier attempt)
Ref: https://www.stunnel.org/archive/
Ref: https://www.githubstatus.com/incidents/cqb5hcy0gx18
Follow-up to d176f58a2003e4231c75f09813125c5a5bb26913 #20413
Follow-up to 19b1e44660d68d38a2f48f24740a3aac1d46b9a0 #20409

Closes #20410
2026-01-23 17:38:06 +01:00
Viktor Szakats
d176f58a20
runtests: pass config filename to stunnel in native format (Windows)
Fixing (Seen when enabling stunnel for Cygwin in CI):
```
=== Start of file https_stunnel.log
 [ ] Initializing inetd mode configuration
 [ ] Running on Windows 6.2
[...]
 [.] Reading configuration from file /cygdrive/d/a/curl/curl/bld/tests/log/6/server/https_stunnel.conf
 [!] Cannot open configuration file
```
Ref: https://github.com/curl/curl/actions/runs/21289677523/job/61279662459?pr=20410

Cherry-picked from #20410
Closes #20413
2026-01-23 16:51:47 +01:00
Viktor Szakats
bd1cd21caa
renovate: merge two custom regex rules, escape dots
There are no longer envs ending with `_VER` in Circle CI config.

Follow-up to 17a669426f36b467dfd945b4b35f6211598b7977 #17537

Closes #20412
2026-01-23 15:58:16 +01:00
Daniel Stenberg
c04ce3af0e
verbose.md: explain the { and } prefixes
The prefixes are now made as subtitles

Reported-by: Thibault de Villèle
Fixes #20386
Closes #20396
2026-01-23 14:34:44 +01:00
Viktor Szakats
55fc4e0dbb
cmake: sync two unix pre-fill comments with win32 [ci skip]
Cherry-picked from #20406
2026-01-23 13:16:19 +01:00
Viktor Szakats
19b1e44660
GHA/windows: fail CI early on stunnel install failure
Before this patch CI silently ignored stunnel install failures. This
pushed the failure to the test run step due to not meeting the minimum
number of tests.

Make the root cause obvious by failing early in this case.

Reported-by: Stefan Eissing
Follow-up to 3f1cd809eeae05f39fec72fe780f3a69d21972fb #19942
Ref: https://github.com/curl/curl/actions/runs/21245626382/job/61134101176?pr=20397
Ref: #16819

Closes #20409
2026-01-23 12:44:43 +01:00
Viktor Szakats
9bcdfb3809
GHA/distcheck: bump old cmake, switch to arm64 for performance
Bump CMake version in CMake integration tests for better performance
(8x on macOS, 2-3x on Windows) and native arm64 binaries.

- bump old CMake in integration tests to v3.19.8 (was: v3.11.4)
- switch to native arm64 CMake binaries on macOS.
- switch Linux CMake integration job to arm64.

Speed gains:
- Linux: 2m -> 1m30s
- macOS: 9-10m -> 1m15s
- Windows: 6-7m -> 2m43s

Before:
https://github.com/curl/curl/actions/runs/21255697172
https://github.com/curl/curl/actions/runs/21255020621

After:
https://github.com/curl/curl/actions/runs/21272021446

With this, CI is:
- no longer testing deprecated CMake versions.
  Follow-up to a7c974e038572bd1d4a653afbd6de5fad5a10215 #19902
- not testing the next (from 2026 April) minimum 3.18, but going for
  3.19 instead. For arm64 binaries on both macOS and Linux. There is
  no 3.18-specific CMake code in curl.

Cherry-picked from #20407
Closes #20408
2026-01-23 12:39:43 +01:00
Viktor Szakats
86190dccb3
GHA: migrate 3 linter jobs to arm64
Also to make them finish as fast or overall faster.

checkdocs/proselint:
before: https://github.com/curl/curl/actions/runs/21255607528/job/61169136666 22s
after: https://github.com/curl/curl/actions/runs/21266680535/job/61207470652?pr=20403 19s

checksrc/spellcheck, linters, REUSE:
before: https://github.com/curl/curl/actions/runs/21255607522/job/61169137076 3m11s
after: https://github.com/curl/curl/actions/runs/21266680282/job/61207475282?pr=20403 2m27s
typos: 13s -> 28s
pytype: 2m24s -> 1m24s

checksrc/misc checks:
before: https://github.com/curl/curl/actions/runs/21255607522/job/61169137176 2m29s
after: https://github.com/curl/curl/actions/runs/21266680282/job/61207475248?pr=20403 2m5s
shellcheck: seems larger and slower on arm64. 33 -> 45MB, 1s -> 3s
badwords: 2m1s -> 1m35s

Closes #20403
2026-01-22 23:44:47 +01:00
Viktor Szakats
b81341e8f5
tidy-up: Markdown, clang-format nits
- drop leading indent from Markdown.
- switch to Markdown section markers where missing.
- move `&&` and `||` to the end of the line (C, Perl).
- openssl: add parenthesis to an if sub-expression.
- misc clang-format nits.
- unfold Markdown links.
- SSL-PROBLEMS.md: drop stray half code-fence.

Closes #20402
2026-01-22 23:44:47 +01:00
Viktor Szakats
9e9adfddbf
GHA/linux: rename intel to intelc to avoid mixup with <pkg>-intel
To avoid unnecessarily installing Intel C for any `<pkg>-intel` locally
built dependency.

Follow-up to ab8ccaed2479bf7d019b3aa25f22299546e23828 #20392
Follow-up to d9fe60d4572bf82e407ae33277f81def896d06f2 #20248

Closes #20400
2026-01-22 18:42:46 +01:00
Viktor Szakats
ab8ccaed24
GHA/linux: move mbedTLS and wolfSSL valgrind jobs to arm64
For significantly better performance.

AM wolfssl-opensslextra valgrind 1:  6m53s -> 4m15s
AM wolfssl-opensslextra valgrind 2:  6m47s -> 4m25s
CM mbedtls gss valgrind 1:           8m33s -> 4m31s
CM mbedtls gss valgrind 2:           8m39s -> 4m34s
('after' times corrected for 'install prereq' differences)

before: https://github.com/curl/curl/actions/runs/21255607562
after: https://github.com/curl/curl/actions/runs/21257368016

Also tried rustls, but that'd require linux arm64 release binaries at:
https://github.com/rustls/rustls-ffi/releases

Closes #20392
2026-01-22 18:27:51 +01:00
Stefan Eissing
2a6ae3684e
socketpair: set SO_NOSIGPIPE where possible
Set SO_NOSIGPIPE on socketpair/inet-simulated socketpair
implementations. eventfd and pipe() do not need/want it.

Closes #20397
2026-01-22 17:18:16 +01:00
Kai Pastor
ef3101d181
cmake: always define CURL::win32_winsock on Windows in curl-config.cmake
The CMake config can be consumed by project which enable only language
`CXX`. `CMAKE_C_COMPILER_ID` isn't defined in this case, and the target
definition would be missing. But the check for compiler id isn't really
needed: The target is namespaced and valid, regardless of actual
compiler.

Noticed in https://github.com/microsoft/vcpkg/issues/49518, building cpr.

Follow-up to 16f073ef49f94412000218c9f6ad04e3fd7e4d01 #16973

Closes #20382
2026-01-22 17:10:48 +01:00
Viktor Szakats
66ad54e46b
cmake: add CURL_DROP_UNUSED option to reduce binary sizes
To enable known linker options dropping unused, dead, code and data from
the executables built.

Useful to reduce binary sizes for curl, libcurl shared lib and apps
linking static libcurl. It's effective on both "unity" and non-unity
builds. Aligning "unity" build sizes with default, non-unity ones.

Supported platforms: Apple, MSVC, llvm/clang and GCC on all tested
platforms: Linux, BSDs, Windows, MSYS2/Cygwin, Android, MS-DOS.

Notes:
- Static libraries grow 20-30% with non-Apple toolchains.
  This effect is controlled by separate, optional compiler flags on
  non-Apple. This patch enables them automatically for public binaries
  (libcurl and curl tool), and leaves them off for internal/test ones.
- MSVC enables this option by default for 'Release' configurations.
  The curl build option has no effect on it.
- Observed effect on VS2010 is negligible. VS2012+ is recommended.
- Works with LTO, Fil-C.
- No observed/conclusive effect on build speed.
- On Windows with clang/gcc (mingw-w64/MSYS2/Cygwin) it also enables
  `-fno-asynchronous-unwind-tables` as a workaround to make
  the toolchain options actually work.
  Ref: https://sourceware.org/bugzilla/show_bug.cgi?id=11539
  Thanks-to: Andarwinux

Also:
- GHA: enable in Linux and MinGW jobs to test it. Size changes:

  - linux aws-lc H3:
    curl: 2000000 -> 1937152, libcurl.a: 2065724 -> 2716532 bytes
  - macos clang HTTP-only:
    curl: 1364376 -> 128799 bytes, libcurl.a: unchanged
  - macos llvm MultiSSL:
    curl: 410056 -> 405720, libcurl.dylib: 1350336 -> 1348480 bytes
  - mingw schannel c-ares U:
    curl: 1588736 -> 1507328, libcurl-d.a: 3322040 -> 3884746 bytes
    bld: 34 -> 35MB

- GHA: enable in MSVC and Apple jobs to reduce disk footprint, with no
  obvious downside. Size changes:

  - AppVeyor CI VS2019:
    curl: 2339840 -> 1295872, libcurl-d.dll: 3155968 -> 1900544 bytes
    bld: 161 -> 97MB
  - AppVeyor CI VS2022 clang-cl:
    curl: 2933248 -> 2332160, libcurl-d.lib: 4762688 -> 5511330 bytes
    bld: 133 -> 121MB
  - AppVeyor CI VS2022 HTTP-only:
    curl: 3514368 -> 2177024, libcurl-d.lib: 2538420 -> 3151740 bytes
    bld: 137 -> 83MB
  - GHA intel:
    curl: 2629120 -> 2023424, libcurl-d.lib: 4366652 -> 5350670 bytes
    bld: 86 -> 69MB
  - GHA arm64:
    curl: 2832896 -> 2063872, libcurl-d.lib: 4690616 -> 5597250 bytes
    bld: 82 -> 66MB

Refs:
https://maskray.me/blog/2021-02-28-linker-garbage-collection
https://web.archive.org/web/20110811230637/msdn.microsoft.com/en-us/library/bxwfs976.aspx (VS2010)
https://learn.microsoft.com/cpp/build/reference/opt-optimizations
https://learn.microsoft.com/cpp/build/reference/gy-enable-function-level-linking

Closes #20357
2026-01-22 17:08:20 +01:00
Jacek Migacz
aacbe4d9bf
tool: enable header separation for HTTPS proxies
When using a proxy, --header specified headers were leaking into CONNECT
requests. This could break corporate proxies that reject custom
User-Agent headers in CONNECT.

Enable CURLHEADER_SEPARATE only for HTTPS through proxy or when
--proxytunnel is used, ensuring:

- --header affects only HTTP requests (not CONNECT)
- --proxy-header affects only CONNECT requests
- --user-agent affects both consistently

Fixes the redirect + proxy + custom UA issue while maintaining
compatibility with HTTP proxy scenarios.

Closes #20398
2026-01-22 16:51:34 +01:00
Daniel Stenberg
d89bc6b219
asyn-ares: abort with OOM error when Curl_dnscache_mk_entry fails
Closes #20385
2026-01-21 23:32:18 +01:00
Viktor Szakats
dfef594213
build: opt-in MSVC to C99-style verbose logging logic
MSVC does not advertise itself as C99 via `__STDC_VERSION__`, but
supports variadic macros in all curl-supported versions. Fix by
explicitly enabling C99 verbose string logic for MSVC.

With verbose logging enabled (default), this makes logging perform
better, on par with clang/gcc (and other C99) builds. (With the cost
of extra binary size.) With verbose logging disabled, it excludes all
verbose logging related strings and code from the binary. Before this
patch, MSVC used the C89 fallback code in both configs, which used
a fixed function call, with the called function deciding to actually
log or not, while also retaining the verbose log string in both configs.

Size comparison (bytes), schannel, static, debug, VS2022, local build:
curl-before-verbose.exe    4,024,832
curl-before-noverbose.exe  4,013,056
curl-after-verbose.exe     4,117,504
curl-after-noverbose.exe   3,928,064

In CI with non-verbose:
Before:
```
3274240 bytes: ./_bld/lib/Debug/libcurl-d.dll
```
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/53408629/job/htj7ps88q83ew9ww#L224

After:
```
3155968 bytes: ./_bld/lib/Debug/libcurl-d.dll
```
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/53408771/job/tp9epgjpef098vsr#L224

Idea-by: Arnav Purushotam
Ref: #20367
Ref: #20341
Follow-up to 61093e2a819d26b7ddf309baef264b9e50c6c56f #20353

Closes #20387
2026-01-21 21:01:46 +01:00
Viktor Szakats
41198e09b6
appveyor: simplify job configuration
Replace interim knobs with cmake options.

Also:
- use CMake env `CMAKE_GENERATOR` to select the generator.
  (with workaround to make it work with CMake <3.15.)
- deduct some configuration from the job name.
- drop unused test runner logic.
- drop obsolete `BUILD_OPT` use.
- tidy-up job names and sync them with GHA ones.
- add newline between job configurations for readability.

Closes #20390
2026-01-21 19:34:12 +01:00
Viktor Szakats
f24be5b36e
dynhds: drop duplicate includes
Already included via `dynhds.h`.

Closes #20389
2026-01-21 18:10:08 +01:00
Viktor Szakats
9996cab546
GHA: strip Windows/MS-DOS/Android binaries to see their real size
Unstripped size hides effective binary sizes due to the added debug
information. E.g. `--gc-sections` may inflate unstripped binaries, while
their unstripped size decreases. To see if binary size optimization
options work, it's more useful to observe unstripped size.

Ref: #20357
Follow-up to 4cf43508e8e60d0d8acef1beecb0f76040609543 #20355

Closes #20359
2026-01-21 16:05:17 +01:00
Viktor Szakats
59e3b693f7
windows: test non-verbose builds, fix fallouts
- schannel: fix mixed-up declaration. (originally fenced infof for
  verbose, then changed to failf with the fence kept, then fence
  removed and variable marked as verbose, when in fact it's not, but
  not tested and caught in CI.
- fix two other fallouts.
- GHA/windows: disable verbose strings in a mingw job.
- appveyor: disable verbose strings in an MSVC job.
- appveyor: add way to pass any CMake option per-job.

Cherry-picked from #20387
Follow-up to 61093e2a819d26b7ddf309baef264b9e50c6c56f #20353

Closes #20388
2026-01-21 15:25:40 +01:00
Viktor Szakats
61093e2a81
build: fully omit verbose strings and code when disabled
When the compiler supports C99.

- map logging functions to macro stubs when verbose logging is disabled
  and the compiler is C99. Make sure these stubs silence unused variable
  warnings for non-variadic arguments.
  Before this patch they mapped to function stubs, the same codepath
  used for C89 compiler in this configuration.

- introduce new macros to tell the compiler which code to include
  when verbose code is active, or inactive:

  - `CURLVERBOSE`: defined when verbose code is active.
    To enclose blocks of code only used for verbose logging.

  - `VERBOSE(statement);`:
    compile statement when verbose code is active.
    To mark code lines only used for verbose logging.

  - `NOVERBOSE(statement);`:
    compile statement when verbose code is inactive.
    To suppress warnings for arguments passed to logging functions via
    printf masks, e.g. `NOVERBOSE((void)ipaddress);`, yet keeping
    the warning in verbose builds.

  Note these macros are not the same as `CURL_DISABLE_VERBOSE_STRINGS`.
  Verbose code is always active in C89 mode (without variadic macro
  support).

- drop existing uses of `CURL_DISABLE_VERBOSE_STRINGS` where redundant,
  or replace with the above macros. Ending up reducing the number of
  `#ifdef`s, and also the number of lines.

Assisted-by: Daniel Stenberg
Assisted-by: Jay Satiro
Reported-by: Dan Fandrich
Fixes #20341
Refs: #12105 #12167

Closes #20353
2026-01-21 13:18:35 +01:00
Daniel Stenberg
e286589c71
multi: probe for IPv6 functionality in multi_init()
In some legacy systems IPv6 might dynamically work/not work and thus
curl needs to check/probe to see if it should indeed be used.

This change moves the probe that checks for working IPv6 to the multi
handle setup function instead of delaying it to when the first name
resolve is performed. This avoids a later tricky error path if the
socket cannot be created due to OOM.

Closes #20383
2026-01-21 09:38:31 +01:00
dEajL3kA
4890074e68 winapi: use FormatMessageA instead of FormatMessageW
Use FormatMessageA() to get the error message as multibyte-character
string (local codepage) directly, instead of using FormatMessageW()
and then convert the string from Unicode (UTF-16) to multi-byte (local
codepage) manually.

Prior to this change we used FormatMessageW + conversion because some
Windows CE did not have FormatMessageA. Since curl no longer supports
Windows CE, FormatMessageA can be used.

Closes https://github.com/curl/curl/pull/20261
2026-01-21 02:49:29 -05:00
Viktor Szakats
066ed13ca4
hostip: omit forward declaration of verbose logging function
Closes #20381
2026-01-21 04:09:11 +01:00
Viktor Szakats
246e95fe90
urldata.h: delete orphan forward declaration
Closes #20380
2026-01-21 04:09:10 +01:00
Viktor Szakats
e50aa46fb2
build: update to not need _CRT_NONSTDC_NO_DEPRECATE with MSVC
Use non-deprecated CRT function variants on Windows.

- introduce `curlx_fdopen()`, `curlx_close()` and use them. Map them to
  non-deprecated, underscored, CRT functions on Windows.

- replace `close()` uses with either `sclose()` (for sockets) or
  `curlx_close()` (for files).

- map `fileno`, `unlink`, `isatty` to their non-deprecated, underscored,
  versions on Windows.

- tool_dirhie: map `mkdir` to `_mkdir` on Windows.

- easy: use `_strdup()` on Windows, regardless of how `HAVE_STRDUP` is
  set.

- cmake: assume `HAVE_STRDUP` on Windows. To allow dropping a detection
  hack using `_CRT_NONSTDC_NO_DEPRECATE` with MSVC. Windows always has
  `_strdup()` which the code uses, but also needs `HAVE_STRDUP` defined
  to disable curl's own `strdup()` implementation.

- curl_setup.h: drop `_CRT_NONSTDC_NO_DEPRECATE` as no longer necessary.

Closes #20212
2026-01-20 23:19:54 +01:00
Viktor Szakats
dbc4603b09
CI: do not codespell RELEASE-NOTES
It contains names.

Reported-by: Daniel Stenberg
Fixes #20376
Revert 3e3d526c4ce4fea3c3a1b46bf55cc1b64fa10c5d
Follow-up to 5f5e000278df1029db2ee3f4499b5ce27c1861b2
Follow-up to 85cfc15601b19f13f1d480e6f7ba8922850429c3
Follow-up to 977595772c6e650b538da965cde676c9bc15cfd8
Follow-up to 0260e8465a2373b22588086acdfa5f4cf0e16e29 #17905

Closes #20378
2026-01-20 22:46:37 +01:00
Viktor Szakats
3e3d526c4c
codespell: ignore false positive found in RELEASE-NOTES 2026-01-20 17:56:45 +01:00
Daniel Stenberg
f8769845c8
config2setopts: acknowledge OOM error from CURLOPT_MIMEPOST
It should make curl exit. Found with "strict torture".

Closes #20375
2026-01-20 16:44:39 +01:00
Stefan Eissing
8ce16e7bf2
timeout handling: auto-detect effective timeout
When checking a transfer for being expired via `Curl_timeleft_ms()`,
eleminate the `bool connecting` parameter and have the function check
the `mstate` of the transfer instead.

Advantages:
* eleminate the caller needing awareness if the transfer is
  connecting or in a later state
* fix pingpong timeout handling to check the correct timeout
  during "proto_connect" phases
* avoid using "connecting" timeouts during establishing a secondary
  connection (e.g. FTP) since this would use the timestamp from
  the original, primary connect and thus be wrong

Reported-by: Wyuer on github
Fixes #20347
Closes #20354
2026-01-20 16:43:45 +01:00
renovate[bot]
3d354f55b7
GHA: update ngtcp2/ngtcp2 to v1.20.0
Closes #20372
2026-01-20 16:40:34 +01:00
renovate[bot]
677374d58b
GHA: update ngtcp2/nghttp3 to v1.15.0
Closes #20371
2026-01-20 16:39:45 +01:00
Stefan Eissing
3dd7f5890f
socket: check result of SO_NOSIGPIPE
New define USE_SO_NOSIGPIPE in curl_setup.h, for now set whenever
SO_NOSIGPIPE is defined. Maybe overridden in the future on systems where
this does not work.

With USE_SO_NOSIGPIPE defined, set SO_NOSIGPIPE on all sockets created
by libcurl and fail the creation when setsockopt() fails.

Closes #20370
2026-01-20 16:38:49 +01:00
Daniel Stenberg
0bef137fbd
RELEASE-NOTES: synced 2026-01-20 16:01:16 +01:00
Daniel Stenberg
3c957ad1fe
lib: use ISBLANK and ISNEWLINE more
Closes #20373
2026-01-20 15:36:52 +01:00