]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
3 weeks agoconn: fix hostname move on connection reuse
Stefan Eissing [Fri, 10 Oct 2025 07:48:52 +0000 (09:48 +0200)] 
conn: fix hostname move on connection reuse

When reusing a connection, the `host` and `conn_to_host` hostname
structs are moved from the template connection onto the existing one.

There was a NULLing of a tempplate member missing in `conn_to_host`
which could then lead to a double free.

Make this struct move into a static function, doing the correct
thing for both `struct hostname` in a connection.

Reported-by: Joshua Rogers
Closes #18995

3 weeks agocf-socket: set FD_CLOEXEC on all sockets opened
Stefan Eissing [Thu, 9 Oct 2025 10:19:49 +0000 (12:19 +0200)] 
cf-socket: set FD_CLOEXEC on all sockets opened

Removed TODO item

Reported-by: Joshua Rogers
Closes #18968

3 weeks agows: fix some edge cases
Stefan Eissing [Thu, 9 Oct 2025 09:23:42 +0000 (11:23 +0200)] 
ws: fix some edge cases

Fix edge cases around handling of pending send frames and encoding
frames with size_t/curl_off_t possible flowy things.

Reported-by: Joshua Rogers
Closes #18965

3 weeks agognutls: check conversion of peer cert chain
Stefan Eissing [Thu, 9 Oct 2025 08:41:02 +0000 (10:41 +0200)] 
gnutls: check conversion of peer cert chain

Check the result when converting the peer certificate chain
into gnutls internal x590 data structure for errors.

Reported-by: Joshua Rogers
Closes #18964

3 weeks agosocks: advance iobuf instead of reset
Stefan Eissing [Wed, 8 Oct 2025 12:29:54 +0000 (14:29 +0200)] 
socks: advance iobuf instead of reset

During the SOCKS connect phase, the `iobuf` is used to receive repsonses
from the server. If the server sends more bytes than expected, the code
discarded them silently.

Fix this by advancing the iobuf only with the length consumed.

Reported-by: Joshua Rogers
Closes #18938

4 weeks agocmake/FindGSS: dedupe pkg-config module strings
Viktor Szakats [Fri, 10 Oct 2025 04:43:41 +0000 (06:43 +0200)] 
cmake/FindGSS: dedupe pkg-config module strings

Closes #18994

4 weeks agocmake/FindGSS: drop wrong header check for GNU GSS
Viktor Szakats [Fri, 10 Oct 2025 04:37:45 +0000 (06:37 +0200)] 
cmake/FindGSS: drop wrong header check for GNU GSS

GNU GSS offers `gss.h`; do not check for `gssapi.h`. `gssapi.h`
was originally published by Heimdal, and later MIT Kerberos also added it
for Heimdal compatibility.

Closes #18993

4 weeks agokerberos: bump minimum to 1.3 (2003-07-08), drop legacy logic
Viktor Szakats [Fri, 10 Oct 2025 01:09:16 +0000 (03:09 +0200)] 
kerberos: bump minimum to 1.3 (2003-07-08), drop legacy logic

Previous minimum was: 1.2.4 (2002-02-28)

- assume `gssapi/gssapi.h` header for MIT Kerberos.

  Drop logic detecting this header, and drop alternate logic including
  a bare "gssapi.h". Bare `gssapi.h` is Heimdal-specific. MIT Kerberos
  added support for it for Heimdal compatibility on 2006-11-09,
  redirecting to `gssapi/gssapi.h`. MIT Kerberos supported the latter
  header in the 1990s already.

  Ref: 40e1a016f92903c731f07325bc1f9c6416ae1ac3 (2008-03-06)
  Ref: https://github.com/krb5/krb5/commit/d11935200186040132e05e2beaaba20a770ee3ef (2006-11-09)

- configure.ac: stop using `HAVE_GSSAPI_GSSAPI_H`.

  Added in 2010 to support "ancient distros such as RHEL-3" where
  `gssapi/gssapi_krb5.h` did not include `gssapi/gssapi.h`.

  MIT Kerberos includes it since commit:
  https://github.com/krb5/krb5/commit/d9e959edfa8da7cab3bde96c9c4ca39beaf8db69 (2003-03-06)
  Released in 1.3 (2003-07-08).

  Bump minimum required version to avoid this issue.

  Reverts cca192e58f9ed7c4b33c1c991f69ff830c58b38f (2010-04-16)

Ref: https://web.mit.edu/kerberos/dist/historic.html
Ref: https://sources.debian.org/src/krb5/

Closes #18992

4 weeks agoCI.md: refresh
Viktor Szakats [Thu, 9 Oct 2025 11:34:56 +0000 (13:34 +0200)] 
CI.md: refresh

Closes #18973

4 weeks agoGHA/linux: test GNU GSS with autotools, cmake, valgrind and scan-build
Viktor Szakats [Fri, 10 Oct 2025 12:37:41 +0000 (14:37 +0200)] 
GHA/linux: test GNU GSS with autotools, cmake, valgrind and scan-build

The cmake build is running runtests with valgrind. The autotools one is
running scan-build.

Also:
- ignore two memleaks with GNU GSS detected by valgrind.
- add comment on support status of `GSS_C_DELEG_POLICY_FLAG`.

Closes #19008

