Commit graph

38921 commits

Author SHA1 Message Date
Daniel Stenberg
a6971ce90a
connect: turn conn_get_first_origin into static
This function is only used within this source file.

Closes #21948
2026-06-10 22:58:42 +02:00
Viktor Szakats
97aed9c960
tidy-up: drop stray comparisons with literal zero
Drop from:
- strcmp, strcmpi, strncmp, memcmp, lstat, getrlimit, setrlimit, fseek,
  fstat
- autotools detection snippets.
- smooth-gtk-thread: simplify `!var != 0` expression.

Closes #21947
2026-06-10 15:15:54 +02:00
Viktor Szakats
2f3fa479dd
build: enable -Wformat-signedness, fix issues found
Adjust code to avoid `-Wformat-signedness` warnings, while making sure
that enums are always cast to a known type when passing them to `printf`
functions, to support compilers and compiler settings where enums are
not default-size signed ints.

- cast integers printed as hex to `unsigned`. (63 times, 20 of them in
  `mbedtls.c`)
- cast misc enums to `int` for printing. (31 times)
- cast `CURL_LOCK_DATA_*` enums to `int`. (4 times)
- cast `CURL_FORMADD_*` enums to `int`. (13 times)
- cast `CURLSHE_*` enums to `int`. (3 times)
- cast `CURLUE_*` enums to `int`. (33 times)
- cast `CURLMSG_*` enums to `int`. (6 times)
- cast `CURLE_*` enums to `int`. (~380 times)
- unit1675: fix mask.
  Follow-up to 7c34365cce #21879

Ref: #18343 (initial attempt)

Closes #20848
2026-06-10 15:14:08 +02:00
Daniel Stenberg
ae2986cdf0
mqtt: return error on truncated Remaining Length
Pointed out by: Zeropath

Closes #21949
2026-06-10 14:40:35 +02:00
renovate[bot]
a6cece52e4
GHA: update awslabs/aws-lc from v1.73.0 to v5.0.0
Closes #21941
2026-06-10 13:38:42 +02:00
renovate[bot]
f5cf5088ef
GHA: update ruff from v0.15.12 to v0.15.16
Closes #21940
2026-06-10 13:38:42 +02:00
Stefan Eissing
f924489b25
ngtcp2: share common functionality
Share common functions/structs between ngtcp2 HTTP/3 and the proxy
version.

Fix bugs in proxy implementation when it comes to stream and pollset
handling and transfer lifetimes.

Curl_multi_xfer_sockbuf_borrow: work without multi

When a connection gets shutdown by a share, the easy handle used is
share->admin and it does not have a multi handle. In that case let
Curl_multi_xfer_sockbuf_borrow() allocate a buffer to be freed on
release.

This happens when a TLS filter sends its last notify through a HTTP/3
proxy tunnel.

Closes #21871
2026-06-10 13:28:05 +02:00
Daniel Stenberg
4fcf9c8f59
test 527: bring back, not a dupe
Fixed the name to clarify the difference to 526.

Follow-up to 4ead4285a6
Closes #21942
2026-06-10 13:26:50 +02:00
Daniel Stenberg
5c6b488035
digest: flush state on origin or credential change
Verified by test 1686

Closes #21944
2026-06-10 13:20:03 +02:00
Daniel Stenberg
3f1055303e
tests: restore 1030 and 611
They were not exact duplicates. Tweaked their names to clarify.

Also renamed 608 accordingly.

Follow-up to 4ead4285a6

Spotted-by: Dan Fandrich
Closes #21938
2026-06-10 08:06:36 +02:00
Viktor Szakats
81cdf4d8e5
appveyor: bump 3 VS2022 jobs to VS2026
Also:
- install CMake 4.2.1 manually for VS2026 jobs, because the preinstalled
  version (4.1.2) does not yet support the compatible generator.
- VisualStudioSolution VS2010 job to VS2015 worker image (from VS2013).
  VS2013 is no longer listed on the AppVeyor support page.
- downgrade OpenSSL to 3.5 (from 3.6) for the VS2022 job, to add
  variation.

Note: the jobs run much slower after bumping to VS2026. This seems to be
due slower configure and build steps.

