Commit graph

38987 commits

Author SHA1 Message Date
Stefan Eissing
7333f6674c
cf-capsule: complete filter
Make the capsule filter complete, implement:

- pollset handling
- flush handling and querying
- shutdown handling
- replace allocated send buffer with a bufq

Closes #22019
2026-06-15 15:42:22 +02:00
Daniel Stenberg
c8d8f081fd
src/test: avoid (void)! constructs
The reason to use them seems to be that just (void) before a function
call is not enough to silence compiler warnings when return codes are
ignored and -Werror=unused-result is used.

While (void)! apparently works to silence those warnings, it is just too
weird and surprising to readers to use.

It is rather a reason to reconsider the usefulness of the warning.

Closes #22023
2026-06-15 14:43:09 +02:00
Daniel Stenberg
9f25dcea55
checksrc: detect and warn for (void)!
It's plain weird. Don't do it.

Closes #22023
2026-06-15 14:42:52 +02:00
Daniel Stenberg
b0d733e143
VULN-DISCLOSURE-POLICY: non-released code
Closes #22025
2026-06-15 14:32:35 +02:00
Viktor Szakats
0882e3951d
servers: mask to S_IFMT in unix socket path attribute check
Instead of `S_IFSOCK` before this patch. For correctness; it is probably
not an issue in most environments.

Spotted by Copilot
Bug: https://github.com/curl/curl/pull/22021#discussion_r3413049506
Follow-up to 99fb36797a

Closes #22026
2026-06-15 14:27:07 +02:00
Stefan Eissing
8cc3fed7df
transfer: adapt Curl_xfer_is_secure()
Now that `conn->origin` can be the proxy, we need to change how
Curl_xfer_is_secure() and some other places work.

Pointed out by Codex Security

Closes #22015
2026-06-15 13:41:26 +02:00
Viktor Szakats
03bc93bd32
servers: drop unix socket path attribute check on Windows
On Windows there is no `lstat()`, which was later substituted with
normal `stat()`, but on Windows `S_IFSOCK` is never defined, which meant
the output of stat was not actually used, reducing this to checking for
the presence of the file, and bailing out without retry if missing.

Follow-up to 30e491e5c9 #7034
Follow-up to 99fb36797a

Cherry-picked from #22010

Closes #22021
2026-06-15 13:36:46 +02:00
Viktor Szakats
e70f8ebd34
servers: fix error message if unix socket path is not a socket
Follow-up to 99fb36797a
Cherry-picked from #22010

Closes #22020
2026-06-15 13:07:08 +02:00
Viktor Szakats
a6d9783894
libtests: prefer sizeof() over strlen(), fix potential OOB read in 1591
- test1591: fix potential OOB read.
  Spotted by GitHub Code Quality
  Follow-up to f464535bfd #3350

Closes #22011
2026-06-15 11:24:19 +02:00
Daniel Stenberg
79a24161ab
urlapi: refactor and simplify curl_url_set
Create and make use of:

- url_encode_part()
- url_uppercasehex_part()
- url_append_query()
- url_sethost()

Closes #22012
2026-06-15 08:33:19 +02:00
Viktor Szakats
9061302a86
tidy-up: prefer spelling 'flavor', where missing
In comments and two internal build variables.

Closes #22014
2026-06-15 03:28:42 +02:00
Viktor Szakats
43c685fa78
cmake/FindGSS: fix comment, adjust custom flavor property name
- fix property name in comment.
- rename `INTERFACE_CURL_GSS_FLAVOUR` ->
  `INTERFACE_CURL_GSS_FLAVOR` to match preferred usage.

Follow-up to 8aeefd0b35 (subcommit)
Follow-up to 16f073ef49 #16973

Closes #22013
2026-06-15 02:41:29 +02:00
Viktor Szakats
0ffab25b6c
tidy-up: miscellaneous
- `N byte` -> `N-byte` or `N bytes`.
- INTERNALS.md: language tweaks.
- schannel: language tweak in comment/error message.
- socks_gssapi, socks_sspi: simplify composing an error message.
  (at a cost of 8 extra constant string bytes.)
