Commit graph

38696 commits

Author SHA1 Message Date
Daniel Stenberg
9107e8ba98
curl_easy_pause.md: rephrase the stream cache when pause clause
- mention HTTP/3
- it is 10 MB per stream these days

Closes #21658
2026-05-18 15:51:08 +02:00
Daniel Stenberg
7ca5f939c8
test1646: netrc parsing without user match but user in URL
Follow-up to 4ae1d7cc26
2026-05-18 15:19:22 +02:00
Stefan Eissing
4ae1d7cc26
netrc: scanner refactor
Refactor the netrc scanner. Add test case for checking that the last
matched machine with unmatched login does not return the password as
success (unit1304).

Closes #21624
2026-05-18 15:18:09 +02:00
Daniel Stenberg
5c1e017987
curl_easy_setopt.md: change options when no transfer runs
Underscore this. Changing them mid-transfer may cause problems.

Fixes #21604
Reported-by: Joshua Rogers
Closes #21657
2026-05-18 15:07:00 +02:00
Mark Esler
8a86fa13f3
vtls_scache: include signature_algorithms in the SSL peer cache key
Curl_ssl_peer_key_make() omitted ssl->signature_algorithms, although
match_ssl_primary_config() compares the field. Two handles differing
only in CURLOPT_SSL_SIGNATURE_ALGORITHMS therefore shared a peer key and
could resume each other's sessions across a shared CURLSH SSL session
cache.

Add :SIGALGS-%s next to the other ssl_primary_config fields.

Closes #21651
2026-05-18 13:59:11 +02:00
Viktor Szakats
a55750af0b
mk-unity.pl: #include, and not concatenate input headers
When using `-D_CURL_TESTS_CONCAT=ON` with CMake, do not concatenate
`first.h` (or any future header) into the output C file, but `#include`
it instead. This is to play nice with compilers and analyzers which may
apply different checker rules on logic found in headers, vs. the input
source file. As seen for example with `-Wunused-macro` enabled in CI.
After this patch concatenated sources behave closer to regular C
sources.

Also:
- first.h: drop some `-Wunused-macro` silencers that became redundant
  with this patch.

Follow-up to 47f411c6d8 #21554
Follow-up to 39542f0993 #20667

Closes #21656
2026-05-18 13:57:13 +02:00
Daniel Stenberg
240408a725
scripts/contri*: fix the Credits-to regex
On my suggestion, the regex turned up wrong when looking for Credits-to
in git logs. This adjustment allows the leading spaces.

Follow-up to 64adc43a6e

Closes #21655
2026-05-18 07:53:52 +02:00
Viktor Szakats
3c597ced16
cmake: fix three issues generating lib options in config files
- drop duplicate libs lists next to each other in `libcurl.pc`.
  Logic copied from libssh2.
  Fixing (seen in a local build):
  ```diff
  -Libs.private: -lssh2 -lz -lz -lldap -llber -lssl -lcrypto -lcrypto -lz -lbrotlidec -lbrotlicommon -lzstd -lnghttp2 -licucore -liconv -lpsl -lbacktrace
  +Libs.private: -lssh2 -lz -lldap -llber -lssl -lcrypto -lz -lbrotlidec -lbrotlicommon -lzstd -lnghttp2 -licucore -liconv -lpsl -lbacktrace
  ```
  Refs:
  e1da7b2cb8
  https://github.com/libssh2/libssh2/pull/1621
  6464301820
  https://github.com/libssh2/libssh2/pull/1131

- handle `$<LINK_ONLY:NAMESPACE::NAME>` references.
  Fixing (seen in a local build using libssh2 v1.11.2-DEV):
  ```diff
  -Libs.private: -lssh2 -l$<LINK_ONLY:OpenSSL::Crypto> -lz -lldap -llber [...]
  +Libs.private: -lssh2 -lcrypto -lz -lldap -llber [...]
  ```

- fix `-l-pthread` sneaking into `libcurl.pc`.
  Fixing (seen with Android):
  ```diff
  -Libs.private:  -lz -l-pthread
  +Libs.private: -pthread -lz
  ```
  Refs:
  2b65c20fc6/ports/curl/dependencies.patch (L631-L634)
  70b941a5d2 (diff-7f2c3b2f93cd3478671a603cbd5ef818c7c403a11dc25e1d3539e9b03495a5d3)
  Upstream-patch-by: Kai Pastor

Closes #21654
2026-05-17 22:48:22 +02:00
Viktor Szakats
64adc43a6e
scripts: catch Credits-to contributors
Also:
- THANKS: add Credits-to attribution missed earlier.

Closes #21653
2026-05-17 22:48:22 +02:00
Daniel Stenberg
e8c1023b00
connect: remove deref of freed pointer in trace call
Spotted by CodeSonar