Refs:
9ef4152eda
https://github.com/appveyor/website/pull/912
fa7f7b928e
https://github.com/appveyor/build-images/pull/175
https://www.appveyor.com/docs/windows-images-software/
https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2018%202026.html

Closes #21939
2026-06-09 21:16:54 +02:00
Viktor Szakats
2864e99543
smbserver: update internal id generation for Python 3
Also:
- make next id based on highest in list + 1.
  (was: last id in list + 1)
- unfold a line.

Spotted by GitHub Code Quality

Ref: https://portingguide.readthedocs.io/en/latest/dicts.html?highlight=keys

Closes #21937
2026-06-09 18:06:32 +02:00
Daniel Stenberg
ce53f90f20
RELEASE-NOTES: synced 2026-06-09 16:58:21 +02:00
A Johnston
084ceb6601
hsts: duplicate live HSTS data in curl_easy_duphandle
Verified by test 1922

Closes #21809
2026-06-09 16:51:47 +02:00
Daniel Stenberg
4ead4285a6
tests: enhance names, remove duplicates
- test 1030: remove, duplicate of 154
- test 1105: make name unique
- test 161: make name reflect what it tests
- test 2074: correct the name
- test 310: improve name
- test 358: correct the name
- test 409: removed, duplicate of 401
- test 472: clarify the test name (how it differs from 439)
- test 1509: update name
- test 527: duplicate of 526
- test 758: separate the name from 530
- test 611: duplicate of 608, remove
- test 639: adjust the name
- test 688: minor name tweak to clarify
- test 708: enhance name
- test 800/847: clarify the names
- test 1520: dedupe the name
- test 962: enhance name
- test 1196/2203: enhanced names
- test 1211: name tweak
- test 1256/1257: enhance the names
- test 1483: fix name
- test 1541: fix name
- test 1553: fix name
- test 1609: removed, exact duplicate of 1607
- test 2200: fix name
- test 3031: corret the name
- test 3016/3203: fix names and keywords
- test 3201/3220: enhance names
- test 3212: fix name
- add missing FILE keywords
- drop FAILURE as keyword

Closes #21936
2026-06-09 16:44:04 +02:00
Viktor Szakats
014be82a66
tidy-up: drop redundant == NULL syntax
Where missed by checksrc.

Closes #21935
2026-06-09 14:37:36 +02:00
Viktor Szakats
59213abfb2
tidy-up: drop redundant != NULL syntax
Where missed by checksrc.

Closes #21932
2026-06-09 14:37:36 +02:00
renovate[bot]
d8c97b021b
GHA: update dependency openssl/openssl to v4.0.1
Closes #21934
2026-06-09 14:34:57 +02:00
Viktor Szakats
e37417e021
psl: require libpsl 0.16.0 (2016-12-10) or greater
Debian Stretch offers 0.17.0.

Ref: https://github.com/rockdaboot/libpsl/releases/tag/libpsl-0.16.0
Ref: https://sources.debian.org/src/libpsl/

Closes #21933
2026-06-09 14:34:57 +02:00
alhudz
62b118cf22
http-proxy: verify CONNECT response headers
Verifed by test 2107

Closes #21927
2026-06-09 13:56:28 +02:00
Daniel Stenberg
c7cba2fd2d
sigv4: URL encode the user name in the header
- split into sub functions
- add 'aws-sigv4' as keyword for many tests

Verify with test 3222

Reported-by: Trail of Bits
Closes #21923
2026-06-09 13:34:27 +02:00
Viktor Szakats
cb4b3e75e8
smbserver: check impacket presence differently
To silence ruff and GitHub CodeQL warnings.

Closes #21929
2026-06-09 13:24:09 +02:00
Viktor Szakats
056dcd9e71
pytest: use Optional[], adjust whitespace
Reported by GitHub Code Quality

Closes #21928
2026-06-09 13:24:09 +02:00
Viktor Szakats
847aac066d
tidy-up: use uppercase TRUE/FALSE where missing
Keep it only in external API calls and C++ code.

Also:
- curlx/fopen: replace with `!!`.

Spotted by GitHub Code Quality in cf-socket.c.

