Commit Graph

33130 Commits

Author SHA1 Message Date
Daniel Stenberg
c280010d8b
managen: fix superfluous leading blank line in quoted sections
When a markdown quoted section using 4-space indentation was converted
to nroff, managen previously caused a newline to appear after the
leading .nf. This fix makes sure that newline is inserted *before* .nf
as intended.

This is perhaps most notable in the HTML version of rendered manpages if
the quoted sections use different colors or similar.

Closes #14732
2024-08-30 00:21:22 +02:00
Daniel Stenberg
430af3fb59
dump-ca-embed.md: set as "boolean", not "single"
Because it is. And it makes the template manpage explanation for it make
sense.

Follow-up to 8a3740bc8e

Closes #14731
2024-08-30 00:12:36 +02:00
Daniel Stenberg
946c96aa0a
docs/cmdline-opts/_VARIABLES: language polish
Closes #14730
2024-08-29 21:20:35 +02:00
Daniel Stenberg
3cf45fedc4
runtests: remove "has_textaware"
All sections defined with the mode="text" attribute now get line endings
normalized so that comparisons become line ending agnostic. Removes the
previous problem of figuring out how exactly different Windows
environments should be treated in this regard.

Closes #14717
2024-08-29 20:24:40 +02:00
Daniel Stenberg
eeb7c12807
ftp: always offer line end conversions
Previously this functionality was limited to platforms that not already
use CRLF as native line endings.

TODO: 4.5 ASCII support now considered fixed

Closes #14717
2024-08-29 20:24:37 +02:00
Daniel Stenberg
4becbb4af7
test1050: mark as FTP 2024-08-29 20:24:37 +02:00
Daniel Stenberg
55672d0aa3
test476: test ASCII FTP upload where file already uses CRLF
Closes #14717
2024-08-29 20:24:34 +02:00
Daniel Stenberg
ee17f35d43
test475: verify a 72K ASCII FTP upload
Extended the test format and runtest.pl so that the verify/upload part
can be marked using crlf newlines even when the client/file does not
have it.

Closes #14717
2024-08-29 20:24:23 +02:00
Viktor Szakats
cc8b813765
build: drop unused feature-detection code for Apple poll()
Drop Apple-specific detection logic for `poll()`. This detection snippet
has been disabled for Apple in both configure and cmake, for `poll()`
being broken on Apple since 10.12 Sierra (2016).

Also replace `exit(1);` with `return 1;` in configure, to make the
snippets match.

Added in 9297ca49f5 #1057 (2016-10-11).

Disabled for:
configure/darwin in a34c7ce754 (2016-10-18)
cmake/macOS in 825911be58 #7619
cmake/iOS in d14831233d #8244
cmake/all Apple in a86254b393 #12515

Closes #14718
2024-08-29 17:54:53 +02:00
renovate[bot]
7c49279aaa
GHA: update github/codeql-action digest to 4dd1613
Closes #14725
2024-08-29 16:53:23 +02:00
Stefan Eissing
4abf2b9699
openssl quic: fix memory leak
When a OpenSSL quic connection filter is aborted early, as the
server was not responding, the ssl instances where not closed
as they should.

Fixes #14720
Reported-by: ralfjunker on github
Closes #14724
2024-08-29 16:48:49 +02:00
Stefan Eissing
6354b35dfe
gnutls: send all data
Turns out `gnutls_record_send()` does really what the name says: it
sends exactly one TLS record. If more than 16k are there to send, it
needs to be called again with new buffer offset and length.

Continue sending record until the input is all sent or a EAGAIN (or
fatal error) is returned by gnutls.

Closes #14722
2024-08-29 16:46:56 +02:00
Stefan Eissing
44d1b6c271
pytest: add ftp upload ascii test
Add a test the uploads a text file in ascii mode and checks
that lengths match expectations.

Closes #14721
2024-08-29 16:45:59 +02:00
Stefan Eissing
64ab0ace27
urldata: remove crlf_conversions counter
Since the introduction of client writers, we check the body length in
the PROTOCOL phase and do FTP lineend conversions laster in the
CONTENT_DECODING phase. This means we no longer need to count the
conversions for length checks.

