]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
36 hours agocmake: disable `CURL_CA_PATH` auto-detection if `USE_APPLE_SECTRUST=ON`
Viktor Szakats [Thu, 6 Nov 2025 01:20:12 +0000 (02:20 +0100)] 
cmake: disable `CURL_CA_PATH` auto-detection if `USE_APPLE_SECTRUST=ON`

Syncing behavior with `CURL_CA_BUNDLE` and autotools.

`/etc/ssl/certs` is empty by default on macOS systems, thus no likely
auto-detection finds something there.

Follow-up to eefd03c572996e5de4dec4fe295ad6f103e0eefc #18703

Closes #19380

36 hours agoconncache: silence `-Wnull-dereference` on gcc 14 RISC-V 64
Viktor Szakats [Wed, 5 Nov 2025 18:53:30 +0000 (19:53 +0100)] 
conncache: silence `-Wnull-dereference` on gcc 14 RISC-V 64

A false positive that appeared after a recent patch for no reason.

Seen in curl-for-win unity native Linux builds on debian:testing and
debian:trixie with gcc 14.3.0 and 14.2.0 respectively:
```
-- curl version=[8.17.1-DEV]
-- The C compiler identification is GNU 14.2.0
-- Cross-compiling: Linux/x86_64 -> Linux/riscv64
[...]
lib/conncache.c: In function 'Curl_cpool_conn_now_idle':
lib/conncache.c:539:11: error: null pointer dereference [-Werror=null-dereference]
  539 |   if(!data->multi->maxconnects) {
      |       ~~~~^~~~~~~
```
Ref: https://github.com/curl/curl-for-win/actions/runs/19111497271/job/54609512969#step:3:5788

```
-- The C compiler identification is GNU 14.3.0
```
Ref: https://github.com/curl/curl-for-win/actions/runs/19111497271/job/54609512899#step:3:5801

Patch confirmed silencing:
https://github.com/curl/curl-for-win/actions/runs/19112580362/job/54613288202

Follow-up to fbc4d59151dc4a56052f3a92da3682dc97b32148 #19271

Closes #19378

36 hours agognutls: report accurate error when TLS-SRP is not built-in
Viktor Szakats [Tue, 4 Nov 2025 17:37:49 +0000 (18:37 +0100)] 
gnutls: report accurate error when TLS-SRP is not built-in

With GnuTLS 3.8.0+ the build-time SRP feature detection always succeeds.
It's also disabled by default in these GnuTLS versions.

When using TLS-SRP without it being available in GnuTLS, report
the correct error code `CURLE_NOT_BUILT_IN`, replacing the out of memory
error reported before this patch.

Also add comments to autotools and cmake scripts about this feature
detection property.

Detecting it at build-time would need to run code which doesn't work
in cross-builds. Once curl requires 3.8.0 as minimum, the build-time
checks can be deleted.

```
# before:
curl: (27) gnutls_srp_allocate_client_cred() failed: An unimplemented or disabled feature has been requested.
# after:
curl: (4) GnuTLS: TLS-SRP support not built in: An unimplemented or disabled feature has been requested.
```

Ref: https://github.com/gnutls/gnutls/commit/dab063fca2eecb9ff1db73234108315c5b713756
Ref: https://github.com/gnutls/gnutls/commit/a21e89edacfe4ec3c501b030fff59c11fd20dcf0

Closes #19365

36 hours agotool_operate: remove redundant condition
Daniel Stenberg [Thu, 6 Nov 2025 08:52:30 +0000 (09:52 +0100)] 
tool_operate: remove redundant condition

And avoid an early return.

Pointed out by CodeSonar

Closes #19381

36 hours agotool_ipfs: check return codes better
Daniel Stenberg [Thu, 6 Nov 2025 09:00:52 +0000 (10:00 +0100)] 
tool_ipfs: check return codes better

Closes #19382

2 days agodocs: fix checksrc `EQUALSPACE` warnings
Viktor Szakats [Wed, 5 Nov 2025 20:21:34 +0000 (21:21 +0100)] 
docs: fix checksrc `EQUALSPACE` warnings

```
docs/libcurl/opts/CURLOPT_SSL_CTX_DATA.md:86:16
docs/libcurl/opts/CURLOPT_SSL_CTX_FUNCTION.md:139:16
```

Also sync `CURL *` and result variable names with rest of docs.

Follow-up to 6d7e924e80096a7e2cebad16235674fd3d3012af #19375

Closes #19379

2 days agotests/Makefile.am: fix 'checksrc' target
Daniel Stenberg [Wed, 5 Nov 2025 14:16:00 +0000 (15:16 +0100)] 
tests/Makefile.am: fix 'checksrc' target

Skip the http and client subdirs as they contain no code to check. The
http clients are in libtests/ now.

Closes #19376

2 days agotests: Add tests to validate that path is ignored with -J
Dan Fandrich [Tue, 4 Nov 2025 16:25:41 +0000 (08:25 -0800)] 
tests: Add tests to validate that path is ignored with -J

curl is correctly dropping the Content-Disposition: filename path, but
there was no test ensuring that.

Ref: https://hackerone.com/reports/3408126

2 days agoGHA/checksrc: add actionlint, fix or silence issues found
Viktor Szakats [Wed, 5 Nov 2025 01:50:42 +0000 (02:50 +0100)] 
GHA/checksrc: add actionlint, fix or silence issues found