- m4/curl-compilers.m4: fix typo in link (in comment).
- contrithanks.sh: fix indent, drop stray `;` terminator.
- lib, src, tests: drop/fix a bunch of badwords.
- fix typos in comments.
- fix indent, stray spaces.

Some of these spotted by GitHub Code Quality and Copilot

Closes #22009
2026-06-14 20:10:28 +02:00
Daniel Stenberg
5bff1c35f1
socks_sspi: store socks5_gssapi_enctype
Store the unwrapped protection level in `conn->socks5_gssapi_enctype` to
prevent the proxy from contuning unprotected. Matches the GSSAPI version
of the code.

Reported-by: Trail of Bits
Closes #22004
2026-06-14 18:36:13 +02:00
Daniel Stenberg
c4cb67692d
smb: integer overflow proof a size check
By using size_t for the vars instead of shorts.

Pointed out by Zeropath

Closes #22001
2026-06-14 18:12:33 +02:00
Viktor Szakats
f1b1919bd0
servers: drop single-use interim result variables
Closes #22008
2026-06-14 17:49:33 +02:00
Viktor Szakats
9002d3350c
servers: minor socket error handling fixes
- sws: fix socket error code in `select()` failure message.
  Spotted by Copilot
  Bug: https://github.com/curl/curl/pull/21998#discussion_r3409469444
- sws: do not call `SOCKERRNO` twice on error.
- dnsd: do not call `SOCKERRNO` twice on error.
- dnsd: replace `goto` with `while()` to sync with rest of code.
- dnsd: `sendto()` fail message fixes:
  - replace `int` cast with `%zu` mask.
  - drop redundant newline.
  - show socket error string like rest of code.
  - report not-fully-sent error separately from socket errors.

Closes #22007
2026-06-14 16:16:25 +02:00
Viktor Szakats
945938de10
rtspd: sync up sleep loop with sws
Check for `!got_exit_signal` as part of the `while()` expression,
instead of doing it after calling `curlx_wait_ms()`. To simplify and
improve consistency with rest of code.

Follow-up to 0653fa107f
Follow-up to 123c92c904

Closes #22006
2026-06-14 16:16:25 +02:00
Viktor Szakats
d9ea8cdcfa
tests/servers: do not interpret unlink() retval as errno
In `socksd` and `sws` error messages.

Also:
- show the messages only if `unlink()` failed.
- rename a return code variable and sync a message text for consistency.

Ref: https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html

Spotted by Copilot in `socksd.c`
Bug: https://github.com/curl/curl/pull/21998#discussion_r3409395013
Follow-up to 80eb71a3f5 #8687

Closes #22005
2026-06-14 14:25:02 +02:00
Viktor Szakats
9972f700a8
perl: switch from backticks to qx()
To make it easier to find external command invocation in the source.

Also drop backticks from a comment.

To find external command invocations in Perl code use:
```sh
git grep -E "((exec|qx|open2|open3|system)\(|open\(.+-\|)" $(<perlfiles>)
```

Refs:
https://perldoc.perl.org/functions/qx
https://perldoc.perl.org/perlop#Simpler-Quote-Like-Operators

Closes #21994
2026-06-14 14:25:02 +02:00
Viktor Szakats
c61f007a73
krb5_sspi: fix error message on DecryptMessage() fail
Spotted by GitHub Code Quality

Closes #22003
2026-06-14 14:17:27 +02:00
Viktor Szakats
ba16b83221
telnet: drop an int cast no longer necessary
Spotted-by GitHub Code Quality

Follow-up to c5637baa06
Follow-up to 83a5e39065

Closes #22002
2026-06-14 14:17:27 +02:00
Viktor Szakats
fe2df80a5a
socket: use name sockerr for socket error variables
Also:
- add comment explaining a `sockerr = errno` (vs. `SOCKERRNO`)
  assigment.