Closes #21649
2026-05-17 14:20:19 +02:00
Daniel Stenberg
d74c0ada4e
urlapi: prevent a terminal .0x component to normalize IPv4
Extend test 1560 to verify

Follow-up to 831a151484

Spotted by Codex Security
Closes #21652
2026-05-17 14:19:26 +02:00
Viktor Szakats
7bde6cb9fc
build: omit zlib pkg-config reference for Android
In both autotools and cmake builds, because Android does not offer
a `zlib.pc`.

Also:
- GHA/non-native: dump config files, to verify.

Reported-by: sfan5 on github
Fixes #21647

Closes #21648
2026-05-17 13:27:06 +02:00
Daniel Stenberg
44ede0cc5a
url: remove superfluous check
This pointer is already verified to be non-NULL some 15 lines above.

Pointed out by CodeSonar
Closes #21650
2026-05-17 00:35:25 +02:00
Stefan Eissing
a0f08d6975
cf-h2-prox: fix peer leak
The unlinking of the new Curl_peer was happening too later after
the struct had been set to zero. Move the unlink to happen before
that.

Fixes #21602
Reported-by: Joshua Rogers
Closes #21627
2026-05-17 00:14:36 +02:00
Daniel Stenberg
061136f24b
RELEASE-NOTES: synced 2026-05-16 23:09:52 +02:00
Stefan Eissing
ad549c4641
unix-sockets: ignore proxy settings
Fix a recent regression: when a unix-socket is configured, all proxy
settings must be ignored. The `via_peer` had been checked correctly,
but the connections proxy bits were not cleared.

Add test_11_04 to verify.

Reported-by: Fabian Keil (libcurl mailing list)
Closes #21630
2026-05-16 18:49:46 +02:00
Viktor Szakats
535c575e31
lib678: fix to not be perma-skipped
Prior to this patch the test was always skipped due to failing precheck
with `CURLE_BAD_FUNCTION_ARGUMENT`, because of the zero-length blob
passed to setopt. Fix by passing a non-zero long dummy blob as done in
`mk-lib1521.pl`.

Fixing:
```
test 0678 SKIPPED: CURLOPT_CAINFO_BLOB is not supported
```

Follow-up to 956e1ae84f #20705

Closes #21641
2026-05-16 11:55:59 +02:00
Viktor Szakats
40c516f941
runner.pm: set CURL_TESTNUM for precheck commands
Closes #21640
2026-05-16 11:55:59 +02:00
Viktor Szakats
5688c2a8ee
SSLCERTS: document 8.19.0 default Native CA builds (Windows)
Ref: https://curl.se/docs/sslcerts.html

Follow-up to 1730407b74 #18279
Reported-by: chrizilla on github
Fixes #21634

Closes #21639
2026-05-16 11:55:59 +02:00
Viktor Szakats
c46a7913e5
setopt: fix to honor CURLOPT_PROXY_CAINFO_BLOB over Native CA
In AppleSecTrust or NativeCA-enabled builds, make sure override it when
setting a custom `CURLOPT_PROXY_CAINFO_BLOB`.

Reported-by: Joshua Rogers (Aisle Research)

Follow-up to 1730407b74 #18279
Follow-up to eefd03c572 #18703

Closes #21631
2026-05-16 11:55:59 +02:00
Viktor Szakats
3f8f725d97
schannel: enforce Extended Key Usage for custom CA roots
Reported-by: Joshua Rogers (Aisle Research)

Closes #21629
2026-05-16 11:55:59 +02:00
Tim Martin
d9514e3b92
docs: end "...can be used several times..." sentences with period
Closes #21644
2026-05-16 11:48:07 +02:00
Daniel Stenberg
f9b9d3b141
urlapi: handle redirect without set scheme with default-scheme
Verify in test 1921

Reported-by: mulan_dh on hackerone

Closes #21632
2026-05-16 11:46:16 +02:00
Daniel Stenberg
51beed175d
cookie: trim trailing dots when checking PSL
Verified with test 1629

Closes #21636
2026-05-16 11:24:28 +02:00
Viktor Szakats
614b94eecc
tidy-up: miscellaneous
- avoid "will" in builds scripts, scripts folder, curl_easy_ssls_export.md,
  and few other files.
- badwords: add "initialise", "nul terminated", "thread safety" and
  variations.
- prefer "null-terminat", where missing (two places).
- fix "null-terminat*" missing dash.
- hostip: merge two `#if` blocks.
- tool_doswin: fix comment
  Spotted by GitHub Code Quality
  Follow-up to 9a2663322c #17572
- fix stray spaces and newlines.

Closes #21638
2026-05-16 01:56:17 +02:00
Viktor Szakats
47f411c6d8
GHA: enable -Wunused-macros in clang-tidy jobs
Also fix fallouts found.