Closes #14709
2024-08-29 14:30:58 +02:00
Viktor Szakats
1b0568539d
cmake: fix internal variable names in Rustls detection
Follow-up to ed76a23fcc #14534

Closes #14719
2024-08-29 13:56:05 +02:00
Viktor Szakats
5b87b4edf9
test1013.pl: require case match for features, order match for protos, fix issue
Update the script for test 1013 and 1014 to require:

- case-sensitive match for the curl feature list.
  (Continue to allow case-difference for protocols. They've always been
  in uppercase within curl config.)

- matching order for the protocol list.
  (Continue to allow any order for features. autotools builds on
  platforms without `sort -f` need it. E.g. Old Linux CI)

Also:

- fix casing of the `gsasl` feature in `configure`, to match `curl -V`
  and cmake.

- delete obsolete comment.

Closes #14706
2024-08-29 13:56:05 +02:00
Viktor Szakats
a5682d9cb9
GHA/windows: vcpkg GnuTLS started breaking CI, temp drop it
Starting today vcpkg wants to rebuild GnuTLS but fails:
```
error: building shiftmedia-libgnutls:x64-windows failed with: BUILD_FAILED
```
Ref: https://github.com/curl/curl/actions/runs/10594890318/job/29359499149#step:5:144

Temporary solution:
- drop it from the MultiSSL job.
- replace with mbedTLS job. This job still tests libssh and I could
  not find a better place for it right away.

GnuTLS to be restored once it builds again. Possibly when this hash
reaches the GHA `windows-latest` runner:
f5ec6f30ff

Also:
- switch to Debug for the mbedTLS job. Should also work now with
  GnuTLS, once it's back:
  Ref: https://github.com/microsoft/vcpkg/pull/40473

Closes #14710
2024-08-28 17:51:25 +02:00
Daniel Stenberg
09cdcac8d8
RELEASE-NOTES: synced 2024-08-28 14:09:12 +02:00
Stefan Eissing
4c744c3ee2
tests/http: add HTTP/2 Upgrade and prior knowledge tests
Adds test cases to check that plain http: with HTTP/2 works
via 'Upgrade: h2c' or --http2-prior-knowledge'.

Also added tests to check connection reused in these situations.

Closes #14694
2024-08-28 14:04:11 +02:00
Stefan Eissing
9280bbea3f
urldata: remove proxy_connect_closed bit
The connections 'proxy_connect_closed' bit was not used any more. Remove
it.

Closes #14708
2024-08-28 14:00:42 +02:00
Stefan Eissing
80f9fce56d
cookie: add more debug tracing to set-cookie handling
Might help us see why test977 fails occasionally.

Closes #14705
2024-08-28 13:59:33 +02:00
Stefan Eissing
ea6f5c9f0f
connect: limit update IP info
Update IP related information at the connection and the transfer in two
places only: once the filter chain connects and when a transfer is added
to a connection. The latter only updates on reuse when the filters
already are connected.

The only user of that information before a full connect is the HAProxy
filter. Add cfilter CF_QUERY_IP_INFO query to let it find the
information from the filters "below".

This solves two issues with the previous version:
- updates where often done twice with the same info
- happy eyeballing filter "forks" could overwrite each others
  updates before the full winner was determined.

Closes #14699
2024-08-28 13:58:10 +02:00
mbuhl
87f0a79439
HTTP3.md: cleanup markup and language
Closes #14698
2024-08-28 13:56:40 +02:00
Stefan Eissing
0ae3fadb7c
pytest: tweak counts
Lower some iteration counts for tests where they do not seem to add
value. Raise speed limits somewhat to shave off a second or two.

Closes #14689
2024-08-28 13:55:23 +02:00
Stefan Eissing
29610e5f3d
transfer: skip EOS read when download done
When we downloaded all we wanted, and we did not want a response body,
and no Trailer: has been announced, and the receive gives EAGAIN, do not
hang around unnecessarily.