It also does shellcheck on `run:` elements, overlapping with
the homegrown `shellcheck-ci.sh` with the same purpose. But it also does
more and perhaps could replace the script too, especially in curl
sub-repos.

Also:
- GHA/macos: delete potentially useful, but commented, and ultimately
  unused, non-default Xcode-testing logic. It's causing unused matrix
  exceptions, upsetting actionlint.

Ref: https://github.com/rhysd/actionlint

Closes #19373

2 days agotests: shorten space and tab macro names
Viktor Szakats [Tue, 4 Nov 2025 03:05:19 +0000 (04:05 +0100)] 
tests: shorten space and tab macro names

Easier to write and read.

Follow-up to d29f14b9cf0d38f3887b6eadc71af16903bc7f5b #19300

Closes #19349

2 days agoDockerfile: update debian:bookworm-slim digest to 936abff
renovate[bot] [Tue, 4 Nov 2025 10:52:26 +0000 (10:52 +0000)] 
Dockerfile: update debian:bookworm-slim digest to 936abff

Closes #19348

2 days agochecksrc.pl: detect assign followed by more than one space
Daniel Stenberg [Wed, 5 Nov 2025 13:40:18 +0000 (14:40 +0100)] 
checksrc.pl: detect assign followed by more than one space

And fix some code previously doing this.

Closes #19375

2 days agotests: remove trailing spaces in server responses
Daniel Stenberg [Wed, 5 Nov 2025 13:30:41 +0000 (14:30 +0100)] 
tests: remove trailing spaces in server responses

Allows us to drop lots of %spc% from test cases making them easier on
the eye.

Closes #19374

2 days agoopenssl: remove code handling default version
Daniel Stenberg [Tue, 4 Nov 2025 09:17:28 +0000 (10:17 +0100)] 
openssl: remove code handling default version

Since it is no longer actually kept as default internally, that's just
dead code.

Follow-up to 9d8998c99408e1adf8eba629fad9f
Closes #19354

2 days agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 5 Nov 2025 13:12:23 +0000 (14:12 +0100)] 
RELEASE-NOTES: synced

bumped to 8.17.1 for now

fixed typo in THANKS-filter

2 days agogtls: add return checks and optimize the code
x2018 [Tue, 4 Nov 2025 18:16:54 +0000 (02:16 +0800)] 
gtls: add return checks and optimize the code

This commit does the following things:

1. Update the description of gtls_init()

2. In gtls_client_init(), check the invaild SSLVERSION at first. Note
   that this part refactors the duplicate/incompatible checks and removes
   the useless local variable `sni`.

3. Check the return value of gnutls_ocsp_resp_init(). Although the
   original code is safe because gnutls_ocsp_resp_import() will check
   the validity of `ocsp_resp`, it is better to catch the error in time
   and record the proper message to output log.

Closes #19366

2 days agolib: cleanup for some typos about spaces and code style
x2018 [Wed, 5 Nov 2025 07:28:56 +0000 (15:28 +0800)] 
lib: cleanup for some typos about spaces and code style

Closes #19370

2 days agom4/sectrust: fix test(1) operator
Thomas Klausner [Wed, 5 Nov 2025 09:10:03 +0000 (10:10 +0100)] 
m4/sectrust: fix test(1) operator

'=' is the operator defined by POSIX, only bash supports '=='

Closes #19371

2 days agoGHA/non-native: revert to OpenBSD 7.7 due to test hangs with 7.8
Viktor Szakats [Wed, 5 Nov 2025 09:18:32 +0000 (10:18 +0100)] 
GHA/non-native: revert to OpenBSD 7.7 due to test hangs with 7.8

test 701 (SOCKS5) and 708 (SOCKS4) started hanging occasionally, and
most likely others too.

https://github.com/curl/curl/actions/runs/19081279902/job/54510279013 (701 hangs) https://github.com/curl/curl/actions/runs/19095657593/job/54555001348?pr=19370 (708 hangs)
https://github.com/curl/curl/actions/runs/19097996671/job/54562669865?pr=19371 (unknown test hangs)

Reverts c3b890b2c005401e18b54dacf9e63d33412e2b4f #19368

Closes #19372

2 days agoGHA/windows: switch a dl-mingw job to skeeto/w64devkit gcc 15.1.0
Viktor Szakats [Tue, 4 Nov 2025 23:57:21 +0000 (00:57 +0100)] 
GHA/windows: switch a dl-mingw job to skeeto/w64devkit gcc 15.1.0

To add another, so far untested standalone toolchain variant to the mix.
This distro is a fairly compact, GCC mingw-w64.

Replacing an existing 15.0.1 snapshot toolchain build job.

Ref: https://github.com/skeeto/w64devkit/releases

Closes #19369

2 days agoRELEASE-NOTES: synced curl-8_17_0
Daniel Stenberg [Mon, 3 Nov 2025 21:41:16 +0000 (22:41 +0100)] 
RELEASE-NOTES: synced

version 8.17.0 relese

2 days agoVERSIONS: 8.18.0 is now pending
Daniel Stenberg [Wed, 5 Nov 2025 06:59:38 +0000 (07:59 +0100)] 
VERSIONS: 8.18.0 is now pending

2 days agoTHANKS: add contributors from 8.17.0
Daniel Stenberg [Wed, 5 Nov 2025 06:57:10 +0000 (07:57 +0100)] 
THANKS: add contributors from 8.17.0

3 days agoGHA/non-native: bump to OpenBSD 7.8
Viktor Szakats [Tue, 4 Nov 2025 20:01:32 +0000 (21:01 +0100)] 
GHA/non-native: bump to OpenBSD 7.8