4 weeks agokerberos: stop including `gssapi/gssapi_generic.h`
Viktor Szakats [Fri, 10 Oct 2025 00:49:46 +0000 (02:49 +0200)] 
kerberos: stop including `gssapi/gssapi_generic.h`

It's a legacy MIT Kerberos header that's no longer used by curl since:
355bf01c828af16c47ab52bccb9ade769f8bf158 (2015-01-09)

There were still mentions of it after this patch, when using versions
<1.2.3, but those versions aren't supported since:
99185417952da30c8ddd82ab962fb58da96260b2 (2008-06-12)

This header remains in use by autotools and cmake to detect MIT Kerberos
(vs. Heimdal, which doesn't have it.)

Ref: https://github.com/curl/curl/pull/18978#issuecomment-3387414995

Closes #18990

4 weeks agolibssh: make atime and mtime cap the timestamp instead of wrap
Daniel Stenberg [Thu, 9 Oct 2025 21:21:37 +0000 (23:21 +0200)] 
libssh: make atime and mtime cap the timestamp instead of wrap

The libssh API uses a 32 bit type for datestamp, so instead of just
force-typecast it, make sure it gets capped at UINT_MAX if the value is
larger.

Reported-by: Joshua Rogers
Closes #18989

4 weeks agoldap: avoid null ptr deref on failure
Daniel Stenberg [Thu, 9 Oct 2025 21:03:18 +0000 (23:03 +0200)] 
ldap: avoid null ptr deref on failure

ldap_get_dn() can return NULL on error

Reported-by: Joshua Rogers
Closes #18988

4 weeks agokerberos: drop logic for MIT Kerberos <1.2.3 (pre-2002) versions
Viktor Szakats [Thu, 9 Oct 2025 15:15:02 +0000 (17:15 +0200)] 
kerberos: drop logic for MIT Kerberos <1.2.3 (pre-2002) versions

curl requires 1.2.4 or newer.

Also:
- vms: stop defining `gss_nt_service_name`. Added in
  f9cf3de70b3a494f627eda6cccf6607616eaf449, symbol not used in curl code
  since 355bf01c828af16c47ab52bccb9ade769f8bf158.

Closes #18978

4 weeks agoopenldap: fix memory-leak on oldap_do's exit path
Daniel Stenberg [Thu, 9 Oct 2025 20:57:29 +0000 (22:57 +0200)] 
openldap: fix memory-leak on oldap_do's exit path

On SSL sockbuf setup failure in `oldap_do`, the 'lud' data would not be
freed and instead leak.

Reported-by: Joshua Rogers
Closes #18986

4 weeks agoopenldap: fix memory-leak in error path
Daniel Stenberg [Thu, 9 Oct 2025 20:50:01 +0000 (22:50 +0200)] 
openldap: fix memory-leak in error path

The 'ber' pointer could escape a free if an early error occurred.

Reported-by: Joshua Rogers
Closes #18985

4 weeks agoftp: simplify the 150/126 size scanner
Daniel Stenberg [Thu, 9 Oct 2025 20:32:09 +0000 (22:32 +0200)] 
ftp: simplify the 150/126 size scanner

The file size is weirdly returned in a 150 or 126 response as "XXX
bytes" mentioned somewhere in the response string. This is a rewrite of
the size scanner to replace the strange strstr() + backwards search from
before with a plain forward search until '[number] + " bytes"' is a
match.

Triggered by a report by Joshua Rogers about the previous parser.

Closes #18984

4 weeks agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 9 Oct 2025 20:10:32 +0000 (22:10 +0200)] 
RELEASE-NOTES: synced

4 weeks agoasyn-ares: use the duped hostname pointer for all calls
Daniel Stenberg [Thu, 9 Oct 2025 15:23:56 +0000 (17:23 +0200)] 
asyn-ares: use the duped hostname pointer for all calls

In one c-ares call the passed in pointer was used and not the new
duplicated one. This is probably fine but might as well use the new
pointer as all the other calls do, which will survive longer.

Reported-by: Joshua Rogers
Closes #18980

4 weeks agoCurl_resolv: fix comment. 'entry' argument is not optional
Daniel Stenberg [Thu, 9 Oct 2025 15:17:31 +0000 (17:17 +0200)] 
Curl_resolv: fix comment. 'entry' argument is not optional

Reported-by: Joshua Rogers
Closes #18979

4 weeks agokrb5_gssapi: fix memory leak on error path
Daniel Stenberg [Thu, 9 Oct 2025 14:51:55 +0000 (16:51 +0200)] 
krb5_gssapi: fix memory leak on error path

If a non-compliant amount of bytes is received, the function would
return error without free.

Reported-by: Joshua Rogers
Closes #18976

4 weeks agovauth/digest: improve the digest parser
Daniel Stenberg [Thu, 9 Oct 2025 14:35:39 +0000 (16:35 +0200)] 
vauth/digest: improve the digest parser

Previously, if for example the nonce would end with "realm=" etc it
would get the wrong piece, due to the naive parser.

Reported-by: Joshua Rogers
Closes #18975

4 weeks agoschannel_verify: fix mem-leak in Curl_verify_host
Daniel Stenberg [Thu, 9 Oct 2025 11:18:05 +0000 (13:18 +0200)] 
schannel_verify: fix mem-leak in Curl_verify_host

Reported-by: Stanislav Fort
Closes #18972