Some servers are buggy in HEAD processing and fail to send the HTTP/2
EOS. Since we do not need any more data, end the request right there.
This will cause us to send a RST_STREAM to the server.

Fixes #14670
Reported-by: Gruber Glass
Closes #14685
2024-08-28 13:54:38 +02:00
Stefan Eissing
1be704e17e
cpool: rename "connection cache/conncache" to "Connection Pools/cpool"
This is a better match for what they do and the general "cpool"
var/function prefix works well.

The pool now handles very long hostnames correctly.

The following changes have been made:

* 'struct connectdata', e.g. connections, keep new members
  named `destination` and ' destination_len' that fully specifies
  interface+port+hostname of where the connection is going to.
  This is used in the pool for "bundling" of connections with
  the same destination. There is no limit on the length any more.
* Locking: all locks are done inside conncache.c when calling
  into the pool and released on return. This eliminates hazards
  of the callers keeping track.
* 'struct connectbundle' is now internal to the pool. It is no
  longer referenced by a connection.
* 'bundle->multiuse' no longer exists. HTTP/2 and 3 and TLS filters
  no longer need to set it. Instead, the multi checks on leaving
  MSTATE_CONNECT or MSTATE_CONNECTING if the connection is now
  multiplexed and new, e.g. not conn->bits.reuse. In that case
  the processing of pending handles is triggered.
* The pool's init is provided with a callback to invoke on all
  connections being discarded. This allows the cleanups in
  `Curl_disconnect` to run, wherever it is decided to retire
  a connection.
* Several pool operations can now be fully done with one call.
  Pruning dead connections, upkeep and checks on pool limits
  can now directly discard connections and need no longer return
  those to the caller for doing that (as we have now the callback
  described above).
* Finding a connection for reuse is now done via `Curl_cpool_find()`
  and the caller provides callbacks to evaluate the connection
  candidates.
* The 'Curl_cpool_check_limits()' now directly uses the max values
  that may be set in the transfer's multi. No need to pass them
  around. Curl_multi_max_host_connections() and
  Curl_multi_max_total_connections() are gone.
* Add method 'Curl_node_llist()' to get the llist a node is in.
  Used in cpool to verify connection are indeed in the list (or
  not in any list) as they need to.

I left the conncache.[ch] as is for now and also did not touch the
documentation. If we update that outside the feature window, we can
do this in a separate PR.

Multi-thread safety is not achieved by this PR, but since more details
on how pools operate are now "internal" it is a better starting
point to go for this in the future.

Closes #14662
2024-08-28 13:52:49 +02:00
Daniel Stenberg
3af75e18d6
configure: remove USE_EXPLICIT_LIB_DEPS
Added a long time ago for something that libtool should handle for us.

Closes #14697
2024-08-28 13:45:01 +02:00
Viktor Szakats
d620ec6791
CI: add test timeouts, more cmake build tests, fix VS2010 C warning
- GHA/macos: set timeout for test runs.
  Double the value for autotools to fit torture tests.
- GHA/cygwin: reduce test run timeout for autotools.
- GHA/cygwin: enable building tests with cmake.
- GHA/windows: enable building tests with MSYS cmake.
- GHA/windows: enable building tests with MSVC UWP.
- appveyor: enable building tests with VS2008 x86 and VS2010 x64.
- tests: add workaround compiler warnings when building with VS2010:
  ```
  tests\server\util.c(482): warning C4306: 'type cast' : conversion from 'int' to 'void (__cdecl *)(int)' of greater size
  tests\server\util.c(486): warning C4306: 'type cast' : conversion from 'int' to 'void (__cdecl *)(int)' of greater size
  tests\server\util.c(490): warning C4306: 'type cast' : conversion from 'int' to 'void (__cdecl *)(int)' of greater size
  tests\server\util.c(720): warning C4306: 'type cast' : conversion from 'int' to 'void (__cdecl *)(int)' of greater size
  tests\server\util.c(726): warning C4306: 'type cast' : conversion from 'int' to 'void (__cdecl *)(int)' of greater size
  tests\server\util.c(732): warning C4306: 'type cast' : conversion from 'int' to 'void (__cdecl *)(int)' of greater size
  tests\server\util.c(781): warning C4306: 'type cast' : conversion from 'int' to 'void (__cdecl *)(int)' of greater size
  tests\server\util.c(785): warning C4306: 'type cast' : conversion from 'int' to 'void (__cdecl *)(int)' of greater size
  tests\server\util.c(789): warning C4306: 'type cast' : conversion from 'int' to 'void (__cdecl *)(int)' of greater size
  ```
  Ref: https://ci.appveyor.com/project/curlorg/curl/builds/50485633/job/4ujlwxod3cexmn2q#L1535