Follow-up to e5cc5640b37672bd18d7561bc45c5dd91271753a #19367

Closes #19368

3 days agoGHA: update cross-platform-actions/action action to v0.30.0
renovate[bot] [Tue, 4 Nov 2025 19:41:30 +0000 (19:41 +0000)] 
GHA: update cross-platform-actions/action action to v0.30.0

Closes #19367

3 days agogtls: check the return value of gnutls_pubkey_init()
x2018 [Tue, 4 Nov 2025 15:27:49 +0000 (23:27 +0800)] 
gtls: check the return value of gnutls_pubkey_init()

Closes #19362

3 days agocmake: fix `HAVE_GNUTLS_SRP` detection after adding local FindGnuTLS module
Viktor Szakats [Tue, 4 Nov 2025 14:26:29 +0000 (15:26 +0100)] 
cmake: fix `HAVE_GNUTLS_SRP` detection after adding local FindGnuTLS module

When GnuTLS is detected via pkg-config on a non-default path, e.g. with
Homebrew arm64 (`/opt/homebrew/`).

This was a regression from a commit made in this release cycle.

The Find module doesn't return an absolute path to the detected library
(as the former solution did), but a bare libname and a libpath. We thus
need to explicitly use the libpath while detecting a feature in GnuTLS
found this way. Syncing this with other dependencies.

Follow-up to 1966c86d71eb90beeeb3ccbefd6321bd64992553 #19163

Closes #19360

3 days agoHISTORY: extend
Daniel Stenberg [Tue, 4 Nov 2025 15:10:09 +0000 (16:10 +0100)] 
HISTORY: extend

With recent events and some more in the past

Closes #19361

3 days agowcurl: import v2025.11.04
Samuel Henrique [Tue, 4 Nov 2025 08:33:28 +0000 (08:33 +0000)] 
wcurl: import v2025.11.04

Closes #19353

3 days agotool_ipfs: check the return value of curl_url_get for gwpath
x2018 [Tue, 4 Nov 2025 08:49:28 +0000 (16:49 +0800)] 
tool_ipfs: check the return value of curl_url_get for gwpath

Closes #19358

3 days agotests: remove most user-agent filters
Daniel Stenberg [Tue, 4 Nov 2025 10:22:32 +0000 (11:22 +0100)] 
tests: remove most user-agent filters

Use the %VERSION instead. The user-agent stripping was introduced at the
time before we had %VERSION (introduced in e6b21d4). The tests would
then remove the user-agent header to make them possible to be compared
in a version independent way.

Fixes #19355
Reported-by: Stefan Eissing
Closes #19356

3 days agoCURLOPT_COPYPOSTFIELDS.md: used with MQTT and RTSP as well
Daniel Stenberg [Tue, 4 Nov 2025 07:44:28 +0000 (08:44 +0100)] 
CURLOPT_COPYPOSTFIELDS.md: used with MQTT and RTSP as well

Follow-up to 5ec87346a9bfad1a24f97c3785

Closes #19351

3 days agoBINDINGS: change dead link to archive.org version
Daniel Stenberg [Tue, 4 Nov 2025 07:50:11 +0000 (08:50 +0100)] 
BINDINGS: change dead link to archive.org version

The Hollywood binding host name www.hollywood-mal.com does not seem to
work anymore.

Closes #19352

4 days agoREADME.md: use the first paragraph from the man page
Daniel Stenberg [Mon, 3 Nov 2025 13:40:36 +0000 (14:40 +0100)] 
README.md: use the first paragraph from the man page

Which also mentions all protocols

Closes #19335

4 days agoCURLOPT_POSTFIELDSIZE*: these also work for MQTT and RTSP
Daniel Stenberg [Mon, 3 Nov 2025 19:25:43 +0000 (20:25 +0100)] 
CURLOPT_POSTFIELDSIZE*: these also work for MQTT and RTSP

Closes #19346

4 days agortsp: use explicit postfieldsize if specified
Joshua Rogers [Mon, 3 Nov 2025 16:15:22 +0000 (00:15 +0800)] 
rtsp: use explicit postfieldsize if specified

Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com>
Closes #19345

4 days agotests: avoid hard-coded CRLFs in more sections
Viktor Szakats [Fri, 31 Oct 2025 14:50:01 +0000 (15:50 +0100)] 
tests: avoid hard-coded CRLFs in more sections

- `reply/data*`, `verify/stdout`, `verify/stderr`, `verify/file*`,
  `verify/proxy`:
  - make `crlf="yes"` force CRLF to all lines, instead of just applying
    to HTTP protocol headers.
  - add support for `crlf="headers"` that only converts HTTP protocol
    header lines to CRLF. (previously done via `crlf="yes"`.)
  - use `crlf="headers"` where possible.

- `reply/connect*`:
  - add support for `crlf="yes"` and `crlf="headers"`.
  - use them where possible.

- `client/file*`, `client/stdin`:
  - add support for `crlf="yes"`.
  - use it where possible.

- `reply/data*`, `verify/protocol`:
  - replace existing uses of `crlf="yes"` with `crlf="headers`" where it
    does not change the result.

Reducing the number of `tests/data/test*`:
- CRLF newlines from 10295 to 1985. (119985 lines total)
- files with mixed newlines from 656 to 113. (1890 files total)

After this patch there remain 141 sections with mixed newlines, where
the mixing is not split between headers/non-headers. There is no obvious
pattern here. Some of the CRLF uses might be accidental, or
non-significant. They will be tackled in a future patch.