4 weeks agoexamples: add an example for logging failed transfers
Jay Satiro [Sat, 20 Sep 2025 02:12:05 +0000 (22:12 -0400)] 
examples: add an example for logging failed transfers

- Add an example that demonstrates per-transfer verbose logging to
  memory.

The transfer's log is written to disk only if the transfer fails.

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

4 weeks agotool_operate: keep failed partial download for retry auto-resume
Jay Satiro [Fri, 18 Oct 2024 18:12:31 +0000 (14:12 -0400)] 
tool_operate: keep failed partial download for retry auto-resume

- Keep data from a failed download instead of discarding it on retry in
  some limited cases when we know it's ok (currently only HTTP 200/206).

Prior to this change on failed transfer the tool truncated any outfile
data written before retrying the transfer. This change adds an exception
for HTTP downloads when the user requested auto-resume, because in that
case we can keep the outfile data and resume from the new position.

Reported-by: tkzv@users.noreply.github.com
Fixes https://github.com/curl/curl/issues/18035
Closes https://github.com/curl/curl/pull/18665

4 weeks agoopenssl: add comments regarding OCSP verification
Stefan Eissing [Thu, 9 Oct 2025 08:26:30 +0000 (10:26 +0200)] 
openssl: add comments regarding OCSP verification

To allow future reviewers of "security" reports to more easily find out
why code is this way.

Closes #18962

4 weeks agomemdup0: handle edge case
Stefan Eissing [Thu, 9 Oct 2025 09:42:43 +0000 (11:42 +0200)] 
memdup0: handle edge case

When length is already SIZE_MAX, fail without allocating.

Reported-by: Joshua Rogers
Closes #18966

4 weeks agorustls: pass the correct result to rustls_failf
Stefan Eissing [Thu, 9 Oct 2025 07:55:38 +0000 (09:55 +0200)] 
rustls: pass the correct result to rustls_failf

Reported-by: Joshua Rogers
Closes #18961

4 weeks agoGHA: rename config files to match pyspelling
Viktor Szakats [Thu, 9 Oct 2025 11:48:06 +0000 (13:48 +0200)] 
GHA: rename config files to match pyspelling

To make it more obvious what needs to be looked at when pyspelling is
reporting an issue.

Follow-up to 95e50ad69473d8229b85478a3f2138b7e632fbe8 #18756
Closes #18974

4 weeks agoexamples: update `.gitignore`
Viktor Szakats [Thu, 9 Oct 2025 10:54:17 +0000 (12:54 +0200)] 
examples: update `.gitignore`

Follow-up to f6f62933e917b8b5c9a9394907ce4b69600214b4 #18264
Closes #18971

4 weeks agoexamples: allow `vsnprintf` again
Viktor Szakats [Thu, 9 Oct 2025 10:51:08 +0000 (12:51 +0200)] 
examples: allow `vsnprintf` again

Ref: https://github.com/curl/curl/pull/18668#issuecomment-3383422410
Follow-up to b12da22db1f11da51082977dc21a7edee7858911 #18866
Closes #18970

4 weeks agoexamples/sessioninfo: do not disable security
Viktor Szakats [Thu, 9 Oct 2025 10:36:43 +0000 (12:36 +0200)] 
examples/sessioninfo: do not disable security

Also make it return the curl result code.

Follow-up to df70a68984308952dcacf33d11593cb22ad80464 #18909
Closes #18969

4 weeks agohostip: don't store negative resolves due unrelated errors
Daniel Stenberg [Thu, 9 Oct 2025 07:07:27 +0000 (09:07 +0200)] 
hostip: don't store negative resolves due unrelated errors

Like for:

- OOM
- resolver_start() returns error
- DoH has problems

Fixes #18953
Fixes #18954
Reported-by: Joshua Rogers
Closes #18958

4 weeks agomk-lib1521: verify the setopt options that accept -1
Daniel Stenberg [Thu, 9 Oct 2025 08:15:41 +0000 (10:15 +0200)] 
mk-lib1521: verify the setopt options that accept -1

4 weeks agosetopt: allow CURLOPT_DNS_CACHE_TIMEOUT set to -1
Daniel Stenberg [Thu, 9 Oct 2025 07:50:20 +0000 (09:50 +0200)] 
setopt: allow CURLOPT_DNS_CACHE_TIMEOUT set to -1

It is documented as valid. Regression from commit b059f7deaf3 shipped in
8.16.0

Reported-by: Andrei Kurushin
Fixes #18959
Closes #18960

4 weeks agotest1582: verify the TLS channel binding cert memory leak fix
Daniel Stenberg [Tue, 7 Oct 2025 07:22:05 +0000 (09:22 +0200)] 
test1582: verify the TLS channel binding cert memory leak fix

4 weeks agoopenssl: fix peer certificate leak in channel binding
Daniel Stenberg [Tue, 7 Oct 2025 05:49:00 +0000 (07:49 +0200)] 
openssl: fix peer certificate leak in channel binding

Reported-by: Stanislav Fort
Bug: https://hackerone.com/reports/3373640
Closes #18917

4 weeks agohttp2: ingress handling edge cases
Stefan Eissing [Wed, 8 Oct 2025 11:06:48 +0000 (13:06 +0200)] 
http2: ingress handling edge cases