With this, tests are built in all GHA cygwin/windows jobs.

Timeouts avoid long runs with runaway issues, example:
https://github.com/curl/curl/actions/runs/10575522173

Closes #14700
2024-08-27 23:40:48 +02:00
Viktor Szakats
2625360b5e
configure: fix WinIDN builds targeting old Windows
1. GHA/windows: enable WinIDN in Linux cross-builds.
   (to reveal the issue in CI.)

2. fix compiler warning when building with mingw-w64 supporting
   WinIDN, while targeting pre-Vista Windows, with a `WINVER` set to
   target Vista or newer. (Such was Ubuntu's mingw-w64 with the
   classic-mingw-specific trick in point 3 of this PR.)
   ```
   ../../lib/idn.c:154:23: error: redundant redeclaration of ‘IdnToAscii’ [-Werror=redundant-decls]
     154 | WINBASEAPI int WINAPI IdnToAscii(DWORD dwFlags,
         |                       ^~~~~~~~~~
   In file included from /usr/share/mingw-w64/include/windows.h:73,
                    from /usr/share/mingw-w64/include/winsock2.h:23,
                    from ../../lib/setup-win32.h:91,
                    from ../../lib/curl_setup.h:308,
                    from ../../lib/idn.c:29:
   /usr/share/mingw-w64/include/winnls.h:1075:30: note: previous declaration of ‘IdnToAscii’ was here
    1075 |   WINNORMALIZEAPI int WINAPI IdnToAscii (DWORD dwFlags, LPCWSTR lpUnicodeCharStr, int cchUnicodeChar, LPWSTR lpASCIICharStr, int cchASCIIChar);
         |                              ^~~~~~~~~~
   [...same for IdnToUnicode...]
   ```
   Ref: https://github.com/curl/curl/actions/runs/10542832783/job/29210098553#step:7:89

3. drop `WINVER` override for classic-mingw. curl no longer supports
   building with classic-mingw.
   Reverts 37f1c21cb9 #7581

4. sync `if IdnToUnicode can be linked` detection snippet with the live
   code in `lib/idn.c`. It fixes detection for the scenario in point 2.

5. delete unused `WINIDN_DIR` variable.

Bug: https://github.com/curl/curl/pull/12606#issuecomment-1885381038
Previous abandoned attempt: #12684
Reviewed-by: Jay Satiro
Closes #14680
2024-08-27 23:40:48 +02:00
Viktor Szakats
09437d8cd4
tests: delete libhostname.so and chkhostname
Before this patch, `libhostname.so` and `chkhostname` were a test
facility for overriding `gethostname()` in non-debug builds on
Linux and other Unix platforms supporting `LD_PRELOAD`.

`gethostname()` has a single use with SMTP.

The alternative way to override `gethostname()` is building in debug
mode, which allows to do this via the `CURL_GETHOSTNAME` env, on all
platforms.

Drop the `LD_PRELOAD` solution in favour of the above.

Also:
- delete inactive NTLM code with a `gethostname()` call made from it.
- streamline NTLM code by dropping a `printf()` and a macro.
- tests: stop setting `CURL_GETHOSTNAME` where unnecessary.

Closes #14695
2024-08-27 23:40:48 +02:00
Dan Fandrich
59b419f1a5 CI: add a script and job to run cmakelint
A number of checks don't match our style or are buggy and so are disabled.