Follow-up to 6cf3d7b1b161bc45501d17b401225befe3c43943 #19318
Follow-up to 4d2a05d3fe8ba4db9168b03057029ea5ce7dab77 #19284

Closes #19313

4 days agomulti: check the return value of strdup()
x2018 [Mon, 3 Nov 2025 17:12:42 +0000 (01:12 +0800)] 
multi: check the return value of strdup()

Closes #19344

4 days agohttp: check the return value of strdup
x2018 [Mon, 3 Nov 2025 16:47:36 +0000 (00:47 +0800)] 
http: check the return value of strdup

Closes #19343

4 days agovtls: check final cfilter node in find_ssl_filter
Joshua Rogers [Fri, 24 Oct 2025 19:49:58 +0000 (03:49 +0800)] 
vtls: check final cfilter node in find_ssl_filter

find_ssl_filter used while(cf && cf->next) and skipped the last node.
If the SSL filter was last, channel binding lookup failed and we returned
CURLE_BAD_FUNCTION_ARGUMENT. Switch to while(cf) so the tail is examined.

This bug was found with ZeroPath.

Closes #19229

4 days agogssapi: make channel binding conditional on GSS_C_CHANNEL_BOUND_FLAG
Devdatta Talele [Mon, 20 Oct 2025 15:21:43 +0000 (20:51 +0530)] 
gssapi: make channel binding conditional on GSS_C_CHANNEL_BOUND_FLAG

Fixes #19109 - GSSAPI authentication fails on macOS with Apple's Heimdal
implementation which lacks GSS_C_CHANNEL_BOUND_FLAG support for TLS
channel binding.

Commit 0a5ea09a910e introduced TLS channel binding for SPNEGO/GSSAPI
authentication unconditionally, but Apple's Heimdal fork (used on macOS)
does not support this feature, causing "unsupported mechanism" errors
when authenticating to corporate HTTP services with Kerberos.

Solution:
- Add CURL_GSSAPI_HAS_CHANNEL_BINDING detection in curl_gssapi.h based
  on GSS_C_CHANNEL_BOUND_FLAG presence (MIT Kerberos >= 1.19)
- Make negotiatedata.channel_binding_data field conditional in vauth.h
- Guard channel binding collection/cleanup in http_negotiate.c
- Guard channel binding usage in spnego_gssapi.c

This follows the same pattern as GSS_C_DELEG_POLICY_FLAG detection and
ensures graceful degradation when channel binding is unavailable while
maintaining full support for implementations that have it.

Changes:
- lib/curl_gssapi.h: Add feature detection macro
- lib/vauth/vauth.h: Make struct field conditional
- lib/http_negotiate.c: Conditional init/cleanup (2 locations)
- lib/vauth/spnego_gssapi.c: Conditional channel binding usage

Tested on macOS with Apple Heimdal (no channel binding) and Linux with
MIT Kerberos (with channel binding). Both configurations authenticate
successfully without errors.

Closes #19164

4 days agoopenssl: check CURL_SSLVERSION_MAX_DEFAULT properly
Stefan Eissing [Mon, 3 Nov 2025 15:01:56 +0000 (16:01 +0100)] 
openssl: check CURL_SSLVERSION_MAX_DEFAULT properly

The definition of these constants does not give a numeric ordering
and MAX_DEFAULT needs to be checked in addition of ciphers and QUIC
checks to apply correctly.

Fixes #19340
Reported-by: Peter Piekarski
Closes #19341

4 days agocw-out: fix EAGAIN handling on pause
Stefan Eissing [Mon, 3 Nov 2025 14:07:57 +0000 (15:07 +0100)] 
cw-out: fix EAGAIN handling on pause

The interim CURLE_AGAIN result was not always converted to a
CURLE_OK and then caused write callers to report a failure.

Fixes #19334
Reported-by: pennae on github
Closes #19338

4 days agoREUSE: add copyright header to two files
Viktor Szakats [Mon, 3 Nov 2025 14:24:27 +0000 (15:24 +0100)] 
REUSE: add copyright header to two files

`.mailmap` supports comments and empty lines since at least 2.31.0:
https://git-scm.com/docs/gitmailmap/2.31.0

Closes #19339

4 days agoftpserver.pl: fix newlines in 227/229 replies, adjust tests
Viktor Szakats [Sun, 2 Nov 2025 22:25:27 +0000 (23:25 +0100)] 
ftpserver.pl: fix newlines in 227/229 replies, adjust tests

The test FTP server returned LF newlines for 227/229 replies, instead of
the CRLF used for the rest.

Test data added later were explicitly made to expect an LF in these
response lines.

After this patch the FTP server returns CRLF newlines, allowing
to delete this special case in test data.

Follow-up to 3bfff57e1f604ef0b2bc84243014eb9c9a1e6acc
Follow-up to a7937ed49c8f201444323b8a721e1d04e0306105

Closes #19330

4 days agotest696: decouple from test556 data
Viktor Szakats [Sun, 2 Nov 2025 15:00:24 +0000 (16:00 +0100)] 
test696: decouple from test556 data

Test 696 and 556 share the same libtest code. Make sure to issue
the `GET` request to the correct runtime test number instead of using
the hard-wired "556".

It makes the `sws` test server read the response string from `test696`
`<data>` section, instead of reading it from `test556`. To avoid this
hidden interaction between test data.

AFAICS there is no other similar hard-coded string in reused libtests.

