Commit Graph

35949 Commits

Author SHA1 Message Date
NINIKA
05382f3e78
asyn-ares: remove redundant NULL check
Closes #17720
2025-06-23 16:34:43 +02:00
Viktor Szakats
2636828eee
tests: drop unused or redundant includes
Closes #17717
2025-06-23 13:49:03 +02:00
Daniel Stenberg
36a3cd5374
RELEASE-NOTES: synced 2025-06-23 13:41:12 +02:00
Stefan Eissing
c7a6319698
multi: clear the dirty set of transfers no longer processing
When a transfer is no longer processed, it might still apear in the
dirty bitset. Clear the dirty bit when this condition is encountered.

Closes #17718
2025-06-23 13:36:33 +02:00
Viktor Szakats
6425ce47df
tests/libtest: use curltime from curlx
Replacing the local implementation.

Closes #17716
2025-06-23 11:29:41 +02:00
Viktor Szakats
a2de3f08e3
tests/libtest: call curlx_now_init() for unit 1399, 2600 (Windows)
Follow-up to 35d0c047ce #17641

Closes #17714
2025-06-23 10:55:31 +02:00
Daniel Stenberg
aed828cc51
tests/dnsd: read config from file
Make the <dns> tag in a test case control what is stored there. Also
documented. Make test 2102 and 2103 use the new tag.

Lets the test case config the A and AAAA contents the server replies
with. Initial work for the HTTPS RR exists, but does not yet work.

Closes #17543
2025-06-23 08:24:09 +02:00
Daniel Stenberg
2cdc02f49f
libcurl-env.md: drop LOGNAME, USER and NTLMUSER
They were used for NTLM-WB, which support was removed for back in 8.8.0

Closes #17713
2025-06-23 08:21:05 +02:00
Viktor Szakats
85bf8b19ac
cmake: sync tests scripts with each other and autotools (more)
Closes #17711
2025-06-22 23:42:14 +02:00
Viktor Szakats
e088e10454
cmake: replace the way clang-tidy verifies tests, fix issues found
Replace existing `mk-unity.pl` `--embed` workaround with running
`clang-tidy` manually on individual test source instead. This aligns
with how clang-tidy works and removes `mk-unity.pl` from the solution.

Also:
- mqttd: fix potentially uninitialized buffer by zero filling it.
  ```
  tests/server/mqttd.c:484:41: error: The left operand of '<<' is a garbage value
    [clang-analyzer-core.UndefinedBinaryOperatorResult,-warnings-as-errors]
    484 |       payload_len = (size_t)(buffer[10] << 8) | buffer[11];
        |                                         ^
  [...]
  tests/server/mqttd.c:606:45: error: The left operand of '<<' is a garbage value
    [clang-analyzer-core.UndefinedBinaryOperatorResult,-warnings-as-errors]
    606 |       topiclen = (size_t)(buffer[1 + bytes] << 8) | buffer[2 + bytes];
        |                                             ^
  ```
- sockfilt: fix potential out-of-bound pointer:
  ```
  tests/server/sockfilt.c:1128:33: error: The 2nd argument to 'send' is a buffer
     with size 17010 but should be a buffer with size equal to or greater than
     the value of the 3rd argument (which is 18446744073709551615)
     [clang-analyzer-unix.StdCLibraryFunctions,-warnings-as-errors]
   1128 |         ssize_t bytes_written = swrite(sockfd, buffer, buffer_len);
        |                                 ^
  ```
- clang-tidy: suppress bogus `bzero()` warnings that happens
  inside the notorious `FD_ZERO()` macros, on macOS.

Ref: https://github.com/curl/curl/pull/17680#issuecomment-2991730158

Closes #17705
2025-06-22 23:08:46 +02:00
Viktor Szakats
9837dd429a
GHA/windows: drop MSYS2 runtime downgrades
No longer necessary after bumping the default runtime to a version
fixing the previously experienced performance drop.

Thanks to MSYS2/Cygwin teams for the help and fix.

Follow-up to 9a26be1e6a #17708
Follow-up to d4896d94f2 #16424

Closes #17710
2025-06-22 23:08:46 +02:00
renovate[bot]
9a26be1e6a
GHA: update msys2/setup-msys2 digest to 40677d3
After:
MINGW64_NT-10.0-20348 runnervmdy573 3.6.3-1f8def9f.x86_64 2025-06-18 07:19 UTC x86_64 Msys

Before:
MINGW64_NT-10.0-20348 runnervmdy573 3.5.7-2644508f.x86_64 2025-02-06 19:32 UTC x86_64 Msys