Co-authored-by: Viktor Szakats <vszakats@users.noreply.github.com>
Fixes #14580
Closes #14665
2024-08-27 08:33:44 -07:00
Daniel Stenberg
fa37248d0e
mailmap: add Moritz Buhl 2024-08-27 14:03:47 +02:00
mbuhl
8fe1f562bf
ngtcp2/osslq: remove NULL pointer dereferences
If data is NULL, then it does not make sense to pass it to failf.

Closes #14701
2024-08-27 14:02:05 +02:00
Eric Norris
8dd0cb73a2
share: don't reinitialize conncache
Before this change, calling curl_share_setopt w/ CURL_LOCK_DATA_CONNECT
a second time would re-initialize the connection cache, rather than use
the existing one.

After this change, calling curl_share_setopt w/ CURL_LOCK_DATA_CONNECT
multiple times will have no effect after the first call.

Closes #14696
2024-08-27 08:37:45 +02:00
Viktor Szakats
c96551cea9
cmake: Libs.private improvements
- skip adding pkg-config libdirs if they are system locations.
- replace custom regexes with `get_filename_component()`.
- collect `-L` and `-framework` separately.
  It means these will appear before libs in the `Libs.private` entry,
  syncing it with `./configure`.
- collect in a list variable (was: string).
- use `list(REMOVE_DUPLICATES)` to deduplicate libdirs.
- rename internal variable that is now solely used for system libdirs.

Follow-up to 7c0b6eb3bd #14652

Closes #14668
2024-08-26 16:31:47 +02:00
Viktor Szakats
2c9331be46
GHA/macos: drop options no longer necessary
Follow-up to 7673c12929 #14674

Closes #14693
2024-08-26 16:31:46 +02:00
Aki
bc72a78a11
GHA/windows: enable HTTPS tests with stunnel
- install stunnel

Closes #14488
2024-08-26 16:31:30 +02:00
Viktor Szakats
4a0061697e
GHA/configure-vs-cmake: drop disabling dependency tracking [ci skip]
Recently added, but it's not saving anything at the configure stage,
the only stage in this workflow.

Follow-up to aaacd02466 #14678
2024-08-26 16:29:20 +02:00
Daniel Stenberg
8132b170dc
transfer: remove comments, add asserts
Curl_xfer_send and Curl_xfer_recv had commented FIXMEs about protocol
setting up the transfers badly, but in reality these functions are too
low-level to be able to depend on the protocol transfer setups having
been done yet. Removed.

The functions had checks for data and data->conn that I convered to
asserts since they SHOULD always be valid in this function. The same
goes for the runtime check for buffer_size > 0 that I also converted to
an assert since that should never be set to an invalid value.

Closes #14688
2024-08-26 15:05:33 +02:00
Daniel Stenberg
444e34c513
CONTRIBUTE: polished
- rewrite the keywords section to use less quoted texts
- add "When the pull request is approved"
- change some titles

Closes #14691
2024-08-26 15:04:01 +02:00
Daniel Stenberg
89b9fb64a5
pop3: use the protocol handler ->write_resp
Remove the "hardcoded" logic for the pop3 transfer handler and instead
use the generic protocol handler write_resp function.

Remove the check for 'data->req.ignorebody' because I cannot find a code
flow where this is set for POP3.

Closes #14684
2024-08-26 14:59:50 +02:00
Viktor Szakats
10873ec5a9
GHA/configure-vs-cmake: delete stray backslash [ci skip] 2024-08-26 12:38:21 +02:00
Viktor Szakats
26ab9027f0
configure: fix indentation more
Follow-up to 0052b4b52d #14628

Closes #14682
2024-08-26 11:14:01 +02:00
Viktor Szakats
aaacd02466
GHA/configure-vs-cmake: add Windows build, fix issues
- configure: disable pthreads by default on Windows.
- configure: disable detecting `fseeko()` on Windows.
  (It exists in mingw-w64 2.0.0 and newer, but it's permanently ignored
  in CMake, as this function is never necessary on Windows.)