Ref: https://github.com/curl/curl/pull/19313#issuecomment-3477448933
Follow-up to be82a3605a4b539580b3de776ffcca25b8770e43 #16003
Closes #19329

4 days agoimap: avoid integer overflow
Daniel Stenberg [Mon, 3 Nov 2025 07:05:35 +0000 (08:05 +0100)] 
imap: avoid integer overflow

Follow-up to e64c28e243d797da4ef76d6e8959

Spotted by OSS-Fuzz

Closes #19332

5 days agoRELEASE-NOTES: synced
Daniel Stenberg [Sun, 2 Nov 2025 22:09:54 +0000 (23:09 +0100)] 
RELEASE-NOTES: synced

5 days agohttp_aws_sigv4: check the return value of curl_maprintf()
x2018 [Sun, 2 Nov 2025 05:28:34 +0000 (13:28 +0800)] 
http_aws_sigv4: check the return value of curl_maprintf()

Closes #9328

5 days agoGHA/dependabot: tidy-ups
Viktor Szakats [Sun, 2 Nov 2025 16:45:33 +0000 (17:45 +0100)] 
GHA/dependabot: tidy-ups

5 days agoGHA: bump the pip-dependencies group across 2 directories with 3 updates
dependabot[bot] [Sat, 1 Nov 2025 14:19:58 +0000 (14:19 +0000)] 
GHA: bump the pip-dependencies group across 2 directories with 3 updates

Closes #19321

5 days agoGHA/dependabot: fix update group names
Viktor Szakats [Sun, 2 Nov 2025 16:10:00 +0000 (17:10 +0100)] 
GHA/dependabot: fix update group names

5 days agoruntests: fix Perl warning after recent patch
Viktor Szakats [Sun, 2 Nov 2025 03:45:05 +0000 (04:45 +0100)] 
runtests: fix Perl warning after recent patch

```
Use of uninitialized value $hash{"crlf"} in string eq at tests/runtests.pl line 1406.
```

Follow-up to 6cf3d7b1b161bc45501d17b401225befe3c43943 #19318
Closes #19327

6 days agotests: avoid more hard-coded CRLFs in `protocol` sections
Viktor Szakats [Sat, 1 Nov 2025 00:28:55 +0000 (01:28 +0100)] 
tests: avoid more hard-coded CRLFs in `protocol` sections

- fix regex to not catch CR (from CRLF), in `PORT`, `EPRT`
  commands, allowing to use `crlf="yes"` more.
- add `crlf="headers"` mode for `protocol` sections.
  To call `subnewlines()` without its force option.
  This is the mode used in `data` sections when `crlf="yes"`.
  (This confusion may be subject to a future commit.)
- subnewlines: apply CRLF to `HEAD` and `CONNECT` HTTP requests.
- subnewlines: apply CRLF to RTSP requests.
- delete remaining empty `protocol` sections.

Reducing the number of `tests/data/test*`:
- CRLF newlines from 11325 to 10295. (119984 lines total)
- files with mixed newlines from 707 to 656. (1890 files total)

Follow-up to 4d2a05d3fe8ba4db9168b03057029ea5ce7dab77 #19284

Closes #19318

6 days agovtls: properly handle SSL shutdown timeout
x2018 [Sat, 1 Nov 2025 15:28:07 +0000 (23:28 +0800)] 
vtls: properly handle SSL shutdown timeout

Closes #19323

6 days agodoh: cleanup resources on error paths
x2018 [Fri, 31 Oct 2025 19:43:26 +0000 (03:43 +0800)] 
doh: cleanup resources on error paths

Closes #19310

6 days agohttpsrr: send HTTPS query to the right target
Daniel Stenberg [Sat, 1 Nov 2025 19:21:25 +0000 (20:21 +0100)] 
httpsrr: send HTTPS query to the right target

When the target host is on a different port than 443, the name
"_[port]._https.[name]" shall be used.

Fixes #19301
Reported-by: Gunni on github
Closes #19324

6 days agotests/data: delete stray CRLFs in markup lines
Viktor Szakats [Sat, 1 Nov 2025 03:02:13 +0000 (04:02 +0100)] 
tests/data: delete stray CRLFs in markup lines

Closes #19317

6 days agoCI: two display name tweaks
Viktor Szakats [Fri, 31 Oct 2025 23:47:21 +0000 (00:47 +0100)] 
CI: two display name tweaks

- use `AM`/`CM` where missing.
  In GHA/linux-old and AppVeyor CI.
  To denote autotools and CMake, and to align with rest of the jobs.

- rename `Old Linux` to `Linux Old` to align with the rest of Linux
  jobs on GitHub web views sorted by name.

Closes #19316

7 days agotests: replace standalone significant tabs with macro
Viktor Szakats [Fri, 31 Oct 2025 22:25:17 +0000 (23:25 +0100)] 
tests: replace standalone significant tabs with macro

Follow-up to d29f14b9cf0d38f3887b6eadc71af16903bc7f5b #19300

Closes #19315

7 days agotests/libtest: consistent variable naming for easy/multi/share handles
Viktor Szakats [Fri, 31 Oct 2025 17:36:43 +0000 (18:36 +0100)] 
tests/libtest: consistent variable naming for easy/multi/share handles

Follow-up to 928363f28ca533d743adcb70597c3e30917c6cbd #19299

Closes #19311

7 days agoscorecard: more params for upload tests
Stefan Eissing [Fri, 31 Oct 2025 15:44:38 +0000 (16:44 +0100)] 
scorecard: more params for upload tests