Closes #21925
2026-06-09 12:52:08 +02:00
Viktor Szakats
9dcc57b801
pytest: add comment to empty except branch
To silence GitHub CodeQL.

Follow-up to 4aa8cc3c4a #21924
2026-06-09 12:33:46 +02:00
Viktor Szakats
bbb226b226
unit1675: fix potential memory leak on dynbuf fail path
Spotted by GitHub Code Quality

Closes #21922
2026-06-09 12:30:16 +02:00
Viktor Szakats
4aa8cc3c4a
pytest: fix remaining code checker warnings
- curl.py: delete commented no-op code.
- certs.py, curl.py: narrow down exceptions to fix:
  Except block handles 'BaseException'
- test_20_websockets: add comment to empty except branch.

Reported by GitHub CodeQL

Closes #21924
2026-06-09 12:30:16 +02:00
Yedaya Katsman
feb609f28b
cf-socket: store errno from do_connect in ctx->error
This fixes a misleading log in verbose mode when ipv6 connectivity isn't
available, presumably also in other cases:

```
* Immediate connect fail for 2a00:1450:4028:806::200e: Network is unreachable
* connect to 2a00:1450:4028:806::200e port 443 from :: port 0 failed: Success
```

Closes #21914
2026-06-09 11:12:14 +02:00
Daniel Stenberg
e66b81a532
cookie: tailmatch the domains for secure override
If a SECURE cookie is set for a sub-domain (`example.com`) and is then
attempted to get set again for more specific part of that domain
(`www.example.com`) without the SECURE property, the second occurance
should not be allowed.

Reported-by: Trail of Bits

Verified by test 3305
Closes #21910
2026-06-09 11:11:07 +02:00
Viktor Szakats
952b04474c
tidy-up: miscellaneous
- badwords: replace stray synonyms with 'null-terminator'.
- tests/FILEFORMAT.md: tidy up feature descriptions.
- printf: replace stray `%i` masks with `%d` for consistency.
- pytest: add comments for empty excepts to try silencing GitHub CodeQL
  warnings.
- tool1394, unit1675: merge nested `if`s.
- dnscache: fix typo in comment.
- fix whitespace, indent and newlines.

Closes #21921
2026-06-09 11:07:55 +02:00
Stefan Eissing
849317ff5c
ws: make pong sending lazy
Do not send PONG frames unless there is sufficient space left in the
websocket send buffer. A server might be lazy in reading our data and
intermediary PONG frames can be skipped by a client (RFC 6455, ch.
5.5.3).

Add test case measuring no real RSS increase on a server blasting with
PING frames.

Closes #21911
2026-06-09 11:05:34 +02:00
Daniel Stenberg
fb9a520873
peer.h: fix typo in comment
Closes #21920
2026-06-09 11:00:01 +02:00
Viktor Szakats
b9b2c0cbb8
docs: returned header size reflects HTTP/1-style format
Ref: #21889

Closes #21912
2026-06-09 10:24:07 +02:00
Viktor Szakats
cb4465bfe6
pytest: close file handles after use (cont.), and tidy-ups
- dante.py, dnsd.py, sshd.py: drop redundant conditions.
  Spotted in sshd by GitHub Code Quality.
- curl.py: comment out `if` to silence CodeQL warning.

Reported by GitHub CodeQL

Follow-up to 8145476d5d #21916

Closes #21917
2026-06-09 10:24:07 +02:00
Yedaya Katsman
7b9d74abf6
resolve: Mention in error that IP address is expected
If you try using a DNS name like connect-to supports it can be confusing that
it is illegal. Also make it a bit more readable

Closes #21913
2026-06-09 09:23:52 +02:00
Daniel Stenberg
a2b943b115
digest: escape control codes too
Since the username is decoded when used and control codes are accepted
in HTTP usernames in general, the username encoding for the Digest auth
needs to percent encode such bytes.

Verified by test 3221

Reported-by: Trail of Bits
Closes #21915
2026-06-09 09:20:47 +02:00
Daniel Stenberg
04afd16076
urlapi: URL decode hostname before IP address normalization
With this, IPv6 addresses that end with '%25' with no following zone id are
considered invalid.