Fix some edge cases around the `data_max_bytes` handling when
processing ingress.

Reported-by: Joshua Rogers
Closes #18933

4 weeks agohttp2: cleanup pushed newhandle on fail
Stefan Eissing [Wed, 8 Oct 2025 10:28:14 +0000 (12:28 +0200)] 
http2: cleanup pushed newhandle on fail

When nghttp2_session_set_stream_user_data() fails, clean up the
new handle.

Reported-by: Joshua Rogers
Closes #18931

4 weeks agohttp2: check push header names by length first
Stefan Eissing [Wed, 8 Oct 2025 10:22:22 +0000 (12:22 +0200)] 
http2: check push header names by length first

Reported-by: Joshua Rogers
Closes #18930

4 weeks agolibssh2/sftp: fix resume corruption by avoiding O_APPEND with rresume
Joshua Rogers [Wed, 8 Oct 2025 22:06:40 +0000 (06:06 +0800)] 
libssh2/sftp: fix resume corruption by avoiding O_APPEND with rresume

Opening the remote file with O_APPEND while attempting to resume causes
all writes to be forced to EOF on servers/implementations where O_APPEND
semantics override a prior seek(). As a result, sftp_seek64() is ignored
and the resumed data is appended, duplicating/corrupting the file.

Fix by:
- Using O_WRONLY (without O_APPEND) when resume_from > 0.
- Skipping the seek entirely if remote_append mode is requested.

Closes #18952

4 weeks agolibssh/sftp: fix resume corruption by avoiding O_APPEND with rresume
Joshua Rogers [Wed, 8 Oct 2025 22:03:08 +0000 (06:03 +0800)] 
libssh/sftp: fix resume corruption by avoiding O_APPEND with rresume

Opening the remote file with O_APPEND while attempting to resume causes
all writes to be forced to EOF on servers/implementations where O_APPEND
semantics override a prior seek(). As a result, sftp_seek64() is ignored
and the resumed data is appended, duplicating/corrupting the file.

Fix by:
- Using O_WRONLY (without O_APPEND) when resume_from > 0.
- Skipping the seek entirely if remote_append mode is requested.

Closes #18952

4 weeks agosocks: deny server basic-auth if not configured
Stefan Eissing [Wed, 8 Oct 2025 12:06:55 +0000 (14:06 +0200)] 
socks: deny server basic-auth if not configured

When the server proposes BASIC authentication and curl does
not have that configured, fail right away.

Reported-by: Joshua Rogers
Closes #18937

4 weeks agovquic: sending non-gso packets fix for EAGAIN
Stefan Eissing [Wed, 8 Oct 2025 11:44:32 +0000 (13:44 +0200)] 
vquic: sending non-gso packets fix for EAGAIN

The function returned OK on EAGAIN and not the correct code.

Reported-by: Joshua Rogers
Closes #18936

4 weeks agoquiche: handle tls fail correctly
Stefan Eissing [Wed, 8 Oct 2025 11:30:12 +0000 (13:30 +0200)] 
quiche: handle tls fail correctly

quiche receive may report a TLS failure after a verified handshake. That
needs to lead to a transfer receive error.

Reported-by: Joshua Rogers
Closes #18934

4 weeks agobuild: drop Heimdal support, update docs, replace with MIT Kerberos in CI
Viktor Szakats [Wed, 8 Oct 2025 10:03:18 +0000 (12:03 +0200)] 
build: drop Heimdal support, update docs, replace with MIT Kerberos in CI

The kerberos5 library Heimdal is one of three GSS libraries curl support.
It has a memory leak triggered by the new test in #18917 and the project
seems mostly abandoned.

Drop support and steer users to the MIT krb5 or GNU GSS libraries.

Co-authored-by: Daniel Stenberg
Ref: #18928
Closes #18928
Closes #18932

4 weeks agocmake/FindGSS: whitespace/formatting
Viktor Szakats [Wed, 8 Oct 2025 23:34:37 +0000 (01:34 +0200)] 
cmake/FindGSS: whitespace/formatting

Sync format more with the rest of the Find modules.

Cherry-picked from #18932
Closes #18957

4 weeks agoGHA/linux-old: sync terminology with other jobs [ci skip]
Viktor Szakats [Wed, 8 Oct 2025 17:07:03 +0000 (19:07 +0200)] 
GHA/linux-old: sync terminology with other jobs [ci skip]

Cherry-picked from #18932

4 weeks agocmake: minor Heimdal flavour detection fix
Viktor Szakats [Wed, 8 Oct 2025 19:40:07 +0000 (21:40 +0200)] 
cmake: minor Heimdal flavour detection fix

Do not detect Heimdal if a single `H` character appears in the vendor
string, require the full name: `Heimdal`.

Cherry-picked from #18932
Closes #18951

4 weeks agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 8 Oct 2025 21:35:37 +0000 (23:35 +0200)] 
RELEASE-NOTES: synced

4 weeks agoCURLOPT_COOKIEFILE.md: clarify when the cookies are loaded
Daniel Stenberg [Wed, 8 Oct 2025 05:58:16 +0000 (07:58 +0200)] 
CURLOPT_COOKIEFILE.md: clarify when the cookies are loaded

Closes #18924