Windows clang-tidy CI job is a little pickier than I'd prefer due to the
`_CURL_TESTS_CONCAT=ON` option used there, and all macros considered
local, thus checked by the compiler. Upside: it revealed macro usage
dynamics in tests. If too annoying, `first.h` may be opted-out from the
concat logic. Some macros may also be deleted instead of `#if 0`-ing.

Follow-up to e0e56e9ae4 #21550
Follow-up to 5fa5cb3825 #20593

Closes #21554
2026-05-16 01:17:41 +02:00
jeffhuang
a15483c4ca
url: compare full origin when setting credentials
Closes #21575
2026-05-16 01:14:29 +02:00
Stefan Eissing
91dcf4e610
url: url_match_destination fix
Match origin/via_peer also for non-SSL schemes.

Closes #21573
2026-05-16 01:11:06 +02:00
Sergio Correia
61d59c9e39
x509asn1: fix DH public key parameter extraction
The dh(g) parameter was read from param->beg instead of from the
cursor p returned by parsing dh(p). This caused dh(g) to always
report the same value as dh(p) when inspecting DH certificates
via CURLOPT_CERTINFO on non-OpenSSL backends.

The DSA branch correctly advances the cursor; the DH branch lost
this during what appears to be a copy-paste.

Add unit1676 to verify that dh(p) and dh(g) report distinct values
using a hand-crafted minimal DER certificate.

Assisted by: Claude Opus 4.6
Signed-off-by: Sergio Correia <scorreia@redhat.com>
Closes #21595
2026-05-16 01:06:56 +02:00
Daniel Stenberg
d6571f7a70
setopt: more careful cleanup of the HSTS cache
Reported-by: Joshua Rogers
Closes #21615
2026-05-16 01:04:54 +02:00
Emanuel Krollmann
978ea5afec
KNOWN_BUGS.md: remove fixed x509asn.1 bug
KNOWN_BUGS.md contains an entry about a CURLE_OUT_OF_MEMORY
error on a CURLOPT_CERTINFO call when using Schannel.

This bug was fixed by 137a668e8c.

remove the entry from KNOWN_BUGS.md.

Ref: https://github.com/curl/curl/issues/8741#issuecomment-4445486705

Closes #21611
2026-05-16 01:03:16 +02:00
Stefan Eissing
12d6d8e26f
cf-h2-proxy: drop interim responses
Any 1xx response before the CONNECT final one can be dropped as no one
uses those in the HTTP/2 proxy filter. This eliminates a potential
memory exhaustion by the famous malicious server on the internet.

Closes #21626
2026-05-16 01:01:18 +02:00
Daniel Stenberg
60cd4815fd
CURLOPT_SSH_HOSTKEYFUNCTION.md: for new connections only
curl can then reuse the connection for subsequent transfers without
calling this function again.

Fixes #21606
Reported-by: Joshua Rogers
Closes #21628
2026-05-16 00:54:40 +02:00
Viktor Szakats
066478f634
src: add curlx_memzero() to clear buffers securely
To safely zero memory, introduce `curlx_memzero()`, and map it to
`memset_s()` (C11) or `memset_explicit()` (C23) if auto-detected, or
`explicit_bzero()` or `explicit_memset()` for platforms opted-in, or
fall back to a local workaround if all unavailable. On Windows, always
use `SecureZeroMemory()`, or `SecureZeroMemory2()` with Visual Studio
and Windows SDK 10.0.26100.0+.

Details above are experimental and may change if they cause issues.

Also add macros/functions that zero memory before freeing a buffer:
- `curlx_safefreezero()`: for buffers with size.
- `curlx_safefreezeroz()`: for null-terminated buffers.
- `curlx_freezero()`: for buffers with size.
- `curlx_freezeroz()`: for null-terminated buffers.

`curlx_memzero()` must not be passed a NULL pointer because in some
implementations it is undefined behavior.

Also:
- curl_sha512_256: Replace hard-wired `explicit_memset()` call with new
  `curlx_memzero()`.

Refs:
https://en.cppreference.com/c/string/byte/memset
https://man7.org/linux/man-pages/man3/explicit_bzero.3.html
https://man.freebsd.org/cgi/man.cgi?query=explicit_bzero
https://man.netbsd.org/NetBSD-7.2/explicit_memset.3
https://learn.microsoft.com/previous-versions/windows/desktop/legacy/aa366877(v=vs.85)
https://learn.microsoft.com/windows/win32/memory/winbase-securezeromemory2
https://learn.microsoft.com/cpp/overview/compiler-versions
https://learn.microsoft.com/windows/apps/windows-sdk/downloads
https://jtsoya539.github.io/windows-sdk-versions/