- extend existing exceptions with their Windows variants.
- `lib/formdata.c`: prioritize `_fseeki64()` over `fseeko()`.
  To reduce the difference between Windows builds, which now all use
  `_fseeki64()`.
- cmake: perm-enable `HAVE_DIRENT_H` and `HAVE_OPENDIR` for mingw-w64,
  to match configure.
  Follow-up to bfe54b0e88 #13137
  This in theory could make the dir listing feature work in mingw-w64
  build, but in my tests (on WINE) it failed at the preceding `open()`
  call.
- cmake: perm-enable `HAVE_STRINGS_H` and `HAVE_UTIME_H` for mingw-w64,
  to match configure. (They are wrappers and make no difference in the build.)

Also:
- configure: sync `USE_MANUAL` macro with cmake, by only setting it for
  `src`. Drop checker exception.
- CI: use `--disable-dependency-tracking` in existing jobs.
- CI: install packages before git checkout, in existing jobs.

Closes #14678
2024-08-26 11:07:58 +02:00
Viktor Szakats
7673c12929
build: check OS-native IDN first, then libidn2
If AppleIDN or WinIDN is selected, don't look for libidn2. Do this by
moving libidn2 detection after AppleIDN/WinIDN and skipping it if any
of them was selected.

Also:
- disable AppleIDN by default with autotools to sync behaviour with
  CMake.
- limit WinIDN checks to native Windows with autotools, as with CMake.

Before this patch libidn2 was detected by default even if AppleIDN or
WinIDN was explicitly selected. libidn2 wasn't used in the build, but
it was left enabled as a dependency and appeared in `libcurl.pc` and
`curl-config`.

Closes #14674
2024-08-26 11:01:46 +02:00
Viktor Szakats
3307b98139
configure: delete unused CURL_DEFINE_UNQUOTED function
Unused since ee6992c66a #12502

Closes #14673
2024-08-26 11:01:14 +02:00
Viktor Szakats
dbf5fbd4a0
configure: delete unused HAVE_OPENSSL3 macro
Closes #14672
2024-08-26 11:01:11 +02:00
Viktor Szakats
c190338e0f
build: delete unused REQUIRE_LIB_DEPS
Unused since 97aca0971d #5808

Closes #14671
2024-08-26 11:00:57 +02:00
Viktor Szakats
573e7e827e
lib, src: delete stray curl_ prefix from printf calls
Also:
- unit1398: delete redundant `curl/mprintf.h` include.

Closes #14664
2024-08-26 11:00:15 +02:00
Viktor Szakats
8b09138083
cmake: minor tidy-ups
- show `OpenSSL v3+` when detected (as in `./configure`).
  (this string also makes its way to `curl-config`.)
- prefer `unset(VAR)` over `set(VAR)`.
  Same effect, but `unset()` tells the intent unambiguously.
  https://cmake.org/cmake/help/latest/command/set.html
- drop "implementation" from an `option()` description.
- FindGSS: replace legacy keyword alias with modern alternative.
  https://cmake.org/cmake/help/latest/command/get_filename_component.html
- move `CURL_STATIC_CRT` logic next to its `option()`.
- improve order of `libcurl.pc`/`curl-config` variable init lines.
- tests: drop/shorten custom target names.
  They inflated generated make files by 550KB.
  Keep target name logic for sync between code snippets.
  Follow-up to a2ef5d36b3 #14660
- clear a variable after use.
- restore `STATUS` for `Features:`/`Protocols:` `message()`s:
  Without it the output goes to stderr, and appears in red in CMake GUI.
  It doesn't seem possible to show a line on stdout without leading
  underscores to match `curl -V` and `./configure` output.
  Partial revert of acbc6b703f #14197
- WindowsCache: move `HAVE_LINUX_TCP_H` into the header group.
- move strings to the same line as their `STRING` keyword.
- formatting in generated code.
- delete bogus comment.
- unfold lines for readability.
- fix a too long line. (for cmakelint)
- missing quotes, whitespace, comments.

Closes #14610
2024-08-26 11:00:08 +02:00