Add --upload-parallel=n for controlling upload parallelism. Make upload
processing similar to download processing.

Closes #19302

7 days agoschannel: properly close the certfile on error
x2018 [Fri, 31 Oct 2025 15:58:52 +0000 (23:58 +0800)] 
schannel: properly close the certfile on error

Closes #19304

7 days agoopenssl: combine all the x509-store flags
Daniel Stenberg [Fri, 31 Oct 2025 16:22:36 +0000 (17:22 +0100)] 
openssl: combine all the x509-store flags

... intead of overwriting the previous ones in ossl_populate_x509_store()

Pointed out by ZeroPath

Closes #19306

7 days agosectrust: fix verifystatus via sectrust
Stefan Eissing [Fri, 31 Oct 2025 16:57:53 +0000 (17:57 +0100)] 
sectrust: fix verifystatus via sectrust

When openssl does not verify the certificate, but apple sectrust
does, we also pass it the ocsp stapled response when configured and
available.

When openssl does not verify the cert chain, it will also not be able
to verify the ocsp stapling. Do not call it if sectrust is the
verifier of the cert chain.

Fixes #19307
Reported-by: Harry Sintonen
Closes #19308

7 days agoopenssl: fix the ocsp len arg to Curl_vtls_apple_verify
Daniel Stenberg [Fri, 31 Oct 2025 16:09:31 +0000 (17:09 +0100)] 
openssl: fix the ocsp len arg to Curl_vtls_apple_verify

If it has no data, pass in a zero.

Fixes #19303
Reported-by: Harry Sintonen
Closes #19305

7 days agospelling: fix new finds by typos-cli 1.39.0
Viktor Szakats [Fri, 31 Oct 2025 20:17:31 +0000 (21:17 +0100)] 
spelling: fix new finds by typos-cli 1.39.0

Closes #19312

7 days agotests/libtest/cli*: fix init/deinit, leaks, and more
Viktor Szakats [Fri, 31 Oct 2025 16:36:27 +0000 (17:36 +0100)] 
tests/libtest/cli*: fix init/deinit, leaks, and more

- add global init and deinit where missing.
- check global init success.
- improve cleaning up on error codepaths.
- drop `CLI_ERR()` macro, that could quit.
  Also make error messages tell the reason.

Closes #19309

7 days agotests: replace significant invisible spaces with macros
Viktor Szakats [Thu, 30 Oct 2025 23:55:13 +0000 (00:55 +0100)] 
tests: replace significant invisible spaces with macros

To make them explicit, visible, avoid being accidentally trimmed.
Also prevents Git warnings, e.g. on `git am`.

Also:
- runtests: add support for `%spc%` and `%tab%` macros.
- test59: delete non-significant line-ending space.
- spacecheck.pl: drop line-ending whitespace exception for tests.

Closes #19300

7 days agoexamples: consistent variable naming across examples
Daniel Stenberg [Fri, 31 Oct 2025 13:42:30 +0000 (14:42 +0100)] 
examples: consistent variable naming across examples

- 'CURL *' handles are called 'curl'
- 'CURLM *' handles are called 'multi'
- write callbacks are called 'write_cb'
- read callbacs are called 'read_cb'
- CURLcode variables are called 'res'

It makes the examples look and feel more consistent. It allows for
easier copy and pasting between examples.

Closes #19299

7 days agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 31 Oct 2025 15:28:13 +0000 (16:28 +0100)] 
RELEASE-NOTES: synced

7 days agoBINDINGS.md: point flaky URL to archive.org
Viktor Szakats [Sat, 25 Oct 2025 09:06:40 +0000 (11:06 +0200)] 
BINDINGS.md: point flaky URL to archive.org

To avoid linkcheck CI fails. It was failing regularly in the last months.

7 days agoscp/sftp: fix disconnect
Stefan Eissing [Fri, 31 Oct 2025 12:46:18 +0000 (13:46 +0100)] 
scp/sftp: fix disconnect

When a SCP/SFTP connection calls the protocol handler disconnect, it
required the connections *and* the easy handles SSH meta data to be
present. When the disconnect is called with an admin handle, the easy
meta data is not present, which prevented the shutdown to run.

The easy meta data is however not necessary to run the shutdown state
machine. Calling it with a NULL `sshp` is fine. To avoid any mixups,
check `sshp` in state operations that need it.

Fixes #19293
Reported-by: And-yW on github
Closes #19295

7 days agotest446, 1034, 1160: set US-ASCII encoding in XML header
Viktor Szakats [Fri, 31 Oct 2025 13:35:32 +0000 (14:35 +0100)] 
test446, 1034, 1160: set US-ASCII encoding in XML header

To match the ASCII-7 requirement for curl test data files.

Follow-up to 9243ed59b387a90940fa4a16ebfd99ad7d6c2f63 #17329
Follow-up to 87ba80a6df1dfd7ceaaa52352c9f23afff0ed513

Closes #19297

7 days agotest429: use `%repeat[]%`
Viktor Szakats [Thu, 30 Oct 2025 18:24:13 +0000 (19:24 +0100)] 
test429: use `%repeat[]%`

Follow-up to eb22e37060a8f3ad4fd9511db136c1edbb3b2a85 #19281
Follow-up to 55d4767876eae8678ab069082aa7fe8fe316a021 #19279

Closes #19296