Credits-to: Daniel Gustafsson
Credits-to: Will Cosgrove and co-authors in libssh2
Ref: #13589 (original attempt)
Ref: #21588

Closes #21598
2026-05-16 00:26:46 +02:00
Daniel Stenberg
831a151484
urlapi: consume trailing dots after IPv4 numerical addresses
If the hostname is specified as an IPv4 numerical address and it is
followed by a single dot, acccept that as a valid IPv4 and remove the
dot when normalizing.

This prevents otherwise legitimate IPv4 hostnames to have trailing dots.
Seems to match what browsers do.

Extended test 1560 to verify.

Closes #21635
2026-05-15 23:38:50 +02:00
Stefan Eissing
aafbe089a8
CURLOPT_SHARE: warn about early remove
Add a warning to removing a SHARE from an EASY handle before it is
finished.

Closes #21633
2026-05-15 16:15:28 +02:00
Daniel Stenberg
a15cfeb100
cookie: compare path case sensitively
Verify with test 1645

Reported-by: Joshua Rogers
Closes #21616
2026-05-15 13:37:52 +02:00
Daniel Stenberg
71430e87fd
strparse: make curlx_str_until() accept zero for 'max'
When asked to parse for a string with max zero bytes, it will always
return error and no longer trigger an assert. This saves the caller from
having to check for this condition.

Closes #21600
2026-05-15 13:28:03 +02:00
Viktor Szakats
de28c9cfad
rustls: drop two wrong leftover casts to ssize_t
While both source and target types are already `size_t`.

Spotted by GitHub Code Quality

Follow-up to b7c676d13f #17593

Closes #21625
2026-05-15 12:16:02 +02:00
Viktor Szakats
4780e509aa
tidy-up: prefer "initialize" with a 'z'
To match the majority of usage in source.

Closes #21618
2026-05-15 11:49:06 +02:00
Viktor Szakats
3da249e1f0
gsasl: fix potential double free
Also:
- require libgsasl 1.6.0+ (2010-12-14) for a `gsasl_finish()` that
  handles a NULL argument.
  Ref: b550032df8

Reported-by: Joshua Rogers (Aisle Research)

Closes #21609
2026-05-15 11:49:06 +02:00
Viktor Szakats
eb9b253d66
libssh: add support for SHA256 host public keys
Reported-by: Joshua Rogers
Fixes #21605

Closes #21607
2026-05-15 11:49:06 +02:00
Daniel Stenberg
9135294115
urlapi: deny hostnames with more than one trailing dot
Or consisting of just a single dot.

Such names cannot be resolved with DNS.

While they *can* still be resolved with /etc/hosts or --resolve tricks,
they easily cause internal problems because their trailing dots.

Let's not allow them anymore.

Closes #21622
2026-05-15 11:44:20 +02:00
Joshua Rogers
88bb7f885f
rustls: error on CURLOPT_CRLFILE with native CA store
Closes #21614
2026-05-15 10:25:55 +02:00
Viktor Szakats
976eb1d50d
windows: update MS SDK versions in comments
To make them more accurate.

Also:
- show Visual Studio version, where missing.
- ease the formatting.
- schannel_int.h: clang-tidy fallback code.

Used: `rg -l --sort=path CERT_FIND_HAS_PRIVATE_KEY`

Closes #21621
2026-05-15 03:41:33 +02:00
Viktor Szakats
ef068fc8b7
GHA: pin containers to hash (where missing)
Fixing this with zizmor v1.25.0:
```
error[unpinned-images]: unpinned image references
  --> .github/workflows/linux-old.yml:59:5
59 |     container: 'debian:stretch'
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ container image is not pinned to a SHA256 hash
   = help: audit documentation -> https://docs.zizmor.sh/audits/#unpinned-images
[...]
```
Ref: https://github.com/curl/curl/actions/runs/25890035949/job/76090925291?pr=21618

Sadly there is no automatic mechanism to bump them..

Also:
- replace `debian-stretch` with its slim variant.
- bump one of the two Alpine jobs from 3.20 to 3.23.4.

Closes #21619
2026-05-15 01:37:39 +02:00
Viktor Szakats
cc5eb4aba9
docs: fix a couple of typos
Spotted by GitHub Code Quality

Closes #21617
2026-05-15 01:37:38 +02:00
Viktor Szakats
5a869edb0f
creds: drop redundant CURL_UNCONST()s
Follow-up to 8f71d0fde5 #21548

Closes #21612
2026-05-15 01:37:38 +02:00
Viktor Szakats
27936d411a
lib: make __STDC_VERSION__ literals L (where missing) 2026-05-14 18:35:49 +02:00
Viktor Szakats
1a69c3a9c0
cmake: unfold a line 2026-05-14 16:33:23 +02:00