4 weeks agohttp: make Content-Length parser more WHATWG
Daniel Stenberg [Wed, 8 Oct 2025 06:33:55 +0000 (08:33 +0200)] 
http: make Content-Length parser more WHATWG

Return error if there is something after the number other than
whitespace and newline.

Allow comma separated numbers and repeated headers as long as the new value is
the same as was set before.

Add test 767 to 771 to verify.

Reported-by: Ignat Loskutov
Fixes #18921
Closes #18925

4 weeks agoapple sectrust: check correct result on old OS versions
Stefan Eissing [Wed, 8 Oct 2025 09:56:09 +0000 (11:56 +0200)] 
apple sectrust: check correct result on old OS versions

On ancient Apple OS versions where SecTrustEvaluateWithError() is not
available, the deprected SecTrustEvaluate() is used. In that code
branch, the code checked the wong variable for the verified result.

Closes #18929

4 weeks agowolfssl: no double get_error() detail
Stefan Eissing [Wed, 8 Oct 2025 12:44:23 +0000 (14:44 +0200)] 
wolfssl: no double get_error() detail

Code was calling wolfSSL_get_error() on code that it had
already retrieved with the same function. Remove that.

Reported-by: Joshua Rogers
Closes #18940

4 weeks agocmake/FindGSS: fix `pkg-config` fallback logic for CMake <3.16
Viktor Szakats [Wed, 8 Oct 2025 16:49:51 +0000 (18:49 +0200)] 
cmake/FindGSS: fix `pkg-config` fallback logic for CMake <3.16

The documented `<prefix>_<moduleName>_VERSION` variables are empty in
all tested versions since 3.7.2 to 4.1.2. Stop using it as a fallback
for <3.16 versions, and replace with the undocumented, but working,
`FindPkgConfig` internal variable `_pkg_check_modules_pkg_name`. It
contains the module name which was found.

In practice it caused that with CMake <3.16 + `pkg-config`, curl always
detected the Heimdal flavor of GSS.

Also: Delete a fallback version detection method, which was already
marked with a question mark in comments, and used the same, always
empty, CMake variables.

Ref: https://cmake.org/cmake/help/v4.1/module/FindPkgConfig.html
Bug: https://github.com/curl/curl/pull/18932#issuecomment-3381807070

Closes #18950

4 weeks agoGHA/linux-old: dump logs on configure failure
Viktor Szakats [Wed, 8 Oct 2025 11:33:19 +0000 (13:33 +0200)] 
GHA/linux-old: dump logs on configure failure

As done in other jobs, but here tailored to old cmake.

The logs generated by ancient CMake aren't super useful though.

Cherry-picked from #18932
Closes #18948

4 weeks agoGHA: bump dependencies
dependabot[bot] [Wed, 8 Oct 2025 12:46:51 +0000 (12:46 +0000)] 
GHA: bump dependencies

- cryptography from 44.0.1 to 46.0.2 in tests/http
- ruff from 0.13.2 to 0.14.0 in .github/scripts
- reuse from 6.0.0 to 6.1.2 in .github/scripts
- github/codeql-action from 3.30.5 to 4.30.7

Closes #18941
Closes #18942
Closes #18943
Closes #18945
Closes #18947

4 weeks agoGHA/dependabot: tweak dir list to avoid a dupe, rename .txt file to avoid the bot
Viktor Szakats [Wed, 8 Oct 2025 12:50:58 +0000 (14:50 +0200)] 
GHA/dependabot: tweak dir list to avoid a dupe, rename .txt file to avoid the bot

It correctly picked all pips, but also picked
`tests/http/requirements.txt` twice and also
`.github/scripts/codespell-ignore.txt`. Try avoid these issues with this
patch.

Follow-up to 6a31e3137a1352aec528d768dee8d5a1c509f451 #18939

Closes #18946

4 weeks agoGHA/dependabot: find more pip deps, tweak commit prefix
Viktor Szakats [Wed, 8 Oct 2025 12:36:22 +0000 (14:36 +0200)] 
GHA/dependabot: find more pip deps, tweak commit prefix

Before this patch the Dependabot updater was only picking up
`tests/requirements.txt`:
https://github.com/curl/curl/network/updates/26616523/jobs

Also prefix commit messages with `GHA:`.

Bug: https://github.com/curl/curl/pull/18761#issuecomment-3381147189
Follow-up to b04137c1c6ed164594279c7d04b5e051634453ea #18761

Closes #18939

4 weeks agoGHA/checksrc: also run on .md file changes
Viktor Szakats [Wed, 8 Oct 2025 11:41:50 +0000 (13:41 +0200)] 
GHA/checksrc: also run on .md file changes

To avoid missing e.g. codespell issue when updating Markdown files only,
as in 82fd9edb0e0313f206b23f90a000164b52412072 #18927

Follow-up to 0b54ce6ffc395148f2c43ce4664ecd9678f822bd

Closes #18935

4 weeks agoINSTALL-CMAKE.md: fix typo in prev
Viktor Szakats [Wed, 8 Oct 2025 11:37:29 +0000 (13:37 +0200)] 
INSTALL-CMAKE.md: fix typo in prev

Not caught in original PR. Fixing it in CI separately.

Follow-up 82fd9edb0e0313f206b23f90a000164b52412072 #18927

4 weeks agoINSTALL-CMAKE.md: document useful build targets
Viktor Szakats [Wed, 8 Oct 2025 09:15:13 +0000 (11:15 +0200)] 
INSTALL-CMAKE.md: document useful build targets

