Commit Graph

36907 Commits

Author SHA1 Message Date
Viktor Szakats
1b48c6148a
tidy-up: miscellaneous
- schannel: delete superfluous parenthesis.
- tftp: delete stray space from log output.
- ws: update guard comment.
- docs/examples: constify variables.
- runtests/servers: enclose unknown parameter between quotes.
- scripts/perlcheck.sh: drop redundant grep `-E` option.
- THANKS: move names from comments to THANKS.
- sync `--depth` option style across scripts.
- sync git repo URL ending between some scripts.
- BINDINGS.md: drop protocol from archive.org URL path.
- whitespace, indent, unfold lines.

Closes #19565
2025-11-17 13:32:43 +01:00
Viktor Szakats
a87383828e
badwords: fix issues found in tests
There remain some false positives, hits in test data, and `dir` use,
around 100 issues in total.

There is no plan to enforce badwords on tests.

Also:
- badwords.txt: let a few `manpage[s]` occurrences through
  (in Perl code).

Closes #19541
2025-11-17 13:30:35 +01:00
Viktor Szakats
f0de14168a
cf-socket: limit use of TCP_KEEP* to Windows 10.0.16299+ at runtime
Before this patch `TCP_KEEP*` socket options were unconditionally used
if the build-time SDK supported them. This caused curl logging errors
(or trace messages since #19527) on Windows versions missing support
for them. After this patch, use them only when the runtime environment
supports it and fall back to the alternate method (`SIO_KEEPALIVE_VALS`)
dynamically.

Also:
- log a trace message when using the Win10 method.
- document which SDK versions offer `TCP_KEEP*` macros.

Ref: https://learn.microsoft.com/windows/win32/winsock/ipproto-tcp-socket-options
Ref: https://learn.microsoft.com/windows/win32/winsock/sio-keepalive-vals

Reported-by: Aleksandr Sergeev
Fixes #19520
Follow-up to dc34498d18 #19527
Closes #19559
2025-11-17 12:16:51 +01:00
Viktor Szakats
f2460e2cb5
RELEASE-NOTES: update upcoming removals
Also add a missed commit (noticed by accident)

Closes #19558
2025-11-17 12:16:50 +01:00
Stefan Eissing
217f0e4d59
pytest fixes and improvements
- fix test_17_20 flakiness: the test case did not have `nghttpx` in
  its parameters, causing it to no check if a reload was necessary.
  When that test ran behind one that gave nghttpx another certificate,
  eg. in parallel mode, it used the wrong pinned pubkey.
- Have `env` provide lists of HTTP protocol versions available for
  testing. Replace parameterized tests on a fixed protocol list with
  the dynamic one from env. This makes checks for protocol availability
  in the test function bodies superfluous.

refs #19489
Closes #19540
2025-11-17 08:02:52 +01:00
Daniel Stenberg
b3d4f17e3d
curl_sasl: make Curl_sasl_decode_mech compare case insenstively
The provided mechanisms should be compared case insenstively.

Found by ZeroPath

Closes #19535
2025-11-17 08:01:13 +01:00
Daniel Stenberg
f5fa8048f7
RELEASE-NOTES: synced 2025-11-16 23:38:48 +01:00
x2018
205a8e861f
wolfssl: fix a potential memory leak of session
Closes #19555
2025-11-16 23:32:41 +01:00
Viktor Szakats
c07a7f6bf8
runtests: detect bad libssh differently for test 1459 (fixing CircleCI libssh job)
test 1459 "SFTP with corrupted known_hosts" was seen failing in the past.
To fix it, the test was automatically disabled when detecting libssh
0.9.3 or older, as in the curl CircleCI job, running on Ubuntu 20.04.
This work for a long time, until bumping the CircleCI runner to Ubuntu
22.04 (to have OpenSSL 3), where the test was running again, and failing
with the isssue seen in the past.

- Test skipped with Ubuntu 20.04 (libssh 0.9.3):
  https://app.circleci.com/pipelines/github/curl/curl/16445/workflows/7f198763-e0b0-4037-9245-4c4b40ab8726/jobs/155164
- Failure seen with Ubuntu 22.04 (libssh 0.9.6):
  https://app.circleci.com/pipelines/github/curl/curl/16452/workflows/b817a808-0fd4-40b0-8eb0-d064926efe12/jobs/155206?invite=true#step-107-211709_45
- Failure seen with Ubuntu 24.04 (libssh 0.10.6):
  https://app.circleci.com/pipelines/github/curl/curl/16455/workflows/86c631f1-3c5f-4438-b398-3df2bdab5d20/jobs/155218

Turns out the issue issue isn't libssh 0.9.3 itself, but
a CircleCI-specific default configuration in `/etc/ssh/ssh_config`:
```
# BEGIN ANSIBLE MANAGED BLOCK
Host *
StrictHostKeyChecking no     <------ this particular line
HashKnownHosts no
SendEnv LANG LC_*
# END ANSIBLE MANAGED BLOCK
```

libssh will consult configuration files on hard-coded default system
locations and alter its behavior based on settings found in them.

This libssh behavior is present in all supported versions:
5a2abd34ce
https://gitlab.com/libssh/libssh-mirror/-/tags/libssh-0.9.0

It means the existing disable logic based on libssh version worked by
coincidence, and what needs to be checked is these configurations
to decide if it's safe to run the test. Another, simpler option is
to also accept the result code 67, though in that case the test
wouldn't actually test what we want, but would pass anyway.

With the old `oldlibssh` workaround deleted, and the problematic setting
manually overridden (`StrictHostKeyChecking yes`):
- CircleCI Ubuntu 20.04 passes with 1459 enabled:
  https://app.circleci.com/pipelines/github/curl/curl/16483/workflows/87a9f389-76a2-4a32-acde-c0b411a4c842/jobs/155302
- CircleCI Ubuntu 22.04 does too:
  https://app.circleci.com/pipelines/github/curl/curl/16483/workflows/87a9f389-76a2-4a32-acde-c0b411a4c842/jobs/155303

To fix, replace the `runtests` `oldlibssh` detection logic to parse
libssh config files (instead of checking for libssh version) and disable
test 1459 based on that. Notice the detection is making a light attempt
to parse these files, and does not implement most config file features
(such as includes, quoted values and `=` operator.)

The new runtests workaround tests OK with the:
- default CircleCI configuration, disabling 1459 automatically.
- a sudoless configuration fix, with 1459 run successfully.
  Also keep setting this option in CircleCI jobs.
- a sudo configuration fix, with 1459 run successfully.
Ref: https://app.circleci.com/pipelines/github/curl/curl/16492/workflows/56f39335-97ba-412c-9a9b-3d662694375a

GHA jobs are not affected and they work fine, with 1459 running successfully
before and after this patch.

It's possible the libssh API offers ways to control config file use
and/or set the strict host checking option programatically. Maybe
to enable in debug mode (albeit CircleCI job are not debug-enabled),
or offer an option for them. It may be something for a future patch.

Follow-up to 23540923e1 #8622
Follow-up to 4b01a57c95 #8548
Follow-up to bdc664a640 #8490
Follow-up to 7c140f6b2d #8444

Ref: 6d9c5c91b9 #19549

Closes #19557
2025-11-16 23:28:44 +01:00
Viktor Szakats
ea2203c1aa
GHA/codeql: limit cron job to the origin repository
To avoid running it in every fork, every week.

Closes #19552
2025-11-16 19:51:20 +01:00
Viktor Szakats
6d9c5c91b9
CI: avoid restart prompt on libssh-dev install in CircleCI
By setting `DEBIAN_FRONTEND=noninteractive`.

Also:
- add `curl -V` step to CircleCI jobs.
- drop duplicate `libpsl` from `apt install`.
- replace sudo pip with venv, fixing a warning and syncing with GHA.
- Note that test 1459 was disabled on Ubuntu 20.04 due to past issues.
  When running on newer CircleCI Ubuntu runners (22.04 or 24.04), the
  test is not disabled, and also fails with the issue seen in the past.
  I've identified the root cause and will fix it in a separate PR.

Ref: https://circleci.com/developer/images?imageType=machine
Ref: https://discuss.circleci.com/t/ubuntu-20-04-22-04-24-04-q3-current-release/51856/7
Ref: https://app.circleci.com/pipelines/github/curl/curl/16450/workflows/af1f2a99-6452-4cc3-96c1-18a217ebabfc/jobs/155194

Follow-up to 8ba10a790a #19546

Closes #19549
2025-11-16 19:51:04 +01:00
Daniel Stenberg
eeff93013c
rustls: minor adjustment of sizeof()
The mistake is harmless because it is still a size of a pointer, but
this is the correct pointer.

Acked-by: Daniel McCarney
Reported-by: pelioro on hackerone
Bug: https://hackerone.com/reports/3427460
Closes #19545
2025-11-16 17:54:49 +01:00
Viktor Szakats
517a12922e
GHA/linux: add missing condition for nghttp2-filc cache step
Follow-up to 67ef4a34f2 #19457

Closes #19548
2025-11-16 00:52:41 +01:00
Viktor Szakats
4c76cdc157
runtests: drop Python 2 support remains
Used in the test SMB and telnet servers.

Closes #19544
2025-11-16 00:52:41 +01:00
Viktor Szakats
6225d7ba2f
CI: drop no longer used install-wolfssl step in Circle CI
Follow-up to b011e3fcfb #18700

Closes #19547
2025-11-16 00:27:49 +01:00
Viktor Szakats
8ba10a790a
CI: bump Circle CI jobs to Ubuntu 22.04 runners for OpenSSL 3
Ref: https://packages.ubuntu.com/jammy/libssl-dev

Follow-up to 69c89bf3d3 #18330

Closes #19546
2025-11-16 00:27:49 +01:00
Viktor Szakats
dbe06f38ae
DEPRECATE.md: move OpenSSL to past removals (fixup)
Follow-up to bb213bd769 #19542
2025-11-15 22:33:13 +01:00
Viktor Szakats
bb213bd769
DEPRECATE.md: move OpenSSL to past removals
Follow-up to 69c89bf3d3 #18330

Closes #19542
2025-11-15 22:30:15 +01:00
Viktor Szakats
69c89bf3d3
openssl: bump minimum OpenSSL version to 3.0.0
It also means that all supported OpenSSL versions and forks support
TLSv1.3 after this patch.

It reduces `openssl.c` size by more than 10%, or 400 LOC.

Ref: #18822
Closes #18330
2025-11-15 15:56:31 +01:00
Viktor Szakats
2e1a045d89
build: drop support for VS2008 (Windows)
Require Visual Studio 2010 or newer.

Ref: https://github.com/curl/curl/discussions/15972

Follow-up to dc28bb86c1 #17798
Follow-up to 63e513b106 #17380

Closes #17931
2025-11-15 15:56:19 +01:00
Viktor Szakats
554dfa5568
build: drop Windows CE / CeGCC support
Windows CE support was limited to successful builds with ming32ce
(a toolchain that hasn't seen an update since 2009, using an ancient gcc
version and "old mingw"-style SDK headers, that curl deprecated earlier).
Builds with MSVC were broken for a long time. mingw32ce builds were never
actually tested and runtime and unlikely to work due to missing stubs.
Windows CE toolchains also miss to comply with C89. Paired with lack of
demand and support for the platform, curl deprecated it earlier.

This patch removes support from the codebase to ease maintaining Windows
codepaths.

Follow-up to f98c0ba834 #17924
Follow-up to 8491e6574c #17379
Follow-up to 2a292c3984 #15975

Closes #17927
2025-11-15 15:35:23 +01:00
Viktor Szakats
2dc71ba8bf
badwords: check indented lines in source code, fix fallouts
- badwords.pl: add `-a` option to check all lines in source code files.
  Before this patch indented lines were skipped (to avoid Markdown code
  fences.)
- GHA/checksrc: use `-a` when verifying the source code.
- GHA/checksrc: disable `So` and `But` rules for source code.
- GHA/checksrc: add docs/examples to the verified sources.
- badwords.txt: delete 4 duplicates.
- badwords.txt: group and sort contractions.
- badwords.txt: allow ` url = `, `DIR`, `<file name`.

Closes #19536
2025-11-15 13:25:02 +01:00
Viktor Szakats
8a968095df
mk-ca-bundle.pl: default to SHA256 fingerprints with -t option
Replacing previous default: MD5.

You can use the existing `-s` option to override the default.

Also bump version to 1.30.

Closes #19359
2025-11-15 03:06:33 +01:00
Viktor Szakats
7bb59a7dc7
badwords.pl: fix variable in printf mask
Causing warnings if a matched line has mask patterns.

Closes #19534
2025-11-14 18:14:31 +01:00
Viktor Szakats
231e8a71e1
docs: fix checksrc warning, fix checkdocs CI filter
Also:
- GHA/checkdocs: fix CI filters to catch it early.
  Follow-up to 28dd14aafe #15797

Closes #19533
2025-11-14 17:32:04 +01:00
Viktor Szakats
af4c789e00
badwords: fix two exceptions and drop them
Also:
- extend `dir` rule to exclude C assignments.

Closes #19532
2025-11-14 17:32:04 +01:00
Viktor Szakats
f3095f0dbd
GHA/checksrc: check XML files for errors
Closes #19528
2025-11-14 17:32:04 +01:00
nait-furry
57b4fe1817
limit-rate: add example using --limit-rate and --max-time together
Closes #19473
2025-11-14 17:09:07 +01:00
Stefan Eissing
f37c956d0f
test07_22: fix flakiness
The HTTP/3 tests did send 20 transfers against nghttpx with a backend
that failed the uploads with a 400 and an incomplete response body. This
causes stream resets.

Apache keeps the connection open, but newer nghttpx closes the front
connection after "too many" reset. When that bites, it depends on the
number of transfers ongoing how the test case fails. This led to flaky
outcomes.

Reduce the transfers to just a single one and check the result of
that one. Parallelism is not important here.

refs #19489
Closes #19530
2025-11-14 17:06:23 +01:00
Daniel Stenberg
3d91ca8cdb
vquic-tls/gnutls: call Curl_gtls_verifyserver unconditionally
Closes #19531
2025-11-14 17:05:11 +01:00
Stefan Eissing
dc34498d18
cf-socket: trace ignored errors
Instead of blasting the user with infof() statements.

Reported-by: Aleksandr Sergeev
Fixes #19520
Closes #19527
2025-11-14 17:04:15 +01:00
Stefan Eissing
9f979ea683
vtls: pinned key check
Cleanup the vtls pinned key matching somewhat. Add a DEBUGF
for pinned key hashes that do not match, so we can see in
traces what was going on.

Ref #19489
Closes #19529
2025-11-14 17:01:44 +01:00
Stefan Eissing
0abb72210e
getinfo: improve perf in debug mode
Save some cpu cycles in debug mode for getinfo. Look up env vars for
overwriting variables only when variables are actually requested.

Closes #19525
2025-11-14 16:47:47 +01:00
Daniel Stenberg
9a633ec04f
connect: reshuffle Curl_timeleft_ms to avoid 'redundant condition'
Line 143: "if(duringconnect)" would always equal true. While this is
harmless, I believe this minor tweak makes the flow slightly more
obvious to the reader and avoids the redundant condition.

Pointed out by CodeSonar

Closes #19523
2025-11-14 15:12:58 +01:00
Stefan Eissing
971e8d661c
examples/multithread: fix race condition
Reported-by: Nick Korepanov
Fixes #19524
Closes #19526
2025-11-14 15:11:53 +01:00
Daniel Stenberg
5f4cd4c689
DEPRECATE: remove RTMP support in April 2026
URL: https://curl.se/mail/lib-2025-11/0008.html
2025-11-14 09:42:03 +01:00
Daniel Stenberg
3fc31c4ee2
config2setopts: bail out if curl_url_get() returns OOM
Closes #19518
2025-11-14 09:39:42 +01:00
Viktor Szakats
ae7b4eeade
curl_setup.h: drop stray #undef stat (Windows)
Follow-up to 9678ff5b1b #18776

Closes #19519
2025-11-14 01:47:12 +01:00
Viktor Szakats
96500f466e
tidy-up: result code variable names in tests and examples
Sync outliers with the rest of the code.

Also:
- return error in some failed init cases, instead of `CURLE_OK`:
  1908, 1910, 1913, 2082, 3010
- lib1541: delete unused struct member.

Closes #19515
2025-11-14 01:47:12 +01:00
Daniel Stenberg
e3e0559ed2
config2setopts: exit if curl_url_set() fails on OOM
An error case that previously did not properly return error.

Closes #19517
2025-11-13 22:57:08 +01:00
Daniel Stenberg
42098d1ee6
checksrc: verify close brace indent level
Closes #19512
2025-11-13 17:27:48 +01:00
Daniel Stenberg
0afb52a0cd
code: minor indent fixes before closing braces
Closes #19512
2025-11-13 17:27:40 +01:00
Daniel Stenberg
75955c0851
tool_operate: exit on curl_share_setopt errors
Continuing when one of these has failed is fragile and error-prone.

Closes #19513
2025-11-13 17:24:40 +01:00
Daniel Stenberg
f2a75a14dd
sws: repair --port, and accept any port
Also for mqttd and sockfilt. The < 1025 check was not serving any
purpose.

Follow-up to bb1391f943
2025-11-13 17:20:41 +01:00
Viktor Szakats
6384e2aca0
checksrc: disallow atoi and atol globally
No longer used in core and test code.

Also: allowlist in docs/examples.

Closes #19508
2025-11-13 14:28:25 +01:00
Viktor Szakats
bb1391f943
tests/server: replace atoi() and atol() with curlx_str_number()
Closes #19510
2025-11-13 14:09:03 +01:00
Daniel Stenberg
833c429627
wolfssl: simplify wssl_send_earlydata
Move out logic from a switch() expression and return error directly
instead of using goto. This also removes the odd-looking two subsequent
closing braces at the same indent level.

Closes #19509
2025-11-13 13:46:28 +01:00
Stefan Eissing
cb2bcb681f
lib: eliminate size_t casts
Add new functions in `curlx/warnless.h` for controlled type
conversions:

* curlx_uitouz, convert unsigned into to size_t (should always work)
* curlx_uztoso, convert size_t to curl_off_t, capping at CURL_OFF_T_MAX
* curlx_sztouz, convert ssize_t to size_t, return TRUE when ok
* curlx_sotouz_range, convert curl_off_t to size_t interval, capping
  values to interval bounds

Remove some unnecesary casts, convert some internal recv functions
to the "return result, have size_t* arg" pattern.

Closes #19495
2025-11-13 13:32:19 +01:00
Stefan Eissing
78a610cb83
lib: rename curlx_timediff to curlx_timeleft_ms
Rename `Curl_timeleft()` to `Curl_timeleft_ms()` to make the units in
the returned `timediff_t` clear. (We used to always have ms there, but
with QUIC started to sometimes calc ns as well).

Rename some assigned vars without `_ms` suffix for clarity as well.

Closes #19486
2025-11-13 13:12:58 +01:00
Viktor Szakats
ca27404d27
tests/data: add %includetext, dedupe XML payloads into external file
To reduce duplication and to avoid keeping XML-like markup within XML
markup (`test*`), that was tripping `xmllint`.

Ref: #19470

Closes #19504
2025-11-13 12:24:50 +01:00