Extend test 1560 to verify

Reported-by: Hem Parekh
Closes #21918
2026-06-09 08:42:19 +02:00
Viktor Szakats
8145476d5d
pytest: close file handles after use, and two minor tidy-ups
Also:
- drop two unreachable return statements.
- test_17_ssl_use: avoid implicit string concatenations in lists.

Reported by GitHub CodeQL

Closes #21916
2026-06-09 02:05:21 +02:00
Viktor Szakats
2dfd265d66
checksrc-all.pl: do not check files multiple times
Restrict `git ls-files` to return `*.[ch]` files within `$dir` only.
Before this patch it returned files in subdirectories too, which did
double work and may have made `checksrc.pl` pick `.checksrc` from the
first such subdirectory, masking the one in `$dir`. (current curl tree
is not affected)

Ref: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec

Follow-up to 33f606cd51 #20439

Closes #21909
2026-06-08 14:59:47 +02:00
alhudz
7de0a7e71a
chunked: reject invalid bytes in trailer
Trailers are delivered to the application as headers via
CLIENTWRITE_TRAILER, but unlike regular response headers they skipped
the verify_header() checks, so a server could smuggle a nul byte (or
stray CR) into a header reaching CURLOPT_HEADERFUNCTION and
curl_easy_header().

Run each assembled trailer line through Curl_verify_header(), the same
validation used for normal headers.

Covered by the new test 2106.

Closes #21896
2026-06-08 13:56:10 +02:00
Stefan Eissing
d69bfad3fa
ssl native_ca_store: always reinit
Add bit `native_ca_store_opt` to keep the setting of
CURLOPT_(PROXY_)SSL_OPTIONS and use that to calculate every easy
transfer if a native CA store shall be used or not.

This avoids `native_ca_store` getting stuck on TRUE after being set
once.

Closes #21902
2026-06-08 13:53:54 +02:00
Stefan Eissing
435fb96dcf
netrc: remember and check filename loaded
Remember the filename of a loaded netrc file to detect changed
configurations in a reused easy handle.

Closes #21903
2026-06-08 13:53:02 +02:00
Daniel Stenberg
e786a4e915
CURLOPT_DOH_URL.md: does not inherit proxy options
Closes #21904
2026-06-08 13:30:39 +02:00
Daniel Stenberg
ff7086874e
_ENVIRONMENT.md. Windows does case insensitive env variables
Closes #21907
2026-06-08 13:29:47 +02:00
renovate[bot]
a89fd1ffd4
GHA: update dependency pizlonator/fil-c to v0.679
Closes #21897
2026-06-08 13:29:09 +02:00
Viktor Szakats
cdce2460b3
runtests: allow skipping tests on torture, use for test 357
Some tests may take a long time in torture mode. Make it possible
to skip individual tests when runtests in running in torture mode.

Also:
- skip test 357 for the reason above.
  Saved 1-3 minutes for the Linux CI torture job, 1-1.5m on Windows.
  No savings on macOS.

Reported-by: Stefan Eissing
Fixes #21873

Closes #21906
2026-06-08 13:26:31 +02:00
Viktor Szakats
39d5cead0d
libssh2: save non-standard port to known_hosts
Reported-by: dyingc on github
Fixes #21863

Closes #21874
2026-06-08 13:26:31 +02:00
Daniel Stenberg
5df33efab4
setopt: claer the "custom" CA booleans when set to NULL
Mark them as custom choices only when pointer is passed, and clear them
again when set to NULL.

Closes #21901
2026-06-08 12:37:35 +02:00
Daniel Stenberg
9b69cfb937
var: use a dedicated pointer for the alloc
As the 'c' pointer might actually get modified before it is time to free
the memory.

Verify in test 2310

Reported-by: Eunsoo Kim
Fixes #21898
Closes #21900
2026-06-08 09:37:06 +02:00
Daniel Stenberg
0618ffe50d
Revert "url: remove ssh_config_matches"
This reverts commit 3e9817cd1b.

The change was incorrect as the check was not for the options the commit
message mentions.

Reported-by: ByteRay on hackerone
Closes #21899
2026-06-08 09:09:58 +02:00