Closes #18927

4 weeks agotests/server: drop pointless memory allocation overrides
Viktor Szakats [Wed, 8 Oct 2025 01:09:23 +0000 (03:09 +0200)] 
tests/server: drop pointless memory allocation overrides

The code was overriding system memory allocation functions to a local
jump table (declared in `curl_setup.h`). And setup that jump table
to call the original system allocation functions.

Also tested fine with cegcc/WinCE. The `_strdup` fallback was possibly
required for an MSVC WinCE toolchain.

Closes #18922

4 weeks agoh3/ngtcp2: close just-opened QUIC stream when submit_request fails
Joshua Rogers [Tue, 7 Oct 2025 05:59:29 +0000 (13:59 +0800)] 
h3/ngtcp2: close just-opened QUIC stream when submit_request fails

Closes #18904

4 weeks agoh3/nghttp3: return NGHTTP3_ERR_CALLBACK_FAILURE from recv_header
Joshua Rogers [Tue, 7 Oct 2025 05:59:09 +0000 (13:59 +0800)] 
h3/nghttp3: return NGHTTP3_ERR_CALLBACK_FAILURE from recv_header

Closes #18904

4 weeks agoopenssl: skip session resumption when verifystatus is set
Joshua Rogers [Tue, 7 Oct 2025 02:31:18 +0000 (10:31 +0800)] 
openssl: skip session resumption when verifystatus is set

Resumed TLS sessions skip OCSP stapled-response verification.
Force a full handshake so verifystatus() runs.

Closes #18902

4 weeks agoexamples/sessioninfo: cast printf string mask length to int
Viktor Szakats [Tue, 7 Oct 2025 18:30:06 +0000 (20:30 +0200)] 
examples/sessioninfo: cast printf string mask length to int

Found via `-Wformat-signedness`:
```
docs/examples/sessioninfo.c: In function 'wrfu':
docs/examples/sessioninfo.c:75:53: error: field precision specifier '.*' expects argument of type 'int', but argument 4 has type 'unsigned int' [-Werror=format=]
  fprintf(stderr, "Certificate #%u: %.*s", i, dn.size, dn.data);
                                      ^
```
Ref: https://github.com/curl/curl/actions/runs/18320729052/job/52172864438?pr=18343#step:13:30
Ref: https://github.com/curl/curl/actions/runs/18320729095/job/52172886899?pr=18343#step:19:27

Also:
- drop unnecessary parenthesis.
- scope variables.

Ref: #18343
Closes #18918

4 weeks agonotify: use 'notify' in public header and docs
Viktor Szakats [Tue, 7 Oct 2025 10:47:19 +0000 (12:47 +0200)] 
notify: use 'notify' in public header and docs

Closes #18915

4 weeks agocmake: support building some complicated examples, build them in CI
Viktor Szakats [Tue, 7 Oct 2025 10:36:49 +0000 (12:36 +0200)] 
cmake: support building some complicated examples, build them in CI

Build these examples when the necessary dependencies are present:
- cacertinmem, usercertinmem (OpenSSL/fork)
- multi-uv (libuv)
- multithread, threaded-ssl (pthread)
- sessioninfo (GnuTLS)

Indicate the necessary dependency via a `Required:` comment placed in
the source file. A single dependency per source is supported as of now.
The name of the dependency should match the variable used within
the cmake scripts, which in turn matches the macro used in the config
header. E.g. for GnuTLS it's `USE_GNUTLS`.

Also:
- GHA/macos: build examples in two job to test GnuTLS and pthread ones.
- GHA/linux: enable libuv to test it with examples.

Follow-up to 6bb77140322565ca17f5a66aa5d8500d8d469cca #18914
Closes #18909

4 weeks agongtcp2: fix handling of blocked stream data
Stefan Eissing [Tue, 7 Oct 2025 09:30:46 +0000 (11:30 +0200)] 
ngtcp2: fix handling of blocked stream data

The stream blocking might not be the one of the current easy handle.
Look up the stream to be marked as blocking via its stream_id in the
internal hash. Theoretically, this does not have to be one of the h3
streams, so not finding it is not an error.

Fixes #18905
Reported-by: Joshua Rogers
Closes #18906

4 weeks agoosslq: set out idle timeout to 0
Stefan Eissing [Tue, 7 Oct 2025 10:05:08 +0000 (12:05 +0200)] 
osslq: set out idle timeout to 0

Similar to our ngtcp2 backend, set our idle timeout for the connection
to 0, meaning we have no such timeout from our side. The effective idle
timeout is then the one announced by the peer.

Closes #18907

4 weeks agoCURLMOPT_NOTIFYFUNCTION.md: minor language polish
Daniel Stenberg [Tue, 7 Oct 2025 14:18:22 +0000 (16:18 +0200)] 
CURLMOPT_NOTIFYFUNCTION.md: minor language polish

- mention the possibility of new types in the future
- s/a an/an

Closes #18913

4 weeks agomulti: use CURLMNOTIFY_ as notification id prefix
Daniel Stenberg [Tue, 7 Oct 2025 14:00:59 +0000 (16:00 +0200)] 
multi: use CURLMNOTIFY_ as notification id prefix