Closes #21998
2026-06-14 14:17:07 +02:00
Daniel Stenberg
fb83911aa6
socks_sspi: invalid response length is a fatal error
Pointed out by Zeropath
Closes #21999
2026-06-14 12:29:38 +02:00
Saud Alshareef
6b78264bcf
ldap: base64 encode binary LDIF values with WinLDAP
The WinLDAP backend only base64 encoded LDAP values when the attribute
name ended in ;binary. This made attributes such as jpegPhoto get
written as raw bytes, producing malformed LDIF output.

Match the OpenLDAP backend by also base64 encoding values with leading
or trailing blanks or non-printable bytes.

Fixes #21926
Reported-by: oreadvanthink on github
Closes #21982
2026-06-14 11:11:43 +02:00
Daniel Stenberg
8d3c4fe344
sspi: free libcurl allocated memory with curlx_free
DecryptMessage() decrypts the buffer in place, overwriting the original
contents. It does not allocate any new buffer so the single original
buffer should be freed using the same memory "system" that allocated it.

Reported-by: Trail of Bits
Closes #21990
2026-06-13 23:18:59 +02:00
Viktor Szakats
bb837dda23
telnet: drop redundant interim variables
Also reduce scope of a declaration.

Closes #21995
2026-06-13 01:27:50 +02:00
Stefan Eissing
73daec6620
lib: transfer origin and proxy handling
Add `data->state.origin` as the origin the transfer is sending the
current request to/gets the response from. Use it for request specific
properties like authentication, hsts and cookie handling, etc.

Unless talking to a forwarding HTTP proxy (e.g. not tunneling),
`data->state.origin` and `conn->origin` are the same.

With a forwarding HTTP proxy in play, `conn->origin` is set to
`conn->http_proxy.peer` and `conn->bits.origin_is_proxy` (a new bit) is
set.

Remove the connection bits, now replaced with:

* `conn->bits.socksproxy` -> `conn->socks_proy.peer`
* `conn->bits.httpproxy` -> `conn->http_proy.peer`
* `conn->bits.proxy` -> `(conn->socks_proy.peer || conn->http_proy.peer`)
* `conn->bits.tunnel_proxy` -> (`conn->http_proy.peer && !conn->bits.origin_is_proxy`)
* `(conn->bits.httpproxy && !conn->bits.tunnel_proxy)` -> `conn->bits.origin_is_proxy`

Rename `noproxy.[ch]` to `proxy.[ch]`. Move the connection proxy setup
code from `url.c` to `proxy.c`.

Remove `data->info.conn_remote_port` as no one uses it.

Add test_40_02b for a SOCKS connection to a forwarding HTTPS proxy.

Update internal documentation about peers and creds.

Closes #21967
2026-06-12 23:52:00 +02:00
Viktor Szakats
c951368579
build: enable -Wlogical-op picky warning for GCC 4.4+
Follow-up to 879a1514c3 #21992

Closes #21893
2026-06-12 23:37:37 +02:00
Viktor Szakats
879a1514c3
socket: introduce SOCK_EAGAIN() and use it
To contain the logic of checking for both `EWOULDBLOCK` and/or `EAGAIN`
depending on platform/availability. Also to avoid checking for both if
they mapp to the same value, and to avoid PP guards around use.

This also ensures `EAGAIN` is consistently not checked on Windows, where
headers defined it, but `SOCKERRNO` never returns it, because curl maps
it to `WSAGetLastError()`.

If they map to the same value, checking them both in an `if` expression
trips GCC warning `-Wlogical-op` (the same way it triggers duplicate
case value error in `switch`).

Also:
- replace two `switch()` statements with the new macro.
- tests/server/sws: make two outliers use the new macro that were only
  checking for `EWOULDBLOCK` before this patch, in `connect_to()`.
- move variables to the left-side of expressions, where missing.
- rustls: use a variant of this macro that uses raw `EWOULDBLOCK`.
  Tried tracing it back to the origins, but I couldn't figure out if
  this is working as expected on all supported Windows versions in
  Rust. It seems to be using `GetLastError()`, according to
  https://docs.rs/system_error/0.2.0/system_error/, which would be
  probably incorrect.