7 days agotests: use `crlf=yes` attribute more
Viktor Szakats [Thu, 30 Oct 2025 14:46:17 +0000 (15:46 +0100)] 
tests: use `crlf=yes` attribute more

To make special newlines more explicit and visible.
Mostly in `<protocol>` sections, some in `<data*>` and `<upload>`.

Reducing the number of `tests/data/test*`:
- CRLF newlines from 21535 to 11337.
- files with mixed newlines from 1335 to 707.

Also delete empty `<protocol>` sections.

Closes #19284

7 days agoexamples: fix more potential resource leaks, and more
Viktor Szakats [Fri, 31 Oct 2025 03:22:42 +0000 (04:22 +0100)] 
examples: fix more potential resource leaks, and more

Also:
- delete dead code.
- sync `http2-download.c` and `http2-upload.c` sources.
- simplessl: fix constant expression.
- simplessl: avoid `expression is constant` VS2010 warning, drop pragma.
- replace large stack buffers with dynamic allocation.
- http2-download: fix to fill transfer number.

Some of these were pointed out by TIOBE scanner via Coverity 2025.3.0.

Closes #19292

7 days agoexamples/http2-serverpush: fix file handle leaks
Viktor Szakats [Fri, 31 Oct 2025 02:33:14 +0000 (03:33 +0100)] 
examples/http2-serverpush: fix file handle leaks

Also:
- tests/libtest/cli_h2_serverpush: re-sync formatting.

Previously fixed in tests based on a local clang-tidy v20 report.

Pointed out by TIOBE scanner via Coverity 2025.3.0.
Follow-up to 83a8818cfebe5f2a4bab5c9ddc55fd64b5629296 #17706

Closes #19291

7 days agoftp: fix leaking internal buffer `newhost` on error
Viktor Szakats [Fri, 31 Oct 2025 02:41:53 +0000 (03:41 +0100)] 
ftp: fix leaking internal buffer `newhost` on error

Pointed out by TIOBE scanner via Coverity 2025.3.0.

Closes #19290

7 days agotest1100: fix missing `<protocol>` section
Viktor Szakats [Thu, 30 Oct 2025 22:21:00 +0000 (23:21 +0100)] 
test1100: fix missing `<protocol>` section

To make it actually run. Also fix the NTLM expected result, also syncing
it with other tests.

Follow-up to e6b21d422e631a7c0cc81abf956af179b3b4c5e8 #6037

Closes #19288

8 days agotool/var: explain how the null termination byte is there
Daniel Stenberg [Thu, 30 Oct 2025 17:18:22 +0000 (18:18 +0100)] 
tool/var: explain how the null termination byte is there

Closes #19287

8 days agotests: use %repeat[] to make tests smaller (cont.)
Viktor Szakats [Thu, 30 Oct 2025 11:57:06 +0000 (12:57 +0100)] 
tests: use %repeat[] to make tests smaller (cont.)

tests: 46, 265, 304, 316, 397, 443, 551, 552, 559, 651, 742, 775, 1003,
1005, 1006, 1008, 1062, 1070, 1086, 1112, 1151, 1160, 1178, 1192, 1193,
1205, 1237, 3207.

Total `test*` size reduction: 2,395,537 -> 2,165,631 bytes.

Follow-up to 55d4767876eae8678ab069082aa7fe8fe316a021 #19279

Closes #19281

8 days agoGHA: update libressl/portable to v4.2.1
renovate[bot] [Thu, 30 Oct 2025 14:41:48 +0000 (14:41 +0000)] 
GHA: update libressl/portable to v4.2.1

Closes #19283

8 days agobase64: make base64_encode() error on too long input
Daniel Stenberg [Thu, 30 Oct 2025 10:32:15 +0000 (11:32 +0100)] 
base64: make base64_encode() error on too long input

The maximum size is set to 16MB.

It should not possible to call this function with this large input, but
this is a precaution to catch mistakes and replaces the earlier check on
architectures with small size_t.

Closes #19280

8 days agolib: reduce memcpy calls
Daniel Stenberg [Thu, 30 Oct 2025 13:42:03 +0000 (14:42 +0100)] 
lib: reduce memcpy calls

socks_gssapi: the malloc + memcpy was superflous and can be skipped

cleartext: avoid malloc + three memcpy with aprintf()

digest_sspi: use memdup0 instead of malloc + memcpy

vtls: use memdup0 instead of malloc + memcpy

Closes #19282

8 days agoconncache: prevent integer overflow in maxconnects calculation
x2018 [Tue, 28 Oct 2025 15:35:45 +0000 (23:35 +0800)] 
conncache: prevent integer overflow in maxconnects calculation

Closes #19271

8 days agopop3: check for CAPA responses case insensitively
Daniel Stenberg [Thu, 30 Oct 2025 07:44:51 +0000 (08:44 +0100)] 
pop3: check for CAPA responses case insensitively

Reported by ZeroPath

Closes #19278

8 days agotests: use %repeat[] to make tests smaller
Daniel Stenberg [Thu, 30 Oct 2025 07:53:09 +0000 (08:53 +0100)] 
tests: use %repeat[] to make tests smaller

Avoid putting huge chunks of repeated texts in test cases.

test3206, test1060, test1061 and test22

Closes #19279

8 days agoimap: fix custom FETCH commands to handle literal responses
TheBitBrine [Sun, 26 Oct 2025 04:39:02 +0000 (04:39 +0000)] 
imap: fix custom FETCH commands to handle literal responses

