Commit Graph

35528 Commits

Author SHA1 Message Date
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
Viktor Szakats
11c211c33c
build: sync curlx build variables and script
Between src and tests, both in autotools and cmake.

Closes #17675
2025-06-19 20:56:20 +02:00
Viktor Szakats
614febca51
lib530, 582: smoothen out minor differences
Fix indentation, casts, a few other minor difference between these tests
that share a common codebase.

Closes #17649
2025-06-19 20:53:30 +02:00
Viktor Szakats
171b623759
cmake: build stubgss library for libtests to match autotools
Used by test 2056 and 2057, in a way that's Linux- & autotools-specific.
This patch builds it for all Unix, syncing cmake with autotools.

Adapt the two tests to find the library in CMake builds as well.

Tested OK on Linux. (CI does not test this. The corresponding jobs build
in debug mode, while the `LD_PRELOAD` feature is locked to non-debug.)

On macOS it didn't load without building everything for aarch64e arch:
"../bld/tests/libtest/libstubgss.dylib' (mach-o file, but is
an incompatible architecture (have 'arm64', need 'arm64e'))"
With that fixed it still did not load correctly and/or the tests did not
pass. So, for macOS these tests remain disabled.

Also:
- GHA/macos: build for aarch64e. (recognized by Apple clang as of this
  patch. llvm and gcc fall back to aarch64.)

Follow-up to 56d949d31a #1687

Closes #17653
2025-06-19 20:41:54 +02:00
Bernhard M. Wiedemann
879b6075a1
test1596: let test pass after year 2036
Background:
As part of my work on reproducible builds for openSUSE, I check that
software still gives identical build results in the future. The usual
offset is +16 years, because that is how long I expect some software
will be used in some places. This showed up failing tests in our package
build. See https://reproducible-builds.org/ for why this matters.

I tested that it passes on x86_64 in year 2041 and i586 in year 2037.

(but on i586, I got `TESTFAIL: These test cases failed: 31 46 61 1415`)

Closes #17665
2025-06-19 19:50:09 +02:00
bch
9edd968792
easy: fix comment-documentation
-> easy_perform() is the INTERNAL interface that performs a blocking[...]

Closes #17664
2025-06-19 19:50:09 +02:00
Viktor Szakats
0042770157
warnless: drop parts of the read/write preprocessor hack (Windows)
The `#undef` hack is no longer necessary after changing the redifitions
to not map back to the original symbols.

This makes it unnecessary to repeat the redefinitions after compiling
`warnless.c` itself (in unity mode).

Which in turns makes it unnecessary to include `warnless.h` again, to
trigger such redefinition.

This also means that `read`/`write` are now redefined on Windows from
the first inclusion of `warnless.h`.

Also:
- tests/server: drop a repeat `warnless.h` include, that is unnecessary
  after this patch.
- tests/unit: drop repeat `warnless.h` include.
- tests/libtest: drop repeat `warnless.h` includes.
- tests/libtest: formatting.

Follow-up to 2f312a14da #17619
Follow-up to 84338c4de2 #12331
Follow-up to 6239146e93

Closes #17673
2025-06-19 17:09:43 +02:00
Viktor Szakats
6c1a7541fb
tftpd: use CURLMIN() macro
Closes #17674
2025-06-19 15:57:37 +02:00
Viktor Szakats
916f241f2f
lib: make CURLX_SET_BINMODE() and use it
Use it from libtests' `first.c` and thus also from units, and tunits.

Also:
- cmake: drop stray `curltool` lib dependency for units.
- units: stop depending on `src` headers.
- tests/server: drop depending on `src` headers.
  (the remaining one listed in the comments, `tool_xattr.h`, was not
  actually used from servers.)
- tests/server: drop duplicate curlx headers.
  (Except `warnless.h`, which is tricky on Windows.)

Closes #17672
2025-06-19 15:57:37 +02:00
Viktor Szakats
35d0c047ce
lib: make curlx_wait_ms() and use it
Move function to curlx/, change all callers.