Notes:
- it's probably a good idea to assign `SOCKERRNO` to a variable before
  passing it to this macro.

Cherry-picked from #21893

Closes #21992
2026-06-12 23:27:23 +02:00
Viktor Szakats
7c51a33877
AmigaOS: fix build fallouts, re-add to CI
Fix build issues:
- src: adjust `toolx_ftruncate()`.
- libtests/cli_ftp_upload: make `struct timeval` initialization portable.
- libtests/lib1960: do unconst in local `inet_pton()` macro.
- tests/server/dnsd: make it stub instead of failing the build.
- tests/server: make them link AmiSSL for `SocketBase`.

Also:
- bump AmiSSL to the latest release.
- add download hash checks and toolchain cache.
- sync restored code with local updates made since last year.

It takes 30 seconds per job, 1 minute in total.

Thanks-to: Bebbo
Thanks-to: Darren Banfi
Ref: https://github.com/curl/curl/pull/21989#issuecomment-4691380623
Follow-up to 7a14898264 #17486

Closes #21993
2026-06-12 20:27:44 +02:00
Stefan Eissing
7d8c68adbe schannel: fix https proxy for client cert and certinfo
When schannel operates in front of a proxy, it needs to use the proxy
ssl configs, not the transfers ones. Choose the configs as it is done in
other TLS backends.

Prior to this change the client cert for the destination was mistakenly
also used as the client cert for the proxy.