Closes #17708
2025-06-22 22:43:15 +02:00
Yedaya Katsman
8128a17e71
rustls: don't try printing the not provided file
Caught by gcc (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0:
```
vtls/rustls.c: In function ‘cr_connect’:
vtls/rustls.c:857:61: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
  857 |     failf(data, "rustls: must provide certificate with key '%s'",
      |                                                             ^~
```

Closes #17704
2025-06-22 22:31:11 +02:00
Viktor Szakats
83a8818cfe
h2_serverpush: fix file handle leaks reported by clang-tidy
clang-tidy (20.1.6) found it locally consistently. Missed in CI.

Closes #17706
2025-06-22 21:42:53 +02:00
Viktor Szakats
d1f036c424
cmake: configure c-ares header directory in project root (was: lib)
The c-ares header directory was added to the header path within `lib`,
as opposed to every other dependency which added them in the root
`CMakeLists.txt`. Such exception is no longer necessary. This patch
aligns c-ares header setup with the rest of dependencies. And also with
autotools, which also makes no exception here.

Cherry-picked from #17705
Cherry-picked from #16973

Closes #17707
2025-06-22 21:41:03 +02:00
Viktor Szakats
6a0cd4feb7
tests: make individual test sources compile cleanly
Tidy up headers and includes to ensure all individual test source
compile cleanly (but not link). To allow running clang-tidy (and
possibly other static analyzers) on them. It also improves readability
and allows to verify them locally, without the bundle logic.

clang-tidy ignores #included C files, so it's blind to bundle C files
the include these tests. The current workaround of embedding has
a couple of downsides:. meaningless filenames and line numbers,
missing issues, messing up self header paths. Thus, running it on
individual sources would be beneficial.

Also:
- de-duplicate includes.
- untangle some includes.
- formatting/indentation fixes.
- merge `getpart.h` into `first.h`.

Ref: https://github.com/curl/curl/pull/17680#issuecomment-2991730158

Closes #17703
2025-06-22 15:58:15 +02:00
Viktor Szakats
4d4d09eb7f
cmake: drop reference to future variable [ci skip]
Follow-up to 855acb3bb0 #17701
2025-06-22 13:19:15 +02:00
Viktor Szakats
855ae76513
tests/libtest: drop TEST_HANG_TIMEOUT redefinition hack
Before this patch the code relied on re-initializing `TEST_HANG_TIMEOUT`
macro before compiling each test, to allow them each to override it to
a custom value for single tests. Thie required re-including `test.h`
into each test.

After this patch this macro becomes a global, immutable, default. Tests
which want to override it can now use alternate macros that do accept
a custom timeout. The only test currently affected is lib1501.

Follow-up to 2c27a67daa #17590

Closes #17702
2025-06-22 13:15:13 +02:00
Viktor Szakats
855acb3bb0
cmake: add target property dumper helper function
It's pretty rough and a giant hack, but helps debugging and findind ways
while navigating the CMake maze. I find it sad CMake doesn't have
a built-in function for this that works correctly in all situations.
It's invaluable to be able to see what properties and values an object
has.

It's also possible there is a better solution to this, but I could not
find it.

Cherry-picked from #16973

Closes #17701
2025-06-22 13:15:13 +02:00
Daniel Stenberg
52f58ebb10
curl_get_line: make sure lines end with newline
Verify with test 792 and 793

Reported-by: z2_
Closes #17697
2025-06-22 12:58:53 +02:00
Viktor Szakats
e29f11f2d6
tests/server: drop memdebug.h
It's no longer used in any build configuration.

Follow-up to fffec3d7e9 #17629

Closes #17700
2025-06-22 09:00:53 +02:00
Daniel Stenberg
bbadbd7795
docs: mention that the netrc file works without port numbers
Closes #17698
2025-06-21 23:46:14 +02:00
Daniel Stenberg
64fe36aaa0
tests/server/util.c: include netinet/in6.h
for sockaddr_in6

Reported-by: Randall S. Becker
Bug: https://curl.se/mail/lib-2025-06/0016.html
Closes #17695
2025-06-21 20:04:14 +02:00
Stefan Eissing
70779199f3
cf: replace the method get_host with query
Connection filters had a method `get_host()` which had not really been
documented. Since then, the cf had the `query()` method added. Replace
the separate get_host with query.

Add `CF_QUERY_HOST_PORT` as query to connection filters to retrieve
which remote hostname and port the filter (or its sub-filter) is talking
to. The query is implemented by HTTP and SOCKS filters, all others pass
it through.

Add `Curl_conn_get_current_host()` to retrieve the remote host and port
for a connection. During connect, this will return the host the
connection is talking to right now. Before/After connect, this will
return `conn->host.name`.

This is used by SASL authentication.

Closes #17419
2025-06-21 17:20:44 +02:00
Stefan Eissing
779937f840
multi: add dirty bitset
Add a bitset `dirty` to the multi handle. The presence of a transfer int
he "dirty" set means: this transfer has something to do ASAP.

"dirty" is set by multiplexing protocols like HTTP/2 and 3 when
encountering response data for another transfer than the current one.
"dirty" is set by protocols that want to be called.

Implementation:

* just an additional `uint_bset` in the multi handle
* `Curl_multi_mark_dirty()` to add a transfer to the dirty set.
* `multi_runsingle()` clears the dirty bit of the transfer at
   start. Without new dirty marks, this empties the set after
   al dirty transfers have been run.
* `multi_timeout()` immediately gives the current time and
   timeout_ms == 0 when dirty transfers are present.
* multi_event: marks all transfers tracked for a socket as dirty.
  Then marks all expired transfers as dirty. Then it runs
  all dirty transfers.

With this mechanism:

* Most uses of `EXPIRE_RUN_NOW` are replaced by `Curl_multi_mark_dirty()`
* `Curl_multi_mark_dirty()` is cheaper than querying if a transfer is
  already dirty or set for timeout. There is no need to check, just do it.
* `data->state.select_bits` is eliminated. We need no longer to
  simulate a poll event to make a transfer run.

Closes #17662
2025-06-21 17:19:11 +02:00
Viktor Szakats
7aa8d1eea1
build: tidy up Makefile.inc use in lib and src
- cmake: use `CURL_RCFILES` instead of literal.
- cmake: use `LIB_RCFILES` instead of literal.
- cmake: fix comments.
- autotools: use `CURL_RCFILES` in `EXTRA_DIST`.
- autotools: use `LIB_RCFILES` in `EXTRA_DIST`.
- autotools: fix comments.
- autotools: fix indentation.

Closes #17694
2025-06-21 11:51:01 +02:00
Daniel Stenberg
97a0ce8f89
RELEASE-NOTES: synced 2025-06-21 11:10:05 +02:00
DoI
9a2663322c
curl: implement non-blocking STDIN read on Windows
Implements a seperate read thread for STDIN on Windows when curl is run
with -T/--upload-file .

This uses a similar technique to the nmap/ncat project, spawning a
seperate thread which creates a loop-back bound socket, sending STDIN
into this socket, and reading from the other end of said TCP socket in a
non-blocking way in the rest of curl.

Fixes #17451
Closes #17572
2025-06-21 11:04:29 +02:00
Daniel Stenberg
84b62696d9
top-complexity: lower max allowed complexity threshold to 90
Down from 100. Also make it show all functions with complexity > 65
(down from 70).

Closes #17689
2025-06-21 10:52:15 +02:00
Joel Depooter
e3d9675924
libssh: fix incorrect return value in myssh_in_AUTH_PKEY_INIT
In the unlikely case that no SSH auth methods are supported, the
previous code would return 0 from myssh_in_AUTH_PKEY_INIT. However,
following the code path, it seems like it should be returning SSH_ERROR,
as set in myssh_to_ERROR (through myssh_to_GSSAPI_AUTH,
myssh_to_KEY_AUTH and myssh_to_PASSWD_AUTH).

In actuality, this is unlikely to occur, as the similar code in
myssh_in_AUTHLIST would have already returned an error in this scenario.
However setting a return value and then ignoring it is a bit fishy and
should be documented if this is intended.

I believe this used to return an error, but was changed in the recent
re-factoring of this code.

Closes #17691
2025-06-21 10:51:11 +02:00
Viktor Szakats
7d8fa8276d
tests: drop BUNDLE_SRC variable
Derive it from `$BUNDLE` instead. autotools seems to be already relying
on `$BUNDLE_SRC` being equal to `$BUNDLE.c`. (I haven't realized this
before aaebb45f58b3f62876a68c17c71ac37d98f1b3bb.)

Also drop redundant `nodist_<target>_SOURCE` lines in tunits and units.

Follow-up to aaebb45f58 #17688
Follow-up to 2c27a67daa #17590

Closes #17692
2025-06-21 10:49:05 +02:00
Viktor Szakats
ccb65643b6
cmake: omit clang-tidy on internal libs curlu and curltool
Skip clang-tidy while compiling curlu and curltool internal libraries.
To save about 1 minute per run. These libraries compile the lib and src
sources a second time, with the `UNITTESTS` macro enabled, which makes
tiny difference, for internal use. I figure it's not worth the extra CI
(and local) time because finding extra issues in these passes is
unlikely, and if found, not critical.

autotools also doesn't check curlu and curltool with clang-tidy.

Ref: https://github.com/curl/curl/pull/17680#issuecomment-2991730158
Ref: https://stackoverflow.com/questions/61867616/ignore-certain-files-when-using-clang-tidy
Ref: https://cmake.org/cmake/help/latest/prop_tgt/LANG_CLANG_TIDY.html

Follow-up to fabfa8e402 #15825

Closes #17693
2025-06-21 10:43:32 +02:00
Stefan Eissing
b7c676d13f
vtls: change send/recv signatures of tls backends
Similar to connection filter changes, return a CURLcode and the
read/written amount as size_t *.

Closes #17593
2025-06-21 10:34:02 +02:00
Fabrício Canedo
17f8b1db5c
docs: fix broken link in CODE_REVIEW.md
In CODE_REVIEW.md file, the link that points to CONTRIBUTE was broken,
so I fixed this issue changing the link from only "CONTRIBUTE.md" to
"https://curl.se/dev/contribute.html".

Closes #17656
2025-06-21 10:32:06 +02:00
Fabrício Canedo
612c5a8a2e
docs: fix broken link in INSTALL.md
In INSTALL.md file, the link that points to CURL-DISABLE was broken,
so I fixed this issue changing the link from only "CURL-DISABLE.md" to
"https://github.com/curl/curl/blob/master/docs/CURL-DISABLE.md".

Fixes https://github.com/curl/curl-www/issues/427
Closes #17654
2025-06-21 10:29:49 +02:00
Ethan Alker
73ad54f7b0
docs: fix docs for CURLOPT_PREQUOTE after #17616
Closes #17690
2025-06-21 10:26:41 +02:00
Daniel Stenberg
0d647a8a76
tests: make Makefile.inc files 80 columns
Since all code fits within that, it is more convenient.

Co-authored-by: Viktor Szakats
Follow-up to 2c27a67daa #17590

Closes #17623
2025-06-21 01:31:57 +02:00
renovate[bot]
657e0240f5
GHA: update rojopolis/spellcheck-github-actions digest to 35a02ba
Closes #17686
2025-06-20 23:36:07 +02:00
Daniel Stenberg
3b4e84c44f
ftplistparser: split parse_unix into sub functions
Closes #17608
2025-06-20 23:30:04 +02:00
Stefan Eissing
4a686ee6b0
docs: fix documentation of connect_only 2
Setting CURLOPT_CONNECT_ONLY with value 2 is only defined
for WebSocket and the effect on other protocols is undetermined.
That includes the HTTP urls.

Fixes #17621
Reported-by: Kirill Obukhov
Closes #17635
2025-06-20 23:24:37 +02:00
Bartosz Ruszczak
fdf50d64b8
ftp: fix prequotes for a directory in URL
Allow prequotes to be sent after curl has changed the working directory,
just before the listing command if the URL is a directory.

FTP state machine is updated with the new FTP_LIST_PREQUOTE state and
FTP_RETR_LIST_TYPE type.

Test 754 verifies

Fixes #8602
Closes #17616
2025-06-20 23:22:24 +02:00
Daniel Stenberg
149d436457
test1599: verify a bad FTP password with no user
Verifies the fix from #17659

Closes #17687
2025-06-20 23:14:14 +02:00
z2_
f9548bf20e
url: fix NULL deref with bad password when no user is provided
Closes #17659
2025-06-20 23:13:49 +02:00
Daniel Stenberg
aaebb45f58
tests: drop useless "nodist_SOURCES" assignments
They cause automake warnings and have no effect.

Closes #17688
2025-06-20 23:12:51 +02:00
Stefan Eissing
0d70dfb79b
xfer: manage pause bits
Concentrate the handling of KEEP_RECV_PAUSE and KEEP_SEND_PAUSE into
common transfer functions. Setting or clearing these bits requires
subsequent actions involving connection events and client reader/writer
notifications. Have it in one place.

Closes #17650
2025-06-20 22:59:08 +02:00
Daniel Stenberg
e60103cbb8
http: explicitly ignore parsing errors for Retry-After
Add (void) and explain in comment.

Closes #17682
2025-06-20 21:54:27 +02:00
Daniel Stenberg
b2eb444922
RELEASE-NOTES: synced 2025-06-20 13:08:55 +02:00
Stefan Eissing
63381421f5
connection: eliminate member remote_addr
Used to be a pointer set (and cleared) by the socket connection filters
to a struct in their contexts. Instead, add a filter query method to
obtain the pointer when needed.

Closes #17385
2025-06-20 12:54:36 +02:00
Viktor Szakats
8d270732b6
autotools: drop $top_builddir/src from src header path
There is no generated header or source in `$top_builddir/src`, that src
would #include. Also syncing with cmake.

Closes #17679
2025-06-20 10:15:59 +02:00
Viktor Szakats
726e7bba4c
cmake: simplify handling generated lib1521.c in libtests
Also unfold line and sync with other tests.

Closes #17676
2025-06-20 08:59:01 +02:00