Since CURLM_ is already used as prefix for multi error codes, it makes
it easier to detect and understand the difference between identifiers -
and allows for scripts on the website and elsewhere to separate them
properly.

Follow-up to 53be8166b2b16d9682
Closes #18912

4 weeks agoexamples: fix build issues in 'complicated' examples
Viktor Szakats [Tue, 7 Oct 2025 11:54:17 +0000 (13:54 +0200)] 
examples: fix build issues in 'complicated' examples

- cacertinmem: build cleanly with BoringSSL/AWS-LC.
- cacertinmem: silence `-Wcast-function-type-strict`.
- multi-uv: fix callback prototypes.
- multithread, threaded-ssl: do not pass const as thread arg.
- sessioninfo: fix suppressing deprecated feature warning.
- usercertinmem: sync formatting with cacertinmem.

Follow-up to 4a6bdd5899005c25ce222dc21dcfd1a779544330 #18908
Cherry-picked from #18909
Closes #18914

4 weeks agomulti: notify rename, remove the last stragglers
Stefan Eissing [Tue, 7 Oct 2025 11:40:05 +0000 (13:40 +0200)] 
multi: notify rename, remove the last stragglers

in the public API.

Follow-up to 357808f4addef44c2c48f17d

Closes #18910

4 weeks agocmake: build the "all" examples source list dynamically
Viktor Szakats [Tue, 7 Oct 2025 12:04:12 +0000 (14:04 +0200)] 
cmake: build the "all" examples source list dynamically

To allow building conditional examples, and to simplify by avoiding
cmake-version dependent code.

Follow-up to fe5225b5eaf3a1a0ce149023d38a9922a114798b #18209
Cherry-picked from #18909
Closes #18911

4 weeks agosocks: handle premature close
Stefan Eissing [Mon, 6 Oct 2025 12:08:07 +0000 (14:08 +0200)] 
socks: handle premature close

When expecting to receive a number of bytes during socks connect,
treat an early connection close as error.

Reported-by: Joshua Rogers
Closes #18883

4 weeks agoexamples/usercertinmem: avoid stripping const
Viktor Szakats [Tue, 7 Oct 2025 10:04:03 +0000 (12:04 +0200)] 
examples/usercertinmem: avoid stripping const

This API started accepting a const somewhere between OpenSSL 1.0.2b and
1.0.2t. It means this example, like the other similar one now works best
with those versions or newer:
```
docs/examples/usercertinmem.c:100:33: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual]
  100 |   bio = BIO_new_mem_buf((char *)mypem, -1);
      |                                 ^
docs/examples/usercertinmem.c:121:34: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual]
  121 |   kbio = BIO_new_mem_buf((char *)mykey, -1);
      |                                  ^
```

Closes #18908

4 weeks agovquic/ngtcp2: compare idle timeout in ms to avoid overflow
Joshua Rogers [Tue, 7 Oct 2025 07:48:36 +0000 (15:48 +0800)] 
vquic/ngtcp2: compare idle timeout in ms to avoid overflow

Closes #18903

4 weeks agovquic: fix idle-timeout checks (ngtcp2 ms<-->ns), 64-bit log & honor 0=no-timeout...
Joshua Rogers [Tue, 7 Oct 2025 05:34:26 +0000 (13:34 +0800)] 
vquic: fix idle-timeout checks (ngtcp2 ms<-->ns), 64-bit log & honor 0=no-timeout (osslquic)

Closes #18903

4 weeks agomulti: add notifications API
Stefan Eissing [Mon, 1 Sep 2025 09:58:16 +0000 (11:58 +0200)] 
multi: add notifications API

Add infrastructure to colled and dispatch notifications for transfers
and the multi handle in general. Applications can register a callback
and en-/disable notification type the are interested in.

Without a callback installed, notifications are not collected. Same when
a notification type has not been enabled.

Memory allocation failures on adding notifications lead to a general
multi failure state and result in CURLM_OUT_OF_MEMORY returned from
curl_multi_perform() and curl_multi_socket*() invocations.

Closes #18432

4 weeks agongtcp2: fix returns when TLS verify failed
Stefan Eissing [Mon, 6 Oct 2025 11:16:55 +0000 (13:16 +0200)] 
ngtcp2: fix returns when TLS verify failed

In both send/recv functions of the ngtcp2 filter, when TLS verification
has failed, jump out by skipping ingress/egress handling.

Reported-by: Joshua Rogers
Closes #18881

4 weeks agoexamples/synctime: make the sscanf not overflow the local buffer
Daniel Stenberg [Mon, 6 Oct 2025 14:19:21 +0000 (16:19 +0200)] 
examples/synctime: make the sscanf not overflow the local buffer

If the incoming Date: header has a funky format.

Bonus: remove bad null terminator assumptions for header

Reported-by: Stanislav Fort
Closes #18890

4 weeks agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 6 Oct 2025 21:59:33 +0000 (23:59 +0200)] 
RELEASE-NOTES: synced

4 weeks agotelnet: ignore empty suboptions
Daniel Stenberg [Mon, 6 Oct 2025 21:05:10 +0000 (23:05 +0200)] 
telnet: ignore empty suboptions

To avoid printing from en empty buffer

Reported-by: Joshua Rogers
Closes #18899

