]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
2 months agoldap: drop duplicate `ldap_set_option()` on Windows
Viktor Szakats [Sun, 15 Mar 2026 16:31:35 +0000 (17:31 +0100)] 
ldap: drop duplicate `ldap_set_option()` on Windows

Already set after `ldap_sslinit()`/`ldap_init()` and before
`ldap_ssl`-specific initialization.

Follow-up to 39d1976b7f709a516e3243338ebc0443bdd8d56d #19830
Follow-up to b41e65a8e3ed8fdafb535328997bedc925f21e37
Follow-up to b91421b10764c4b7450ea29d305cc65c3f828dd1

Closes #20930

2 months agobuild: include curlx headers directly in src and tests
Viktor Szakats [Sat, 28 Feb 2026 23:54:09 +0000 (00:54 +0100)] 
build: include curlx headers directly in src and tests

To include what's actually used.

Also:
- drop unused includes.
- scope includes where possible.
- drop `curlx/curlx.h` umbrella header.
- config2setopts: include `netinet/in.h` for Cygwin/MSYS2.
  Previously included by chance via an unused curlx include.

Closes #20776

2 months agomk-ca-bundle.pl: make generated timestamps deterministic
Viktor Szakats [Thu, 5 Feb 2026 14:24:22 +0000 (15:24 +0100)] 
mk-ca-bundle.pl: make generated timestamps deterministic

With default invocation, make generated file timestamps deterministic
by looking up (via the GitHub API) the last commit that modified
`certdata.txt`, along with  its commit timestamp.

Also:
- show the URL used to download `certdata.txt` from.
- make `ca-bundle.crt` timestamp match `certdata.txt`'s.

Closes #20528

2 months agocmake: resolve imported targets recursively when generating `libcurl.pc`
Viktor Szakats [Fri, 6 Mar 2026 14:50:09 +0000 (15:50 +0100)] 
cmake: resolve imported targets recursively when generating `libcurl.pc`

To allow simplifying the binutils ld hack, by chaining the original
imported target to curl's local duplicate target. Also to allow linking
to dependencies' native imported targets via their CMake Configs, which
will always be hooked up to a `CURL::` interface, and may also be
chained upstream.

