Commit Graph

38383 Commits

Author SHA1 Message Date
Stefan Eissing
567803db79
dns: https-eyeballing async
Make cf-https-connect work async correctly:
- only start first baller when at least one A/AAAA address
  is available
- select first connect attempt after that with HTTPS-RR info
  there or not.
- select second connect attempt only when HTTPS-RR is resolved
  (may have resolved to "not known") and select possible ALPN
  from things known by then. May not select any second attempt
  when first already covers everything.

This means when the HTTPS-RR is known at/before the first address
is resolved, everything behaves as before. When the HTTPS-RR is
late, a first connection attempt will have been started. Any
ALPN preference from the HTTPS-RR that is not already ongoing will
then start the second attempt.

For HTTPS-RRs that recommend 2 or more ALPNs, the first will always
be attempted: either it is already ongong or it will be the ALPN
for the second attempt. The 2nd ALPN recommendation from HTTPS-RR
*may* be honored or not, depending on what is already selected.

The difference in behaviour between early/late HTTPS-RR resolve
cannot be helped - unless we do not perform any attempts before
it arrives. Trade offs.

Closes #21267
2026-04-08 23:15:39 +02:00
Dan Fandrich
17e8200733 tests: make whitespace between functions and classes consistent
Mostly, this means two blank lines between classes and functions and one
line between methods. Since these checks are currently in preview, they
are done in a separate ruff invocation to avoid turning ALL the preview
checks on at the same time.
2026-04-08 10:28:05 -07:00
Dan Fandrich
98e470b3a8 tests: alphabetize and group Python imports & add check
- De-duplicates, groups, and sorts imports based on the provided `isort` settings.
2026-04-08 10:28:05 -07:00
Dan Fandrich
4c1b6f5494 tests: enable more ruff checks
- Checks for missing explicit `return` statements at the end of functions
that can return non-`None` values.
- Checks for classes that inherit from `object`.
- Checks for useless expressions.
- Within an `except*` clause, raise exceptions with `raise ... from err`
or `raise ... from None` to distinguish them from errors in exception
handling
- Checks for variable assignments that immediately precede a `return` of the
assigned variable.
- Checks for `else` statements with a `return` statement in the preceding
`if` block.
- Checks for unnecessary parentheses on raised exceptions.

Closes: #21258
2026-04-08 10:28:05 -07:00
Daniel Stenberg
698eee1b95
vtls_scache: include cert_blob independently of verifypeer
The making of the TLS session cache key should use the cert blob
independently of verifypeer on/off.

Follow-up to fa0ccd9f1f

Spotted by Codex Security

Closes #21222
2026-04-08 15:18:45 +02:00
Daniel Stenberg
283db12e05
parsedate: bsearch the time zones
There are 69 entries, bsearch is faster than linear search for random
access.

This now also makes the matching case sensitive (zone names always in
uppercase). No docs said otherwise and all tests assumed uppercase.

Extended test 517

Closes #21266
2026-04-08 12:00:59 +02:00
Viktor Szakats
5d84aa41a0
RELEASE-NOTES: update the entry for mk-ca-bundle.pl [ci skip]
To dsecribe the feature remaiming after follow-up commits.

Follow-up to 351e4f956a #21116
2026-04-08 11:41:55 +02:00
Daniel Stenberg
c0e7f70218
RELEASE-NOTES: synced 2026-04-08 11:33:11 +02:00
Daniel Stenberg
59c8de7897
mbedtls: fix ECJPAKE matching
It did not require a full-length match, so empty or prefix tokens map to
ECJPAKE would silently add that cipher to the configured list.

Follow-up to fba9afebba

Reported by Codex Security

Closes #21264
2026-04-08 11:27:31 +02:00
Ted Lyngmo
135665036f
docs: use the correct CURLOPT_WRITEFUNCTION signature
In order to not encourage users to use incompatible function pointers,
change the callback function definitions to use `char *` instead of
`void *` for the first argument.

Triggered by https://stackoverflow.com/questions/79921871/curl-c-c-library-based-application-produces-erronious-response-for-http-post-r#comment141032037_79921871 :