4 weeks agotftp: return error if it hits an illegal state
Daniel Stenberg [Mon, 6 Oct 2025 16:25:55 +0000 (18:25 +0200)] 
tftp: return error if it hits an illegal state

Reported-by: Joshua Rogers
Closes #18894

4 weeks agotftp: default timeout per block is now 15 seconds
Daniel Stenberg [Mon, 6 Oct 2025 15:32:50 +0000 (17:32 +0200)] 
tftp: default timeout per block is now 15 seconds

Down from the previous (rather ridiculous) 3600.

Reported-by: Joshua Rogers
Closes #18893

4 weeks agotftp: don't pin or check address if recvfrom returns error
Daniel Stenberg [Mon, 6 Oct 2025 15:23:18 +0000 (17:23 +0200)] 
tftp: don't pin or check address if recvfrom returns error

Follow-up to c4f9977c66bbb05a837a7eb0300
Reported-by: Joshua Rogers
Closes #18892

4 weeks agonoproxy: fix the IPV6 network mask pattern match
Daniel Stenberg [Mon, 6 Oct 2025 14:53:27 +0000 (16:53 +0200)] 
noproxy: fix the IPV6 network mask pattern match

It would mismatch if the network prefix length with was not divisible by
8.

Extended test 1614 to verify

Reported-by: Stanislav Fort
Closes #18891

4 weeks agomdlinkcheck: reject URLs containing quotes
Daniel Stenberg [Mon, 6 Oct 2025 14:10:27 +0000 (16:10 +0200)] 
mdlinkcheck: reject URLs containing quotes

Those would be illegal anyway and would make the script misbehave

Reported-by: Stanislav Fort
Closes #18889

4 weeks agotelnet: send failure logged but not returned
Daniel Stenberg [Mon, 6 Oct 2025 13:01:48 +0000 (15:01 +0200)] 
telnet: send failure logged but not returned

Return error correctly when sending fails.

Reported-by: Joshua Rogers
Closes #18887

4 weeks agotelnet: return error if WSAEventSelect fails
Daniel Stenberg [Mon, 6 Oct 2025 12:59:53 +0000 (14:59 +0200)] 
telnet: return error if WSAEventSelect fails

Reported-by: Joshua Rogers
Closes #18886

4 weeks agomanagen: verify the options used in example lines
Daniel Stenberg [Mon, 6 Oct 2025 12:41:14 +0000 (14:41 +0200)] 
managen: verify the options used in example lines

Also fix the --knownhosts typo

Follow-up to aae18c4bdc1a3bf5

Reported-by: Daniel Terhorst-North
URL: https://mas.to/@tastapod/115327102344617386
Closes #18884

4 weeks agopingpong: remove two old leftover debug infof() calls
Daniel Stenberg [Mon, 6 Oct 2025 11:05:01 +0000 (13:05 +0200)] 
pingpong: remove two old leftover debug infof() calls

4 weeks agotest766: verify CURLOPT_SOCKOPTFUNCTION error on accept
Daniel Stenberg [Mon, 6 Oct 2025 10:43:40 +0000 (12:43 +0200)] 
test766: verify CURLOPT_SOCKOPTFUNCTION error on accept

This test does active FTP with a socketopt callback that returns error
for the CURLSOCKTYPE_ACCEPT "purpose" to make sure we test and exercise
this error path - without leaks.

Closes #18879

4 weeks agocurl_osslq: error out properly if BIO_ADDR_rawmake() fails
Daniel Stenberg [Mon, 6 Oct 2025 10:27:36 +0000 (12:27 +0200)] 
curl_osslq: error out properly if BIO_ADDR_rawmake() fails

Reported-by: Joshua Rogers
Closes #18878

4 weeks agolibssh2/sftp_realpath: change state consistently
Daniel Stenberg [Mon, 6 Oct 2025 09:07:47 +0000 (11:07 +0200)] 
libssh2/sftp_realpath: change state consistently

Change the state in this function at a single spot independent of
success or not to simplify.

Reported-by: Joshua Rogers
Closes #18875

4 weeks agolibssh2: fix return code for EAGAIN
Daniel Stenberg [Mon, 6 Oct 2025 09:03:35 +0000 (11:03 +0200)] 
libssh2: fix return code for EAGAIN

In disconnect

Closes #18874

4 weeks agotidy-up: miscellaneous (cont.)
Viktor Szakats [Mon, 29 Sep 2025 10:36:14 +0000 (12:36 +0200)] 
tidy-up: miscellaneous (cont.)

- examples: replace magic numbers with `sizeof()`.
- typos: drop rules no longer needed after excluding tests/data.
- typos: move an exception inline.
- alpha-sort lists.
- fix indentation, whitespace.

Closes #18898

4 weeks agolib: stop overriding system printf symbols
Viktor Szakats [Sat, 4 Oct 2025 10:58:49 +0000 (12:58 +0200)] 
lib: stop overriding system printf symbols

After this patch, the codebase no longer overrides system printf
functions. Instead it explicitly calls either the curl printf functions
`curl_m*printf()` or the system ones using their original names.

Also:
- drop unused `curl_printf.h` includes.
- checksrc: ban system printf functions, allow where necessary.

Follow-up to db98daab05aec251bcb6615d2d38dfebec291736 #18844
Follow-up to 4deea9396bc7dd25c6362fa746a57bf309c74ada #18814

Closes #18866