Fixing (seen on Linux with simplified binutils hack via #20839):
```
 Requires:
 Requires.private: libzstd openssl zlib
 Libs: -L${libdir} -lcurl
-Libs.private:  -lcrypto -lssl -lz -lzstd
+Libs.private:  -lOpenSSL::Crypto -lZLIB::ZLIB -lcrypto -lssl -lz -lzstd
 Cflags: -I${includedir}
 Cflags.private: -DCURL_STATICLIB
Error: Process completed with exit code
```
Ref: https://github.com/curl/curl/actions/runs/22768301699/job/66041980258?pr=20839

Note this makes it possible to run into an infinite loop because CMake
allows cyclic dependencies. It isn't added by curl's CMake script nor by
any dependencies as defined by default, but may happen in theory with
custom-created targets. In such case CMake automatically stops with
an error at 1000 iterations. I find it overkill to add custom protection
for it.

Cherry-picked from #20814
Cherry-picked from #20839

Closes #20840

2 months agocurl_get_line: fix potential infinite loop when filename is a directory
Viktor Szakats [Tue, 10 Mar 2026 00:03:13 +0000 (01:03 +0100)] 
curl_get_line: fix potential infinite loop when filename is a directory

Fix potential inifinite loop reading file content with `Curl_get_line()`
when a filename passed via these options are pointing to a directory
entry (on non-Windows):

- `--alt-svc` / `CURLOPT_ALTSVC`
- `-b` / `--cookie` / `CURLOPT_COOKIEFILE`
- `--hsts` / `CURLOPT_HSTS`
- `--netrc-file` / `CURLOPT_NETRC_FILE`

Fix by checking for this condition and silently skipping such filename
without attempting to read content. Add test 1713 to verify.

Mention in cookie documentation as an accepted case, also show a verbose
message when a directory is detected. Extend test 46 to verify if such
failure lets the logic continue to the next cookie file.

Reported-and-based-on-patch-by: Richard Tollerton
Fixes #20823
Closes #20826 (originally-based-on)
Follow-up to 769ccb4d4261a75c8a4236fbe7dc3e27956db1c9 #19140

Closes #20873

2 months agocmake: add `CURL_GCC_ANALYZER` option, enable in CI, fix/silence
Viktor Szakats [Fri, 13 Mar 2026 15:42:16 +0000 (16:42 +0100)] 
cmake: add `CURL_GCC_ANALYZER` option, enable in CI, fix/silence

Enable in one existing Linux, macOS and Windows job.

Cost:
- Linux: +1.3 minutes.
- macOS: +1.5 minutes.
- Windows: +2.5 minutes.

Fix or silence issues found:
- conncache: silence NULL deref warning.
  ```
  lib/conncache.c:564:18: warning: dereference of NULL '*data.multi' [CWE-476] [-Wanalyzer-null-dereference]
  ```
  Ref: ede6a8e08762321d95864ad384b8ff5ac44ac459 #19378
- http2: check pointer for NULL.
  ```
  lib/http2.c:388:7: error: dereference of NULL ‘data’ [CWE-476] [-Wanalyzer-null-dereference]
  ```
- http2: silence potential NULL deref in `cf_h2_recv`.
  ```
  lib/http2.c: In function 'cf_h2_recv':
  lib/curl_trc.h:62:15: warning: dereference of NULL 'data' [CWE-476] [-Wanalyzer-null-dereference]
  ```
- openldap: silence deref before NULL check.
  Seen in GHA/Linux.
  ```
  lib/openldap.c: In function ‘oldap_state_mechs_resp’:
  lib/curl_trc.h:140:7: warning: check of ‘data’ for NULL after already dereferencing it [-Wanalyzer-deref-before-check]
  ```
- sendf: silence NULL deref false positive in `Curl_creader_set_fread`.
  It looks impossible to happen.
  ```
  lib/sendf.c:1133:7: warning: dereference of NULL 'r' [CWE-476] [-Wanalyzer-null-dereference]
  ```
- ws: silence deref before NULL check.
  ```
  lib/ws.c: In function 'ws_send_raw_blocking':
  lib/curl_trc.h:205:7: warning: check of 'data' for NULL after already dereferencing it [-Wanalyzer-deref-before-check]
  ```
- var: fix potential NULL deref
  ```
  src/var.c:216:29: warning: dereference of NULL 'envp' [CWE-476] [-Wanalyzer-null-dereference]
  ```
- cli_hx_upload.c: fix NULL check after dereference.
  ```
  tests/libtest/cli_hx_upload.c:170:7: warning: check of '*t.method' for NULL after already dereferencing it [-Wanalyzer-deref-before-check]
  ```
- unit1607, unit1609: fix theoretical NULL ptr dereference.
  ```
  tests/unit/unit1607.c:211:12: warning: dereference of NULL 'addr' [CWE-476] [-Wanalyzer-null-dereference]
  tests/unit/unit1609.c:193:12: warning: dereference of NULL 'addr' [CWE-476] [-Wanalyzer-null-dereference]
  ```
- globally disable checks triggering false positives only:
  ```
  docs/examples/externalsocket.c:135:8: warning: 'connect' on possibly invalid file descriptor 'sockfd' [-Wanalyzer-fd-use-without-check]
  lib/bufq.c:465:16: warning: infinite loop [CWE-835] [-Wanalyzer-infinite-loop] (gcc-15 Windows)
  lib/doh.c:1035:34: warning: stack-based buffer over-read [CWE-126] [-Wanalyzer-out-of-bounds] (gcc-15 macOS)
  lib/ftp.c:4022:20: warning: infinite loop [CWE-835] [-Wanalyzer-infinite-loop] (gcc-15 macOS)
  lib/http2.c:689:28: warning: buffer over-read [CWE-126] [-Wanalyzer-out-of-bounds] (gcc-15 macOS)
  lib/socketpair.c:195:5: warning: leak of file descriptor 'curl_dbg_socket(2, 1, 0, 192, "D:/a/curl/curl/lib/socketpair.c")' [CWE-775] [-Wanalyzer-fd-leak]
  src/tool_doswin.c:810:7: warning: leak of file descriptor '*tdata.socket_l' [CWE-775] [-Wanalyzer-fd-leak]
  src/tool_doswin.c:816:9: warning: leak of file descriptor '*tdata.socket_l' [CWE-775] [-Wanalyzer-fd-leak]
  src/tool_main.c:96:1: warning: leak of file descriptor 'fd[0]' [CWE-775] [-Wanalyzer-fd-leak]
  src/tool_main.c:96:1: warning: leak of file descriptor 'fd[1]' [CWE-775] [-Wanalyzer-fd-leak]
  src/tool_urlglob.c:48:17: warning: leak of 'malloc(8)' [CWE-401] [-Wanalyzer-malloc-leak]
  src/tool_writeout.c:870:3: warning: leak of FILE 'stream2' [CWE-775] [-Wanalyzer-file-leak]
  tests/libtest/lib518.c:90:1: warning: leak of FILE [CWE-775] [-Wanalyzer-file-leak]
  tests/libtest/lib537.c:87:1: warning: leak of FILE [CWE-775] [-Wanalyzer-file-leak]
  tests/server/tftpd.c:1147:10: warning: 'bind' on possibly invalid file descriptor 'sock' [-Wanalyzer-fd-use-without-check]
  tests/server/tftpd.c:1155:10: warning: 'bind' on possibly invalid file descriptor 'sock' [-Wanalyzer-fd-use-without-check]
  tests/server/tftpd.c:1259:10: warning: 'connect' on possibly invalid file descriptor '4294967295' [-Wanalyzer-fd-use-without-check]
  ```

Also:
- cmake: update clang-tidy typecheck comment.

Ref: https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html

Closes #20921

2 months agoconfigure: add option to trace pkg-config detection details
Viktor Szakats [Sun, 15 Mar 2026 14:07:35 +0000 (15:07 +0100)] 
configure: add option to trace pkg-config detection details

To aid debugging cases when dependency detection acts unexpectedly.
Sprung from spending days trying to figure out behavior of ngtcp2 crypto
modules and their dependencies.

You can enable by setting env `CURL_TRACE_PKG_CONFIG` to a non-empty
value. When enabled, details are logged for both successful and
unsuccessful detections. Logging of unsuccessful ones is automatically
enabled when `CURL_CI` env is set, which is the case for all CI jobs.

It works by asking for `--debug` output and grepping for lines that seem
useful for this purpose. Output is different for classic pkg-config and
pkgconf, and may depending on tool version. Also append `--print-errors`
output if any.

Examples (with pkgconf):

Fail, before:
```
checking for libngtcp2_crypto_boringssl options with pkg-config... no
configure: error: --with-ngtcp2 was specified but could not find ngtcp2_crypto_boringssl pkg-config file.
```

Fail, after:
```
checking for libngtcp2_crypto_boringssl options with pkg-config... no
configure: pkg-config --exists libngtcp2_crypto_boringssl trace:
---- begin
trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2_crypto_boringssl
trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for libngtcp2_crypto_boringssl
trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2
trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for libngtcp2
trying path: /home/runner/nghttp3/build/lib/pkgconfig for openssl
trying path: /home/runner/ngtcp2-boringssl/build/lib/pkgconfig for openssl
trying path: /home/runner/nghttp2/build/lib/pkgconfig for openssl
==== error:
Package openssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `openssl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'openssl', required by 'libngtcp2_crypto_boringssl', not found
---- end
configure: error: --with-ngtcp2 was specified but could not find ngtcp2_crypto_boringssl pkg-config file.
```

Success, after:
```
checking for libngtcp2_crypto_boringssl options with pkg-config... found
configure: pkg-config --exists libngtcp2_crypto_boringssl trace:
---- begin
trying path: /home/runner/awslc/build/lib/pkgconfig for libngtcp2_crypto_boringssl
trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2_crypto_boringssl
trying path: /home/runner/nghttp2/build/lib/pkgconfig for libngtcp2_crypto_boringssl
trying path: /home/runner/ngtcp2/build/lib/pkgconfig for libngtcp2_crypto_boringssl
trying path: /home/runner/awslc/build/lib/pkgconfig for libngtcp2
trying path: /home/runner/nghttp3/build/lib/pkgconfig for libngtcp2
trying path: /home/runner/nghttp2/build/lib/pkgconfig for libngtcp2
trying path: /home/runner/ngtcp2/build/lib/pkgconfig for libngtcp2
trying path: /home/runner/awslc/build/lib/pkgconfig for openssl
trying path: /home/runner/awslc/build/lib/pkgconfig for libssl
trying path: /home/runner/awslc/build/lib/pkgconfig for libcrypto
---- end
```

More examples:
https://github.com/curl/curl/pull/20926#issuecomment-4064259935

If there is an externally enablable, built-in feature like this in
classic pkg-config or pkgconf, I could not find it.

Also:
- GHA/http3-linux: set `CURL_TRACE_PKG_CONFIG` to log detection details.
  H3 builds are prone to hard-to-debug dependency issues.

Ref: #20920
Follow-up to 3c64ffaff4cd8c8275627dd2e17b6879a1d32262 #18415 #18188
Follow-up to 99500660af19f89069e71c2251c13963401b3806 #18028 #18022

Cherry-picked from #20926

Closes #20931

2 months agoldap: fix to initialize cleartext connection on Windows
Viktor Szakats [Sun, 15 Mar 2026 15:55:24 +0000 (16:55 +0100)] 
ldap: fix to initialize cleartext connection on Windows

Regression since curl 8.18.0.

Reported-by: Yoshiro Yoneya
Fixes #20927
Follow-up to 39d1976b7f709a516e3243338ebc0443bdd8d56d #19830

Closes #20928

2 months agobadwords-all: exit with correct code on errors
Daniel Stenberg [Mon, 16 Mar 2026 09:37:54 +0000 (10:37 +0100)] 
badwords-all: exit with correct code on errors

Problems remain undetected in CI otherwise

Closes #20934

2 months agobadwords: detect the the and with with
Daniel Stenberg [Mon, 16 Mar 2026 09:28:38 +0000 (10:28 +0100)] 
badwords: detect the the and with with

They seem to be the most common mistaken repeated words

Ref #20933

Closes #20934

2 months agourl: use URL for url even in comments
Daniel Stenberg [Mon, 16 Mar 2026 09:39:33 +0000 (10:39 +0100)] 
url: use URL for url even in comments

(Missed in CI due to a bug, see #20934)

Closes #20935

2 months agodocs/lib: fix typos
Martin Dürrmeier [Mon, 16 Mar 2026 09:06:13 +0000 (10:06 +0100)] 
docs/lib: fix typos

Repated 'the the' and 'with with'

Closes #20933

2 months agoprotocol source, all about protocols and uri schemes
Stefan Eissing [Thu, 12 Mar 2026 12:11:38 +0000 (13:11 +0100)] 
protocol source, all about protocols and uri schemes

Add protocol.h and protocol.c containing all about libcurl's
known URI schemes and their protocol handlers (so they exist).

Moves the scheme definitions from the various sources files into
protocol.c. Schemes are known and used, even of the protocol
handler is not build or just not implemented at all.

Closes #20906

2 months agodoh: fix memory-leak when doing a second DoH resolve
Daniel Stenberg [Sun, 15 Mar 2026 16:04:47 +0000 (17:04 +0100)] 
doh: fix memory-leak when doing a second DoH resolve

Reported-by: James Fuller
Closes #20929

2 months agolib: keepon improving
Stefan Eissing [Thu, 12 Mar 2026 10:18:32 +0000 (11:18 +0100)] 
lib: keepon improving

Improve the name, type and handling of `data->req.keepon`:

- Rename `keepon` to `io_flags`
- make `io_flags` and `uint8_t` and reposition in struct
- Rename `KEEP_*` defines to `REQ_IO_*`, move to request.h
- Replace all direct bit tests to `CURL_REQ_WANT_*` use
- Replace all direct bit manipulations with new macros

Closes #20905

2 months agourldata: import port types and conn destination format
Stefan Eissing [Fri, 13 Mar 2026 12:34:46 +0000 (13:34 +0100)] 
urldata: import port types and conn destination format

Convert more `int port` to `uint16_t` port types. Reshuffle ports in
connectdata to save some bytes. Change `conn->destination` format to

- make it more readable and thus usable in tracing
- add the IPv6 scope_id only when not default (global)
  and make it resemble more the textual format for IPv6
  (e.g. suffix '%<scope_id>')

Closes #20918

2 months agoos400sys: fix typo in comment (symetry -> symmetry)
crawfordxx [Sun, 15 Mar 2026 04:21:17 +0000 (12:21 +0800)] 
os400sys: fix typo in comment (symetry -> symmetry)

Closes #20923

2 months agourldata: connection bit ipv6_ip is wrong
Stefan Eissing [Fri, 13 Mar 2026 13:29:13 +0000 (14:29 +0100)] 
urldata: connection bit ipv6_ip is wrong

Eliminate `conn->bits.ipv6_ip`

The bit was only correct for the first transfer using a connection. Use
`data->state.up.hostname` instead in places that need the URL hostname
in its original form.

Fix parseurlandfillconn() to not modify `data->state.up.hostname` before
copying the connection's hostname, but modify the copy instead, leaving
the URL hostname intact.

Closes #20919

2 months agoGHA: make typos ignore RELEASE-NOTES
Daniel Stenberg [Fri, 13 Mar 2026 09:29:05 +0000 (10:29 +0100)] 
GHA: make typos ignore RELEASE-NOTES

The file is almost entirely made up by first-lines of previous git
commits, and we usually push it without a PR cycle, making it annoying
to trigger on typos later as they then show in independent PRs by other
people.

Closes #20917

2 months agoRELEASE-NOTES: fix typo
Daniel Stenberg [Fri, 13 Mar 2026 09:25:27 +0000 (10:25 +0100)] 
RELEASE-NOTES: fix typo

2 months agobadwords: only check comments and strings in source code
Daniel Stenberg [Thu, 12 Mar 2026 13:39:59 +0000 (14:39 +0100)] 
badwords: only check comments and strings in source code

- when scanning source code, this now only checks source code comments
  and double-quote strings. No more finding bad words as part of code
- this allows the full scan to be done in a single invocation
- detects source code or markdown by file name extension
- moved the whitelist words config into the single `badwords.txt` file,
  no more having them separately (see top of file for syntax)
- all whitelisted words are checked case insensitively now
- removed support for whitelisting words on a specific line number. We
  did not use it and it is too fragile

Removing the actual code from getting scanned made the script take an
additional 0.5 seconds on my machine.

Scanning 1525 files now takes a little under 1.7 seconds for me.

Closes #20909

2 months agotool_cfgable: free the SSL signature algorithms
Daniel Stenberg [Thu, 12 Mar 2026 22:18:21 +0000 (23:18 +0100)] 
tool_cfgable: free the SSL signature algorithms

Follow-up to a638828c88
Reported-by: James Fuller
Closes #20915

2 months agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 12 Mar 2026 22:32:25 +0000 (23:32 +0100)] 
RELEASE-NOTES: synced

2 months agoHTTP3.md: drop outdated mentions of OpenSSL-QUIC
Daniel Stenberg [Thu, 12 Mar 2026 21:46:42 +0000 (22:46 +0100)] 
HTTP3.md: drop outdated mentions of OpenSSL-QUIC

And make it a little clearer that the quiche backend is what is still
experimental.

Follow-up to 6aaac9dd388a64d

Closes #20914

2 months agoconfigure: fix LibreSSL ngtcp2 1.15.0+ crypto lib selection logic
Viktor Szakats [Wed, 11 Mar 2026 16:33:56 +0000 (17:33 +0100)] 
configure: fix LibreSSL ngtcp2 1.15.0+ crypto lib selection logic

Regression since curl 8.18.0.

Reported-by: Michael Hendricks
Fixes #20889
Regression from 8db0e286b363ad788d6dc0779d605b83c7ed4caf #18189

Closes #20891

2 months agobuild: compiler warning silencing tidy-ups
Viktor Szakats [Thu, 12 Mar 2026 13:59:11 +0000 (14:59 +0100)] 
build: compiler warning silencing tidy-ups

- tool_getparam: revert an unnecessary/no-op C89 warning silencer.
  Follow-up to 09c9afdd711d0b2ee9f524a235803e755e1074b7 #20363

- tool_writeout: add comment saying silencing is a no-op for llvm/clang.
  For `strftime()` it is a GCC-specific, as of llvm/clang v22.1.0.
  Follow-up to f07a98ae113b832a8748ba66e1554a7f14c6897e #20366

- unit1652: drop always-false `!defined(__clang__)` guard.
Pointed-out-by: Orgad Shaneh
  Ref: #20902
  Follow-up to 7e814c8717939393d4436d75f5f0c3ffa98c8c53 #16062

- unit1652: document that `-Wformat` is necessary for GCC v5 to v8.
  Follow-up to 71cf0d1fca9e1f53524e1545ef0c08d174458d80 #14772

Closes #20908

2 months agotest459: switch to mode="warn" for stderr check
Daniel Stenberg [Thu, 12 Mar 2026 15:41:47 +0000 (16:41 +0100)] 
test459: switch to mode="warn" for stderr check

In a -j192 build, this output used a three-digit number for the output,
thus wrapping differently and causing it to error.

Reported-by: Carlos Henrique Lima Melara
Closes #20910

2 months agotest1627: Curl_get_scheme unit test
Daniel Stenberg [Thu, 12 Mar 2026 10:07:05 +0000 (11:07 +0100)] 
test1627: Curl_get_scheme unit test

Closes #20904

2 months agotest1626: Curl_copy_header_value unit test
Daniel Stenberg [Thu, 12 Mar 2026 09:29:30 +0000 (10:29 +0100)] 
test1626: Curl_copy_header_value unit test

Closes #20903

2 months agoopenssl: trace count of found / imported Windows native CA roots
Viktor Szakats [Thu, 12 Mar 2026 01:38:07 +0000 (02:38 +0100)] 
openssl: trace count of found / imported Windows native CA roots

To help understanding what's happening on systems where native CA misses
to verify legitimate public websites.

Also:
- drop a superfluous, hanging, `else`.

Ref: #20897

Closes #20899

2 months agohttp: make Curl_compareheader handle multiple commas in header
Daniel Stenberg [Thu, 12 Mar 2026 09:02:29 +0000 (10:02 +0100)] 
http: make Curl_compareheader handle multiple commas in header

For robustness

2 months agotest1625: unit test for Curl_compareheader
Daniel Stenberg [Thu, 12 Mar 2026 08:36:41 +0000 (09:36 +0100)] 
test1625: unit test for Curl_compareheader

Follow-up to 2938cb72e5a7f0e661617b9bf6

Closes #20901

2 months agohostip: remove two zero assigns after memset clear
Daniel Stenberg [Thu, 12 Mar 2026 06:59:50 +0000 (07:59 +0100)] 
hostip: remove two zero assigns after memset clear

As the struct is now always unconditionally memset with zeros, we
can remove two zero assigns.

Follow-up to 015f1c7de40839b6681b7dde7

Pointed out by CodeSonar

Closes #20900

2 months agohttp: fix Curl_compareheader for multi value headers
Daniel Stenberg [Wed, 11 Mar 2026 21:50:56 +0000 (22:50 +0100)] 
http: fix Curl_compareheader for multi value headers

Follow-up to 04289c62dea22d28daa60. Regression shipped in 8.13.0.

- a logic error made it not loop and thus only match if the searched string
  was first

- it no longer matches a substring

Adjusted test 1 to use multiple values in the Connection: response
header. Adjusted test 1542 to have a "Connection: close-not" which
should not match.

Reported-by: Henrique Pereira
Closes #20894

2 months agoautotools: limit checksrc target to ignore non-repo test sources
Viktor Szakats [Thu, 12 Mar 2026 00:27:47 +0000 (01:27 +0100)] 
autotools: limit checksrc target to ignore non-repo test sources

Syncing tests with lib and src behavior.

Also:
- fix OS400 checksrc to find the per-directory `.checksrc` file.

Closes #20898

2 months agobuild: hook up badwords check to lint targets
Viktor Szakats [Wed, 11 Mar 2026 08:33:09 +0000 (09:33 +0100)] 
build: hook up badwords check to lint targets

Also:
- autotools: make `badwords` target honor `@PERL@`.

Suggested-by: Stefan Eissing
Closes #20884

2 months agoexamples: drop warning silencers no longer hit
Viktor Szakats [Wed, 11 Mar 2026 23:25:48 +0000 (00:25 +0100)] 
examples: drop warning silencers no longer hit

Also:
- scope clang `-Wcast-function-type-strict` silencing, add missed `pop`.

Follow-up to d06b49d8b2d42d477f7e78596035832727d6d5c9 #18260

Closes #20896

2 months agobadwords: rework exceptions, fix many of them
Viktor Szakats [Wed, 11 Mar 2026 09:17:10 +0000 (10:17 +0100)] 
badwords: rework exceptions, fix many of them

Also:
- support per-directory and per-upper-directory whitelist entries.
- convert badlist input grep tweak into the above format.
  (except for 'And' which had just a few hits.)
- fix many code exceptions, but do not enforce.
  (there also remain about 350 'will' uses in lib)
- fix badwords in example code, drop exceptions.
- badwords-all: convert to Perl.
  To make it usable from CMake.
- FAQ: reword to not use 'will'. Drop exception.

Closes #20886

2 months agourlapi: verify the last letter of a scheme when set explictly
Daniel Stenberg [Wed, 11 Mar 2026 21:36:24 +0000 (22:36 +0100)] 
urlapi: verify the last letter of a scheme when set explictly

A logic error made the function not check the last character, which thus
could make it accept invalid schemes.

Added test 1965 to verify

Reported-by: Otis Cui Lei
Closes #20893

2 months agovtls: ECH definitions cleanup
Stefan Eissing [Wed, 11 Mar 2026 13:16:31 +0000 (14:16 +0100)] 
vtls: ECH definitions cleanup

- Move ECH related defines to vtls.h
- Prefix all defines with `CURLECH_`
- Move base64.h include from vtls.h to implementations

Closes #20887

2 months agopingpong: cleanup timeleft handling
Stefan Eissing [Wed, 11 Mar 2026 13:43:14 +0000 (14:43 +0100)] 
pingpong: cleanup timeleft handling

- Move `RESP_TIMEOUT` from urldata.h to pingpong.h as
  `PINGPONG_TIMEOUT_MS`.
- Rename `Curl_pp_state_timeout()` to `Curl_pp_state_timeleft_ms()` as
  the function returns the time left, not the timout..
- Update implementation comments and variable names

Closes #20888

2 months agoconnection_check, simplified
Stefan Eissing [Wed, 11 Mar 2026 14:25:45 +0000 (15:25 +0100)] 
connection_check, simplified

The protocol handler method `connection_check` allowed to variable
operations to trigger with variable result bits. Only the `CONNCHECK_ISDEAD`
and `CONNRESULT_DEAD` were in use. Transform the function into
`connection_is_dead` without extra parameter and a bool result.

- Remove defines for `CONNCHECK_*` and `CONNRESULT_*`
- Rename protocol function in handler comments
- Change RTSP implementation (only protocol that uses this)

Closes #20890

2 months agohostip: clear the sockaddr_in6 structure before use
Vladimír Marek [Wed, 11 Mar 2026 09:46:51 +0000 (10:46 +0100)] 
hostip: clear the sockaddr_in6 structure before use

On Solaris this was causing intermittent issues when the private
structure member __sin6_src_id had unexpectedly some value. connect(2)
would then fail with EADDRNOTAVAIL.

Closes #20885

2 months agolibssh2: fix error handling on quote errors
Daniel Stenberg [Wed, 11 Mar 2026 07:33:58 +0000 (08:33 +0100)] 
libssh2: fix error handling on quote errors

Previously it lacked the actual return. libssh.c uses the same function
name.

Verified by test 2007.

Reported-by: m777m0 on hackerone
Follow-up to 578706addec3d41cb5db64160d23795a95ca11d9

Closes #20883

2 months agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 11 Mar 2026 07:49:39 +0000 (08:49 +0100)] 
RELEASE-NOTES: synced

Bumped curlver as well

2 months agodocs: minor wording tweaks
Daniel Stenberg [Tue, 10 Mar 2026 17:05:34 +0000 (18:05 +0100)] 
docs: minor wording tweaks

found when improving the badwords whitelisting logic

2 months agobadwords: combine the whitelisting into a single regex
Daniel Stenberg [Tue, 10 Mar 2026 17:04:31 +0000 (18:04 +0100)] 
badwords: combine the whitelisting into a single regex

Also: make the whitelist matches case insensitve

Takes the script execution time down from 3.6 seconds to 1.1 on my
machine.

Closes #20880

2 months agoRELEASE-NOTES: synced curl-8_19_0
Daniel Stenberg [Wed, 11 Mar 2026 06:46:12 +0000 (07:46 +0100)] 
RELEASE-NOTES: synced

curl 8.19.0

2 months agoVERSIONS: add 8.19.0
Daniel Stenberg [Wed, 11 Mar 2026 06:46:12 +0000 (07:46 +0100)] 
VERSIONS: add 8.19.0

2 months agoTHANKS: add contributors from 8.19.0 release
Daniel Stenberg [Wed, 11 Mar 2026 06:46:12 +0000 (07:46 +0100)] 
THANKS: add contributors from 8.19.0 release

2 months agoFAQ.md: point codeproject.com URL to archive.org copy
Viktor Szakats [Wed, 11 Mar 2026 00:09:40 +0000 (01:09 +0100)] 
FAQ.md: point codeproject.com URL to archive.org copy

The original server closed down, linked page last seen on 2026-02-16.

Refs:
https://github.com/curl/curl/actions/runs/22051494128
https://web.archive.org/web/20250818150617/www.codeproject.com/info/Changes.aspx

Closes #20882

2 months agobadwords: avoid 'simply'
Felipe Mesquita [Thu, 5 Mar 2026 13:40:16 +0000 (10:40 -0300)] 
badwords: avoid 'simply'

It's mostly a filler word. I've read through each use of it in the code
base and did minor rephrasings when "simply" carried some meaning. The
overwhelming majority of cases, removing it improved the text
significantly. Inspired by #20793.

Closes #20822

2 months agobadwords: fix showing alternative for case-insensitive hits
Viktor Szakats [Tue, 10 Mar 2026 16:59:22 +0000 (17:59 +0100)] 
badwords: fix showing alternative for case-insensitive hits

Fixing:
```
Use of uninitialized value $alt{"Simply"} in printf at scripts/badwords line 109, <F> line 34.
 maybe use "" instead?
```

Closes #20879

2 months agoGHA: drop installing impacket for curl built without SMB support
Viktor Szakats [Mon, 9 Mar 2026 12:15:59 +0000 (13:15 +0100)] 
GHA: drop installing impacket for curl built without SMB support

Ref: #20846

Closes #20868

2 months agobadwords: dedupe invocation into a runnable script
Viktor Szakats [Tue, 10 Mar 2026 00:42:40 +0000 (01:42 +0100)] 
badwords: dedupe invocation into a runnable script

Also:
- GHA/checksrc: merge two badwords CI jobs into a single one.
- re-add the more common bitness entries.

Closes #20874

2 months agospacecheck: find double newlines in `tests/data/test*`
Viktor Szakats [Mon, 9 Mar 2026 19:36:01 +0000 (20:36 +0100)] 
spacecheck: find double newlines in `tests/data/test*`

Closes #20872

2 months agoBUG-BOUNTY.md: minor rephrase to say there is no bug bounty
Daniel Stenberg [Tue, 10 Mar 2026 16:10:37 +0000 (17:10 +0100)] 
BUG-BOUNTY.md: minor rephrase to say there is no bug bounty

also add a brief mention to VULN-DISCLOSURE-POLICY.md

Closes #20878

2 months agoGHA: update awslabs/aws-lc to v1.69.0
renovate[bot] [Tue, 10 Mar 2026 01:19:20 +0000 (01:19 +0000)] 
GHA: update awslabs/aws-lc to v1.69.0

Closes #20876

2 months agobadwords: twice as fast
Stefan Eissing [Tue, 10 Mar 2026 13:48:49 +0000 (14:48 +0100)] 
badwords: twice as fast

...on my macOS machine, this version uses half the time when
scanning the source.

Closes #20877

2 months agodocs: fixup wording nits
Daniel Stenberg [Mon, 9 Mar 2026 15:31:37 +0000 (16:31 +0100)] 
docs: fixup wording nits

Mostly sentences starting with bad words

2 months agobadwords: move into ./scripts, speed up
Daniel Stenberg [Mon, 9 Mar 2026 12:32:14 +0000 (13:32 +0100)] 
badwords: move into ./scripts, speed up

- 'badwords' is now a target in Makefile.am

- change badwords.txt to specify plain "words" instead of regexes so the
  script can build single regexes when scanning, which makes the script
  perform much faster (~6 times faster)

Closes #20869

2 months agox509asn1: make encodeOID stop on too long input
Daniel Stenberg [Mon, 9 Mar 2026 19:16:32 +0000 (20:16 +0100)] 
x509asn1: make encodeOID stop on too long input

Plus a minor fixup.

Reported-by: John Rodriguez
Closes #20871

2 months agodocs: handle error in `curl_global_init*` examples
Viktor Szakats [Mon, 9 Mar 2026 10:04:24 +0000 (11:04 +0100)] 
docs: handle error in `curl_global_init*` examples

Also:
- call cleanup in `curl_global_init_mem()` example.

Closes #20866

2 months agoTHANKS-filter: update with a new entry
Viktor Szakats [Mon, 9 Mar 2026 01:14:04 +0000 (02:14 +0100)] 
THANKS-filter: update with a new entry

Closes #20861

2 months agorand: drop scan-build silencer
Viktor Szakats [Sun, 8 Mar 2026 20:03:37 +0000 (21:03 +0100)] 
rand: drop scan-build silencer

scan-build has been dropped in favor of clang-tidy and this false
positive no longer triggers with it.

Follow-up to ce4db9c2efca0bd89e556e231d940c988d84a606 #20751
Follow-up to 02f207a76b45129e4d033c099e6d17581801c76e

Closes #20860

2 months agorand: drop impossible preprocessor branches (wincrypt)
Viktor Szakats [Sun, 8 Mar 2026 18:55:14 +0000 (19:55 +0100)] 
rand: drop impossible preprocessor branches (wincrypt)

After targeting Vista as minimum, the non-bcrypt fallback code was
impossible to reach, because on UWP wincrypt is never available.

After this patch it's more obvious that no-SSL UWP builds only support
weak random source.

Follow-up to b17ef873ae2151263667f4b6fb6abfe337e687dc #18009

Closes #20859

2 months agoconfigure: drop always true `if` check (Windows)
Viktor Szakats [Sun, 8 Mar 2026 18:48:12 +0000 (19:48 +0100)] 
configure: drop always true `if` check (Windows)

Follow-up to c1bc090d65b8d7d14e811dd36f5e8674be43dff3 #12495

Closes #20858

2 months agoGHA/windows: pass preprocessor flags via `CPPFLAGS`
Viktor Szakats [Sun, 8 Mar 2026 18:45:03 +0000 (19:45 +0100)] 
GHA/windows: pass preprocessor flags via `CPPFLAGS`

To avoid potential warning with autotools when using `CFLAGS`. Existing
jobs are not affected.

Also:
- drop a redundant `export`.
- ensure not to overwrite per-job options with UWP ones.

Closes #20857

2 months agoconfig-win32.h: merge two `#if` branches
Viktor Szakats [Sun, 8 Mar 2026 18:11:07 +0000 (19:11 +0100)] 
config-win32.h: merge two `#if` branches

Closes #20856

2 months agowindows: determine `RtlVerifyVersionInfo` address on global init
Viktor Szakats [Sun, 8 Mar 2026 14:12:17 +0000 (15:12 +0100)] 
windows: determine `RtlVerifyVersionInfo` address on global init

Instead of the first internal call to `curlx_verify_windows_version()`.

To avoid the chance of a race, potentially resulting in initializing
this address twice. AFAICT it could not cause an issue before this
patch.

Reported by Codex Security

Follow-up to b17ef873ae2151263667f4b6fb6abfe337e687dc #18009

Closes #20853

2 months agotidy-up: miscellaneous
Viktor Szakats [Thu, 26 Feb 2026 02:13:56 +0000 (03:13 +0100)] 
tidy-up: miscellaneous

Closes #20851

2 months agodigest: fix memory leak in auth_create_digest_http_message()
huanghuihui0904 [Mon, 9 Mar 2026 06:39:44 +0000 (14:39 +0800)] 
digest: fix memory leak in auth_create_digest_http_message()

Signed-off-by: huanghuihui0904 <625173@qq.com>
Closes #20862

2 months agoRELEASE-NOTES: synced
Daniel Stenberg [Sun, 8 Mar 2026 22:08:05 +0000 (23:08 +0100)] 
RELEASE-NOTES: synced

2 months agotest1850: verify the SMB request path use for two transfers
Daniel Stenberg [Sun, 8 Mar 2026 13:53:43 +0000 (14:53 +0100)] 
test1850: verify the SMB request path use for two transfers

2 months agosmb: free the path in the request struct properly
Stefan Eissing [Sun, 8 Mar 2026 13:30:00 +0000 (14:30 +0100)] 
smb: free the path in the request struct properly

Closes #20854

3 months agotests/server: drop unused `curlx/version_win32.c`
Viktor Szakats [Sun, 8 Mar 2026 16:47:43 +0000 (17:47 +0100)] 
tests/server: drop unused `curlx/version_win32.c`

Previously used via `curlx/timeval.c`, but no longer after bumping
minimum target to Vista.

Follow-up to b17ef873ae2151263667f4b6fb6abfe337e687dc #18009

Closes #20855

3 months agosystem_win32: replace manual init code with `curlx_now_init()` call
Viktor Szakats [Sun, 8 Mar 2026 14:26:21 +0000 (15:26 +0100)] 
system_win32: replace manual init code with `curlx_now_init()` call

The code actual init code remains identical after this patch. To make it
clearer where this initialization is called from, and to dedupe code.

Follow-up to b17ef873ae2151263667f4b6fb6abfe337e687dc #18009

Closes #20852

3 months agodocs: replace instances of the vague qualifier 'quite'
dbalsom [Fri, 6 Mar 2026 17:58:44 +0000 (12:58 -0500)] 
docs: replace instances of the vague qualifier 'quite'

in documentation and comments

Closes #20841

3 months agodocs: avoid starting sentences with However,
Daniel Stenberg [Fri, 6 Mar 2026 10:30:20 +0000 (11:30 +0100)] 
docs: avoid starting sentences with However,

An unnecessary filling word

Closes #20834

3 months agoquiche: use PRIu64 for outputting the stream id
Daniel Stenberg [Sat, 7 Mar 2026 22:17:53 +0000 (23:17 +0100)] 
quiche: use PRIu64 for outputting the stream id

The 'id' struct field in 'struct h3_stream_ctx' is a uint64_t type so
should be output with PRIu64 - and it makes sense to be consistent.

Note that the field with the same name in the ngtcp2 version of this
struct is a *signed* 64-bit variable.

Reported by Codex Security

Closes #20849

3 months agoDEPRECATE.md: SMB and NTLM become build-time opt-in
Daniel Stenberg [Sat, 7 Mar 2026 13:44:17 +0000 (14:44 +0100)] 
DEPRECATE.md: SMB and NTLM become build-time opt-in

Closes #20847

3 months agotests/FILEFORMAT.md: the <server> section is NOT mandatory
Daniel Stenberg [Sat, 7 Mar 2026 12:44:33 +0000 (13:44 +0100)] 
tests/FILEFORMAT.md: the <server> section is NOT mandatory

It can be left out if no servers are necessary.

Closes #20845

3 months agotest1849: reuse a proxy with different credentials
Daniel Stenberg [Fri, 6 Mar 2026 22:08:31 +0000 (23:08 +0100)] 
test1849: reuse a proxy with different credentials

Closes #20842

3 months agocf-socket: ignore SOCK_CLOEXEC etc for socktype equality checks
Daniel Stenberg [Sat, 7 Mar 2026 10:24:18 +0000 (11:24 +0100)] 
cf-socket: ignore SOCK_CLOEXEC etc for socktype equality checks

As the SOCK_CLOEXEC and SOCK_NONBLOCK get ORed to the socktype, this
introduces the cf_socktype() function to use when checking for the
specific socket type: DGRAM or STREAM. The function filters off the
non-type related bits to enable the comparison.

Follow-up to 05367694ecf24a5d39f

Closes #20808

3 months agohttp: only send bearer if auth is allowed
Daniel Stenberg [Fri, 6 Mar 2026 22:13:07 +0000 (23:13 +0100)] 
http: only send bearer if auth is allowed

Verify with test 2006

Closes #20843

3 months agodocs: drop basically
Daniel Stenberg [Fri, 6 Mar 2026 10:37:33 +0000 (11:37 +0100)] 
docs: drop basically

Another filler word

Closes #20835

3 months agoFAQ: syntax improvements
Andrei Rybak [Wed, 4 Mar 2026 09:11:58 +0000 (10:11 +0100)] 
FAQ: syntax improvements

During conversion of `docs/FAQ` into Markdown, 'man ld' has incorrectly
kept one of its quotes when it was surrounded by backticks for inline
code formatting.  A space on the left of it was lost as well.

Fix the formatting in the new `docs/FAQ.md`.

Closes #20812

3 months agomqtt: fix EOF handling
Stefan Eissing [Fri, 6 Mar 2026 07:38:03 +0000 (08:38 +0100)] 
mqtt: fix EOF handling

In mqtt_recv_atleast(), recognize an EOF as error.

Fixes #20815
Reported-by: Max Dymond
Closes #20830

3 months agoproxy-auth: additional tests
Stefan Eissing [Fri, 6 Mar 2026 13:54:09 +0000 (14:54 +0100)] 
proxy-auth: additional tests

Also eliminate the special handling for socks proxy match.

Closes #20837

3 months agosocketpair: clear 'err' when retrying due to EINTR
Daniel Stenberg [Tue, 3 Mar 2026 22:50:08 +0000 (23:50 +0100)] 
socketpair: clear 'err' when retrying due to EINTR

If the first write was interrupted by a signal and a subsequent write
succeeds, the function would still erroneously return EINTR.

Found by Codex Security
Closes #20809

3 months agosynctime: fix use of uninitialized buffer on non-Windows
Daniel Stenberg [Tue, 3 Mar 2026 22:11:51 +0000 (23:11 +0100)] 
synctime: fix use of uninitialized buffer on non-Windows

Follow-up to: b714c674f3

Spotted by Codex Security
Closes #20806

3 months agocontent_encoding: return 'identity' if none other exists
Daniel Stenberg [Tue, 3 Mar 2026 22:06:24 +0000 (23:06 +0100)] 
content_encoding: return 'identity' if none other exists

This fixes a regression and accidental changed behavior shipped in
8.18.0 (via 6b9c75e219cdcfd3e17e78).

When the setopt is set to "" and curl is built without support for a
single compression algorithm, it used to use "identity" but recently did
not.

Spotted by Codex Security
Closes #20805

3 months agotool_doswin: avoid memory-leak with CURL_FN_SANITIZE_*
Daniel Stenberg [Tue, 3 Mar 2026 21:57:46 +0000 (22:57 +0100)] 
tool_doswin: avoid memory-leak with CURL_FN_SANITIZE_*

This is debug-only code

Follow-up to 20900e4a1e3

Found by Codex Security

Closes #20804

3 months agotool_operate: reset the URL --url-query between --next
Daniel Stenberg [Tue, 3 Mar 2026 17:50:20 +0000 (18:50 +0100)] 
tool_operate: reset the URL --url-query between --next

Pointed out by Codex Security

Verify in test 1624
Closes #20802

3 months agoopenssl+ech: workaround for insecure handshakes
Stefan Eissing [Thu, 5 Mar 2026 12:56:49 +0000 (13:56 +0100)] 
openssl+ech: workaround for insecure handshakes

OpenSSL 4.0.0-dev supports ECH with one flaw. If peer verification
is not enabled, it will report SSL_ECH_STATUS_BAD_NAME on the ECH
status.

Provide a workaround in libcurl that checks the inner name used in
ECH was the peer's hostname, both verify peer and host are disabled
and then accept the BAD_NAME without failing the connect.

Fixes #20655
Reported-by: Dexter Gerig
Closes #20821

3 months agoasync-ares: blocking resolve timeout handling, better
Stefan Eissing [Thu, 5 Mar 2026 09:20:58 +0000 (10:20 +0100)] 
async-ares: blocking resolve timeout handling, better

Perform the actual timeout calculation in the blocking resolv
loop each time in the same way, keeping the logic simpler.

The previous version calculated the timeout once, and then
reduced it by the elapsed time spent in polling/processing.
This is unnecessarily complicated.

Closes #20819

3 months agourldata: byebye `conn->hostname_resolve`
Stefan Eissing [Fri, 6 Mar 2026 10:09:29 +0000 (11:09 +0100)] 
urldata: byebye `conn->hostname_resolve`

The strdup() of the hostname to resolve is unnecessary as the sync
resolve code does not keep the string and the async code makes copies
already.

Remove the member from `connectdata`.

Closes #20833

3 months agocmake: fix `LOCATION` property access condition (debug)
Viktor Szakats [Fri, 6 Mar 2026 14:18:31 +0000 (15:18 +0100)] 
cmake: fix `LOCATION` property access condition (debug)

To match other parts of curl's CMake script and the CMake source.

Ref: https://gitlab.kitware.com/cmake/cmake/-/blob/v3.18.0/Source/cmTargetPropertyComputer.h?ref_type=tags#L68-101

Follow-up to c6cfb2a2f34df80c6d746d1cb07705d3fac7e67a #20828

Closes #20838

3 months agocmake: improve clang-tidy test command-line reproduction
Viktor Szakats [Fri, 6 Mar 2026 00:51:30 +0000 (01:51 +0100)] 
cmake: improve clang-tidy test command-line reproduction

- also query `INTERFACE_COMPILE_DEFINITIONS` and
  `INTERFACE_COMPILE_OPTIONS`.
  To further sync clang-tidy manual command-lines with the C compiler
  command-lines generated by CMake. In practice this adds `-I` options
  (via `INTERFACE_COMPILE_OPTIONS`) to the end of the command-line for
  dependency header directories. It does not change the outcome of
  clang-tidy runs.

- limit querying `COMPILE_DEFINITIONS` and `COMPILE_OPTIONS` to the top
  target, the test itself. To not include options such as
  `-DCURL_HIDDEN_SYMBOLS` and `-fvisibility=hidden` (when set) via
  the libcurl shared lib.
  To sync with the actual C compiler command-line.

- drop redundant `unset()`.

- rename local function to be more specific.

Follow-up to d9386a2f8ec3c4bd5ababc4eeb96ecd3e522b77c #20759

Closes #20829

3 months agocmake: fix `LOCATION` property read errors in target debug function
Viktor Szakats [Fri, 6 Mar 2026 02:42:41 +0000 (03:42 +0100)] 
cmake: fix `LOCATION` property read errors in target debug function

Exclude reading certain props for certain target types to avoid these errors:
```
CMake Error at CMake/Utilities.cmake:71 (get_property):
  The LOCATION property may not be read from target "...".  Use the target
  name directly with add_custom_command, or use the generator expression
  $<TARGET_FILE>, as appropriate.
```
(and the same in line 78.)

Follow-up to 855acb3bb07e0dd06b5722218eb5fded333f7ce0 #17701

Closes #20828