"The code was mostly modified from
 [this example code](https://curl.se/libcurl/c/postinmemory.html),
 honestly I never knew this is wrong. Thanks for pointing it out."

Signed-off-by: Ted Lyngmo <ted@lyncon.se>
Closes #21265
2026-04-08 11:25:54 +02:00
Daniel Stenberg
80b2a5dd37
tool_getparam: reduce opt_string complexity
- move arguments taking unsigned numbers into opt_num

- move arugments taking seconds into opt_secs

Closes #21261
2026-04-08 08:03:16 +02:00
Viktor Szakats
4c9af8b6d1
configure: silence useless clang warnings in C89 builds
Syncing with CMake.

Follow-up to 43397b0283 #21015
Follow-up to 09c9afdd71 #20363

Closes #21263
2026-04-08 03:51:54 +02:00
Viktor Szakats
f82ed74ed6
GHA/linux: bump mbedTLS 3 to 3.6.5 (from 3.6.4), also verify hash
Also:
- fix incorrect version in cache id.
  Follow-up to 3a305831d1 #19077
- latest version 3.6.6 fails pytests. Seems similar to the v4.1.0
  regression.
  https://github.com/curl/curl/pull/21178
  https://github.com/Mbed-TLS/mbedtls/issues/10668

Closes #21262
2026-04-08 02:31:44 +02:00
Viktor Szakats
b2a767dbce
gtls: fail for large files in load_file()
Used for issuer certs. Limit the size at `CURL_MAX_INPUT_LENGTH`, 8MB.

Bug: https://github.com/curl/curl/pull/21256#discussion_r3045854654

Closes #21257
2026-04-07 20:04:44 +02:00
Viktor Szakats
d3dc5dbc87
clang-tidy: avoid assigments in if expressions
Also enable check in clang-tidy.

Cherry-picked from #20794

Closes #21256
2026-04-07 16:57:46 +02:00
Daniel Stenberg
3536730f33
parsedate: clarify time2epoch and add more variations to test 517
Polish the time2epoch function to become a little more readable.

Corrected the military time zones: they were going in the wrong
direction.

Add more curl_getdate() input varations to test 517

Closes #21251
2026-04-07 16:32:22 +02:00
Daniel Stenberg
09f9035045
clang-tidy: drop readability-math-missing-parentheses
It's mostly annoying and not helpful
2026-04-07 16:32:22 +02:00
Stefan Eissing
db9b6fa82e
cf-ip-happy: limit concurrent attempts
Introduce a limit on the concurrent connect attempts of 6:

- document this in CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS
- close the oldest attempt before opening a new one that would
  exceed the limit
- closing failed attempts early to avoid sockets use beyong their
  usefulness
- add tests for limits in unit2600

These changes are externally visible as file descriptors will be
reassigned where we previously kept the old one around and started a
new socket, allocating always a new descriptor.

Closes #21252
2026-04-07 16:26:25 +02:00
renovate[bot]
44c19a2cce
GHA: update openssl/openssl to v3.6.2
Closes #21254
2026-04-07 16:09:51 +02:00
Daniel Stenberg
b168fc79ff
libssh: split myssh_statemach_act into sub functions and rename
Follow-up to bd3b2a626a

- rename it to myssh_statemachine

- remove the use of ternary operators in the switch

- fix the error handling for if 'sshp' actually ever is NULL

Closes #21250
2026-04-07 15:59:04 +02:00
Daniel Stenberg
a20989b82c
libssh2: split ssh_statemachine into more sub functions
The pieces of the state machine that were not separate functions before, now
are.

Also removed the use of ternary operators in the function calls.

Follow-up to f0bf43e209

Closes #21249
2026-04-07 14:50:42 +02:00
Daniel Stenberg
74a169575d
protocol: disable connection reuse for SMB(S)
Connections should only be reused when using the same "share" (and
perhaps some additional conditions), but instead of fixing this flaw,
this change completely disables connection reuse for SMB. This protocol
is about to get dropped soon anyway.

Reported-by: Osama Hamad
Closes #21238
2026-04-07 13:23:01 +02:00
Viktor Szakats
a0d5d8fea3
curl_ntlm_core: use wolfCrypt DES API with wolfSSL
Replacing the last uses of the OpenSSL compatibility API, and dropping
the redefinition of external symbols.

Closes #21247
2026-04-07 11:58:30 +02:00
Viktor Szakats
f974a00aba
lib: replace PRI*32 printf masks with C89 ones
Also: fix indent.

Follow-up to 13c1a93414 #20215

Closes #21234
2026-04-07 11:58:30 +02:00
renovate[bot]
f1e3091923
Dockerfile: update debian:bookworm-slim Docker digest to 4724b8c
Closes #21248
2026-04-07 07:50:19 +02:00
Daniel Stenberg
be92f0a2e4
lib: reserve 'result' for CURLcode, even more
Closes #21245
2026-04-07 07:48:58 +02:00
Viktor Szakats
fc3261b284
cmake: pre-fill HAVE_PIPE2 for two more platforms
For DragonFlyBSD and SunOS.

Also opt-in `BSD`, which is covering those listed explicitly, when using
CMake 3.25+.

Follow-up to 131a2fd5aa #16987

Closes #21243
2026-04-07 00:33:48 +02:00
Daniel Stenberg
9f5d1a38d1
lib: reserve 'result' for CURLcode
For consistency, whereever we use a local variable named 'result' that
is a CURLcode type. Make other types use other names.

Closes #21244
2026-04-06 23:12:06 +02:00
Daniel Stenberg
4cb4f9d602
cfilters: fix Curl_pollset_poll() return code mixup
Curl_conn_cf_poll did not map adjust_pollset failures to poll-style
errors properly, so error codes were treated as ready events.

Found by Codex Security

Closes #21231
2026-04-06 22:09:03 +02:00
Viktor Szakats
ecd09257d8
GHA/curl-for-win: drop certdata dependency and GITHUB_TOKEN with it
`certdata` dependency requires accessing api.github.com for
a reproducible timestamp, which in turn requires a GitHub token to avoid
errors due to rate limiting. Avoid all this by omitting this dependency,
which isn't necessary for these build tests anyway.

The `zero` job already did not use `certdata`, but disable explicitly
anyway just in case.

Reported-by: James Fuller

Follow-up to 9514184977
Follow-up to 128c252975 #21105

Closes #21241
2026-04-06 18:49:13 +02:00
Viktor Szakats
596f685da5
GHA: autoreconf downloaded tarballs where missing
To avoid using pre-built `./configure` scripts.

Also: drop unrecognized nettle `./configure` option.

Closes #21240
2026-04-06 18:49:13 +02:00
Viktor Szakats
7b96563a05
spacecheck.pl: fix to check 3+ newlines in all files
Follow-up to e52e6dac8e #20269

Closes #21237
2026-04-06 04:05:58 +02:00
Viktor Szakats
e078485b36
cmake: drop redundant condition
Follow-up to 43397b0283 #21015
Cherry-picked from #21000
2026-04-06 02:52:08 +02:00
Viktor Szakats
6e9df9f111
Makefile.am: replace stray := with = [ci skip]
`=` is used everywhere else in `Makefile.am` files.

Cherry-picked from #21000
2026-04-06 02:52:08 +02:00
Viktor Szakats
5fdb35a3bc
curl_setup.h: drop stray/unused USE_OPENSSL_QUIC guard
Follow-up to 6aaac9dd38 #20226

Closes #21235
2026-04-05 22:03:50 +02:00
Viktor Szakats
af08d642ea
man: fix argument type for CURLSHOPT_[UN]SHARE options
Closes #21232
2026-04-05 18:03:41 +02:00
Daniel Stenberg
f3176e0be8
CURLOPT_SOCKS5_AUTH.md: an access property
Reported-by: Cutiapreta on hackerone
Closes #21230
2026-04-05 17:47:57 +02:00
Viktor Szakats
8b50c9d1cc
GHA/windows: enable more options in 32-bit jobs
c-ares, gnutls, libssh, openssl.

Closes #21227
2026-04-05 17:41:11 +02:00
Daniel Stenberg
f22f08a0df
docs: noproxy wants the punycoded hostname version
Reported-by: Mehtab Zafar

Closes #21228
2026-04-05 16:53:09 +02:00
Viktor Szakats
20756bcf9a
libssh: fix 64-bit printf mask for mingw-w64 <=6.0.0
Fixing (dl-mingw, CM 6.4.0-i686 (mingw-w64 5.0.0) schannel !unity):
```
lib/vssh/libssh.c: In function 'myssh_in_SFTP_QUOTE_STATVFS':
lib/vssh/libssh.c:573:31: error: ISO C does not support the 'I' printf flag [-Werror=format=]
     char *tmp = curl_maprintf("statvfs:\n"
                               ^~~~~~~~~~~~
lib/vssh/libssh.c:573:31: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
lib/vssh/libssh.c:573:31: error: ISO C does not support the 'I' printf flag [-Werror=format=]
[...]
```
Ref: https://github.com/curl/curl/actions/runs/24002480364/job/70000685821

mingw-w64 <=6.0.0 define `PRIu64` like this:
```
./inttypes.h:#define PRIu64 "I64u"
```

Follow-up to 413a0fedd0 #12346
Cherry-picked from #21227

Closes #21229
2026-04-05 16:45:30 +02:00
Daniel Stenberg
7813d9a077
share: do bitshifts after the type is checked to be valid
Fixes #21224
Reported-by: bird on github
Closes #21226
2026-04-05 16:07:54 +02:00
Viktor Szakats
8968a68eba
libssh: fix -Wsign-compare in 32-bit builds by dropping a redundant check
Follow-up to 8c8eeba522 #21214 (wrong silencing)
Follow-up to c049c37acd #18989 (add redundant check)
Follow-up to c988ec9f41 #9328 (make check fail)
Follow-up to 44a02d2532 #9324 (add original check)

Closes #21225
2026-04-05 15:23:02 +02:00
Viktor Szakats
acda4eae5e
runtests: allow configuring SSH host/client key algorithm
via env `CURL_TEST_SSH_KEYALGO`, `rsa` (default), `ecdsa`, `ed25519`.

To ease debugging and testing and to make these code paths more
universal.

Closes #21223
2026-04-05 11:19:42 +02:00
Daniel Stenberg
2e5d219205
sendf: fix CR detection if no LF is in the chunk
When doing line ending conversions, and a chunk contains no '\n', the
function returned early without updating prev_cr to reflect the last
byte. It could then lead to CRLFs sequences not get converted when
occuring right on the boundary border.

Found by Codex Security

Closes #21221
2026-04-04 22:32:54 +02:00
Viktor Szakats
ec22ea2502
GHA/windows: restore libssh, fix to pass tests with 0.12.0
libssh 0.12.0 on Windows 64-bit Intel fails to connect to sshd (with SSH
state 30) when using the mlkem768x25519-sha256 KEX. (32-bit Intel, ARM64
and tested non-Windows platforms work fine.) Fix by disabling this KEX
for the libssh job.

I do not recommend libssh on Windows due to bugs an insecure behavior.

Also:
- fix libssh TFLAGS condition for mingw-w64.

Follow-up to e127f8ce84 #21204
Follow-up to fcf946e846 #21195

Closes #21199
2026-04-04 18:34:13 +02:00
Viktor Szakats
c98d0a2e9a
sshserver.pl: add option to disable KEX algorithms in sshd
Cherry-picked from #21199

Closes #21220
2026-04-04 17:16:36 +02:00
Daniel Stenberg
741ee57375
doh: remove superfluous doh_req check
It has already been checked previously in the function.

Spotted by CodeSonar

Closes #21216
2026-04-04 17:10:37 +02:00
Daniel Stenberg
b669a58f2e
CURLOPT_UPLOAD_FLAGS.md: expand
And list each supported flag in a nicer way

Closes #21218
2026-04-04 17:09:23 +02:00
Daniel Stenberg
6d6d81e393
url: set default upload flags to CURLULFLAG_SEEN
As documented. Not doing this was a regression.

Follow-up to 6758aa722d

Reported by Codex Security

Closes #21217
2026-04-04 17:07:22 +02:00
Viktor Szakats
3b8bb1a86a
GHA/windows: bump OpenSSH-Windows to v10, other improvements
- use it in a mingw-w64 job.
- add support for native ARM64 binaries.
- add ability to use built-in OpenSSH server in mingw-w64 jobs.

Cherry-picked from #21199

Closes #21219
2026-04-04 15:52:44 +02:00