Custom IMAP commands using -X (e.g. 'FETCH 123 BODY[1]') were only
returning the first line of responses containing literals, instead of
the full multi-line body data.

The issue was that custom commands route through imap_perform_list()
and imap_state_listsearch_resp(), which didn't detect or handle IMAP
literal syntax {size}.

This commit adds literal detection to imap_state_listsearch_resp():
- Detects literal syntax {size} in untagged responses
- Writes the response header line containing the literal marker
- Handles any literal body data already in the pingpong buffer
- Sets up transfer layer to read remaining literal data from socket
- Configures maxdownload and transfer size to include header + body
- Initializes pp->overflow to 0 when no buffered data present
- Modifies imap_done() to transition to FETCH_FINAL for custom
  commands that set up downloads

Test 841 and 3206 verify.

Fixes #18847
Reported-by: BohwaZ
Bug: https://github.com/curl/curl/issues/18847
Closes #19246

9 days agohttp: fix `-Wunused-variable` in !alt-svc !proxy !ws builds
Viktor Szakats [Wed, 29 Oct 2025 13:18:11 +0000 (14:18 +0100)] 
http: fix `-Wunused-variable` in !alt-svc !proxy !ws builds

```
lib/http.c:2783:23: error: unused variable 'conn' [-Werror,-Wunused-variable]
 2783 |   struct connectdata *conn = data->conn;
      |                       ^~~~
1 error generated.
```

Closes #19276

9 days agohttp: fix `-Wunreachable-code` in !websockets !unity builds
Viktor Szakats [Wed, 29 Oct 2025 12:31:23 +0000 (13:31 +0100)] 
http: fix `-Wunreachable-code` in !websockets !unity builds

Also requires non-unity build. Possibly more non-default options are
necessary to reproduce. Seen with llvm/clang.

```
lib/http.c:1856:15: error: code will never be executed [-Werror,-Wunreachable-code]
 1856 |     httpreq = HTTPREQ_GET;
      |               ^~~~~~~~~~~
1 error generated.
```

Closes #19275

9 days agongtcp2: overwrite rate-limits defaults
Stefan Eissing [Wed, 29 Oct 2025 08:48:50 +0000 (09:48 +0100)] 
ngtcp2: overwrite rate-limits defaults

In pytests test_08 with the Caddy server, the new rate-limiting in
ngtcp2 did close the connection because it found "too many" stream data
packet repeats.

It is unclear if this is some Caddy issue or if the ngtcp2 implementaton
is wrong. Or if curl can do anything here.

Reported as https://github.com/ngtcp2/ngtcp2/issues/1850

This PR overwrites the ratelimit defaults in ngtcp2 with ten times
increased values. This makes the errors disappear on macOS.

Enable test_08_04/05 in CI again to see if there are any issues
to be found there. (We had those disabled before having parallel
pytests.)

Closes #19274

9 days agoopenldap/ldap; check for binary attribute case insensitively
Daniel Stenberg [Wed, 29 Oct 2025 08:11:09 +0000 (09:11 +0100)] 
openldap/ldap; check for binary attribute case insensitively

This bug was found with ZeroPath

Fixes #19240
Reported-by: Joshua Rogers
Closes #19273

9 days agoGHA: update pyspelling to v2.12
renovate[bot] [Mon, 27 Oct 2025 20:57:13 +0000 (20:57 +0000)] 
GHA: update pyspelling to v2.12

Closes #19262

9 days agoGHA: update reuse to v6.2.0
renovate[bot] [Mon, 27 Oct 2025 15:33:24 +0000 (15:33 +0000)] 
GHA: update reuse to v6.2.0

Closes #19257

9 days agossl-session-cache: check use on config and availability
Stefan Eissing [Mon, 27 Oct 2025 09:33:41 +0000 (10:33 +0100)] 
ssl-session-cache: check use on config and availability

Replace the check if a ssl session cache is configured with
a function checking if it is configured *and* if an ssl session
cache is available.

During normal operations, a session cache is always there, however
for "connect-only" transfers this might not be the case. When such
transfers receive new sessions/tickets, they need to silently
discard those and not fail.

Reported-by: Marc Aldorasi
Fixes https://github.com/curl/curl/issues/18983
Closes https://github.com/curl/curl/pull/19251

9 days agotool_operate: move the checks that skip ca cert detection
Jay Satiro [Sun, 19 Oct 2025 15:42:37 +0000 (11:42 -0400)] 
tool_operate: move the checks that skip ca cert detection

- Move the checks into the function that needs them, cacertpaths().

Prior to this change the caller made the determination whether to skip
calling cacertpaths for cert detection. However for posterity it is
better to have the checks in cacertpaths since other code could call it.

Closes https://github.com/curl/curl/pull/19148

10 days agoRELEASE-NOTES: synced rc-8_17_0-3
Daniel Stenberg [Tue, 28 Oct 2025 22:33:16 +0000 (23:33 +0100)] 
RELEASE-NOTES: synced

10 days agotests: reduce max allowed allocations for four tests
Daniel Stenberg [Mon, 27 Oct 2025 16:18:25 +0000 (17:18 +0100)] 
tests: reduce max allowed allocations for four tests

and completely remove the check for one

Closes #19260

10 days agoschannel: handle Curl_conn_cf_send() errors better
Daniel Stenberg [Tue, 28 Oct 2025 08:05:25 +0000 (09:05 +0100)] 
schannel: handle Curl_conn_cf_send() errors better

Avoid a resource leak in the error path.

Reported-by: Joshua Rogers
Closes #19265