Also:
- src: replace local implementation.
- tests/client: replace local ad-hoc sleep code.
- tests/libtest: replace local `wait_ms()` implementation.
- lib1531: replace local ad-hoc sleep code.
- tests/server: replace local, simplified copy.
- tests/server: formatting, drop some unused headers.

Closes #17641
2025-06-19 15:57:37 +02:00
Viktor Szakats
9fc05357ef
tests/server: make all global vars/funcs static
Also merge `util.h` into `util.c`.

Closes #17671
2025-06-19 13:28:45 +02:00
Viktor Szakats
8e47c8a764
build: tidy up header paths, use srcdir where possible
To improve readability.

Also add more comments on why each is necessary.

Closes #17630
2025-06-19 13:27:17 +02:00
Viktor Szakats
548873921c
cmake: use target_link_options() when available
To pass `-municode` to the linker. Before this patch we passed this via
`target_link_libraries()` which is designed to pass libraries. Keep
using it for old CMake versions, where no better alternative existed.

https://cmake.org/cmake/help/latest/command/target_link_options.html

Also:
- also pass `-municode` as `PRIVATE` for old cmake versions.
  (it should not make a difference because no target depends on the curl
  tool, but this seem to be the modern, non-ambiguous syntax.)
- unfold a bunch of split lines for greppability of `add_library()` and
  `add_executable()` commands.
- quote a string.

Closes #17670
2025-06-19 13:02:37 +02:00
Viktor Szakats
69642330a3
cmake: sync target_link_libraries() order in tests more
Closes #17669
2025-06-19 12:14:55 +02:00
Viktor Szakats
6ef7696d12
tests/client: drop autotools logic no longer necessary
Not necessary now that test clients #include `curl_setup.h`.

Follow-up to 539d11297d #17642

Closes #17668
2025-06-19 11:46:12 +02:00
Viktor Szakats
d9b89d4fa9
cmake: sync tests scripts by using the variable BUNDLE
To reduce the diff between tests CMakeFiles.txt, and syncing with
autotools, which already used the `BUNDLE` variable like this.

Also:
- fold lines that went over 132 chars after this change.
- autotools: sync order of macros with cmake.

Closes #17667
2025-06-19 11:27:02 +02:00
Viktor Szakats
ea782134e5
autotools: simplify configuration in tests, examples
- GHA/windows: make a mingw autotools build static only.
- GHA/windows: fix a CI script issue with the build above.
- src: fix to pass `LIBCURL_PC_LIBS_PRIVATE` instead of `LINKFLAGS`.
  This makes the libs propagate to tunits, making the local hack there
  unnecessary. `LINKFLAGS` had this single use in the repo, and it was
  empty in local tests.
- tests: drop passing redundant `LIBCURL_PC_LDFLAGS_PRIVATE`.
- tests: drop redundant target name from config variables.
- examples, tests/client: drop `LIBDIR` temp variables with single uses.
- examples, tests: formatting to sync `Makefile.am` scripts with each
  other.

Closes #17661
2025-06-19 09:06:56 +02:00
Viktor Szakats
af309fb17b
tests/client: use curl_mfprintf()
Replacing `fprintf()`. `curl_mfprintf()` is a public libcurl API.

Following the same change made for libtests.

Follow-up to 255aac56f9 #17253

Closes #17651
2025-06-19 09:06:55 +02:00
Viktor Szakats
a4a13c96ca
build: sync build scripts between client/libtest
Closes #17660
2025-06-18 11:33:54 +02:00
Viktor Szakats
eb01ac3fc8
cmake: move OUTPUT argument in the add_custom_command() line
For greppability.

Closes #17658
2025-06-18 10:17:04 +02:00
Viktor Szakats
a282d89a8a
cmake: drop redundant macro from test clients
Not necessary now that test clients #include `curl_setup.h`.

Follow-up to 539d11297d #17642

Closes #17657
2025-06-18 10:17:04 +02:00
Viktor Szakats
9e3492690b
cmake: drop passing redundant CURL_STATICLIB in examples and clients
It's set implicitly via libcurl.

Closes #17655
2025-06-17 20:57:23 +02:00