Prior to this change the proxy server certificate info was mistakenly
saved as the destination cert info. However, if the destination was a
TLS connection, the real destination cert info would overwrite the
proxy cert info. libcurl currently does not support proxy server cert
info AFAICT (see discussion in #21986).

Closes https://github.com/curl/curl/pull/21986
2026-06-12 14:21:10 -04:00
Viktor Szakats
4f53234309
telnet: fix old copy-paste typo in variable name
This code lacks tests, though we agreed it looks plausible enough to
merge it based on surrounding code. Even though this line has been
present for a long time. If you use this code, please report any results
or issues.

Reported by GitHub Code Quality

Follow-up to ae1912cb0d

Closes #21979
2026-06-12 16:03:32 +02:00
Daniel Stenberg
a1db90053b
runtests: exit hard on duplicate test name
To make the mistake more noticeable

Closes #21991
2026-06-12 15:33:57 +02:00
Daniel Stenberg
5b9263e5d7
mailmap: Darren Banfi 2026-06-12 14:48:12 +02:00
Darren Banfi
982e2e8c75
AmigaOS: curl_setup.h avoid explicit_bzero with clib2
clib2 defines __NEWLIB__ after its system headers are included, but it
does not provide explicit_bzero().

curl therefore selects the explicit_bzero() path and fails to build with
m68k-amigaos-gcc:

```
../lib/curl_setup.h:1650:35: error: implicit declaration of function 'explicit_bzero' [-Werror=implicit-function-declaration]
 1650 | #define curlx_memzero(buf, size)  explicit_bzero(buf, size)
      |                                   ^~~~~~~~~~~~~~
curlx/strdup.c:115:5: note: in expansion of macro 'curlx_memzero'
  115 |     curlx_memzero(buf, size);
      |     ^~~~~~~~~~~~~
```

Excluding __CLIB2__ from the generic __NEWLIB__ branch makes curl use
its existing portable curlx_memzero() fallback. The full AmigaOS build
then completes successfully.

I've tested the following on Amiga OS 3.2.3 with this patch and latest
build.

- HTTP and HTTPS transfers
- AmiSSL certificate handling
- redirects
- downloads and file output
- timeout handling with the expected exit code 28
- repeated execution with clean exits
- no crashes or regressions observed

Follow-up to 066478f634 #21598

Closes #21989
2026-06-12 14:44:10 +02:00
Viktor Szakats
fb2441294e
GHA/distcheck: switch to parse info.json
Refs:
c569aaa161
https://github.com/curl/curl-www/pull/596

Follow-up to b3bc61ab68 #21978

Closes #21988
2026-06-12 13:33:06 +02:00
Daniel Stenberg
8664a9f378
runtests: error out on duplicate test names
Closes #21984
2026-06-12 13:19:44 +02:00
Daniel Stenberg
ab3bb8cd8b
config2setopts: use default protocol properly
Verified by test 1724, 1725 and 2036

Closes #21983
2026-06-12 12:57:15 +02:00
Viktor Szakats
410f3ca585
checksrc: silence -b option debug message
Closes #21985
2026-06-12 12:08:45 +02:00
Viktor Szakats
d77b4b7407
GHA: drop brew update from all jobs
After adding it a month ago (where missing) to fix a failure.

Removing this time to fix a different failure (on Linux), and also to
improve CI performance. Some install steps take over a minute, most of
that spent on `brew update`.

GH runner images also enabled extra taps which may contribute to further
delays, and seen to make it more fragile if GH itself struggles (taps
are hosted there.)

Refs:
https://github.com/curl/curl/actions/runs/27384213554/job/80927624171
https://github.com/curl/curl/actions/runs/27382368348/job/80921910973

Follow-up to db5d888673 #21608

Closes #21981
2026-06-12 02:46:03 +02:00
Viktor Szakats
abdfa2baff
lib695, lib757: fix truncated newline in error messages
Closes #21980
2026-06-12 01:33:05 +02:00
Viktor Szakats
b3bc61ab68
GHA/distcheck: use https://curl.se/info
Suggested-by: Daniel Stenberg
Ref: https://github.com/curl/curl/pull/21977#issuecomment-4684764838
Follow-up to 0cd0a64de4 #21977

Closes #21978
2026-06-12 01:08:53 +02:00
Daniel Stenberg
c37b3982b3
RELEASE-NOTES: synced 2026-06-11 23:28:30 +02:00
Daniel Stenberg
c5b6b744ed
libtests: add and use tutil_throwaway_cb
This is an implementation of a CURLOPT_WRITEFUNCTION callback that just
throws away the content and returns success. Saves us from having to
reimplement it many times in different tests.

Closes #21971
2026-06-11 23:17:05 +02:00
Fabian Keil
244834d3a1
tests: add the "--resolve" keyword to tests that lack it
... even though they use the curl option "--resolve".

This makes it more convenient to choose or skip the tests.

For example Privoxy's cts test framework relies on the "--resolve"
keyword when executing the "upstream-tests" scenario to skip curl
tests that aren't expected to work when the requests are made through
Privoxy. While some of the modified tests are already skipped for
other reasons through other means when testing Privoxy, it's good to
be consistent.

Closes #21930
2026-06-11 23:10:16 +02:00
Viktor Szakats
0cd0a64de4
GHA/distcheck: fix parsing the download page
Fixing:
```
curl: (3) URL rejected: Malformed input to a URL function
```
Ref: https://github.com/curl/curl/actions/runs/27370389568/job/80880800780

Refs:
1735f6af6a
https://github.com/curl/curl-www/pull/593

Follow-up to 2cc171cbd4 #21759

Closes #21977
2026-06-11 22:09:47 +02:00
Viktor Szakats
bcb2890c6f
telnet: fix error message typos
Spotted by GitHub Code Quality

Closes #21976
2026-06-11 22:09:47 +02:00
Viktor Szakats
8b1be77c44
runtests: fix tests for curl builds with embedded CA bundle
Reported-by: Rainer Jung
Co-authored-by: Rainer Jung
Fixes #21970
Follow-up to 8a3740bc8e #14059

Closes #21973
2026-06-11 20:57:59 +02:00
Viktor Szakats
e35ba09f47
tidy-up: add spaces around equal operators where missing
Found via regex search: `=[^~>= ]`

Closes #21975
2026-06-11 19:52:01 +02:00