Commit Graph

32807 Commits

Author SHA1 Message Date
Daniel Stenberg
9a0cf56471
curl: --help [option] displays documentation for given cmdline option
Since the documentation text blob might be gzipped, it needs to search
for what to output in a streaming manner. It then first searches for
"\nALL OPTIONS".

Then, it looks for the start to display at "\n    -[option]" and stops
again at "\n    -". Except for the last option in the man page, which
ends at "\nFILES" - the subtitle for the section following all options
in the manpage.

Test 1707 to 1710 verify

Closes #13997
2024-08-04 16:06:17 +02:00
Daniel Stenberg
9b1e4b4632
tool_operate: support --dump-header % to direct to stderr
Similar to how --trace and --trace-ascii already do it.

Added test 1489 to verify

Closes #13992
2024-08-04 16:02:24 +02:00
Daniel Stenberg
e26eefd9ce
tool_operate: for -O, use "default" as filename when the URL has none
... or pick the last directory part from the path if available.

Instead of returning error.

Add test 690 and 691 to verify. Test 76 and 2036 no longer apply.

Closes #13988
2024-08-04 15:59:51 +02:00
David Sardari
cb829f994d
doh-url.md: point out DOH server IP pinning
Closes #14377
Signed-off-by: David Sardari <d@duxsco.de>
2024-08-04 15:57:45 +02:00
Viktor Szakats
4f198c8525
tests: fixup tests/data/Makefile.am references
Follow-up to f5b826532f #14357
Reported-by: Stefan Eissing
Fixes #14371
Closes #14372
2024-08-04 15:28:29 +02:00
Viktor Szakats
1556951c4b
GHA/non-native: ignore FreeBSD FTP test results
They are flaky.
2024-08-04 02:08:27 +02:00
Stefan Eissing
93d1af4011
pytests: add tests for HEAD requests in all HTTP versions
Closes #14367
2024-08-04 00:20:14 +02:00
Viktor Szakats
acbc6b703f
cmake: tidy-ups
- tidy-up comments.
- use lowercase, underscore prefixed names for internal variables.
- use `IN LISTS` and `IN ITEMS` in `foreach()` loops.
- rename variable name `OUTPUT` to a more distinctive one.
- tidy-up `STREQUAL` syntax.
- delete commented code.
- indent/whitespace.

Closes #14197
2024-08-03 20:49:15 +02:00
Daniel Stenberg
b64d9d7d81
RELEASE-NOTES: synced 2024-08-03 20:38:54 +02:00
Daniel Stenberg
272233e484
docs/cmdline-opts: update see-also to use show-headers
Since --include is now deprecated since 82c53f821f
2024-08-03 20:29:30 +02:00
Daniel Stenberg
b80798c24d
getparam: make --rate accept "number of units"
Do no more than 5 transfers per 15 seconds with "5/15s" or limit it to 3
transfers per 4 hours with "3/4h" etc.

Previously it would always only work with a single time unit.

Ref: #14242
Closes #14245
2024-08-03 20:27:29 +02:00
Viktor Szakats
2d8464c4cb
GHA/windows: move Cygwin into its own workflow
Cygwin runs stable but slow, while native Windows in the same workflow
runs fast but unreliable (hangs). GHA requires all jobs to finish before
allowing to re-run failed ones. Before this patch this meant waiting for
the slow Cygwin jobs to re-run hung native jobs. After this patch Cygwin
jobs run in their own workflow, allowing to re-run broken Windows jobs
earlier.

Follow-up to 0d12528729 #14236
Closes #14366
2024-08-03 20:21:25 +02:00
Daniel Stenberg
82c53f821f
tool_getparam: make --show-headers the same as --include
Simply a name alias that better explains what the option does.

Closes #13987
2024-08-03 19:56:57 +02:00
Stefan Eissing
709a6a3965
cfilters: send flush
Since data can be held in connection filter buffers when sending gives
EAGAIN, add methods to query this and perform flushing of those buffers.

The transfer loop will continue sending until all upload data is
processed and the connection is flushed.

- add `CF_QUERY_SEND_PENDING` to query filters
- add `CF_CTRL_DATA_SEND_FLUSH` to flush filters
- change `Curl_req_want_send()` to query the connection
  if it needs flushing
- use `Curl_req_want_send()` to determine the POLLOUT
  in the PERFORMING multi state
- implement flush handling in the HTTP/2 connection filter

Closes #14271
2024-08-03 19:55:45 +02:00
Stefan Eissing
911c3166b6
lib: add eos flag to send methods
Adds a `bool eos` flag to send methods to indicate that the data
is the last chunk the invovled transfer wants to send to the server.

This will help protocol filters like HTTP/2 and 3 to forward the
stream's EOF flag and also allow to EAGAIN such calls when buffers
are not yet fully flushed.

Closes #14220
2024-08-03 19:53:54 +02:00
Stefan Eissing
0472afe5f9
vtls: init ssl peer only once
- check that `struct ssl_peer` is only initialized once
- fix vtls peer init to run only once
- check in peer init that hostname is not empty, fail otherwise

Closes #14152
2024-08-03 19:52:21 +02:00
Stefan Eissing
5a9262a333
url: dns_entry related improvements
Replace Curl_resolv_unlock() with Curl_resolv_unlink():

-replace inuse member with refcount in Curl_dns_entry

- pass Curl_dns_entry ** to unlink, so it gets always cleared

- solve potential (but unlikley) UAF in FTP's handling of looked up
  Curl_dns_entry. Esp. do not use addr information after unlinking an entry.
  In reality, the unlink will not free memory, as the dns entry is still
  referenced by the hostcache. But this is not safe and relying on no other
  code pruning the cache in the meantime.

- pass permanent flag when adding a dns entry instead of fixing timestamp
  afterwards.

url.c: fold several static *resolve_* functions into one.

Closes #14195
2024-08-03 19:51:02 +02:00
Stefan Eissing
2372a5915c
Curl_rand_bytes to control env override
- in DEBUGBUILD, all specifying if true random numbers
  are desired or simulated ones via CURL_ENTROPY
- allows to use randoms in other DEBUG checks to not
  interfere with the CURL_ENTROPY
- without this change, any Curl_rand() use will alter
  results of some AUTHENTICATION methods like DIGEST

Closes #14264
2024-08-03 19:49:15 +02:00
Dan Fandrich
0324d557e4
CI: enable parallel testing in CI builds
The test-ci target now uses 2 processes by default, but the amount of
parallelism is tuned for each CI service and build environment based on
results of a number of test runs.  Some CI services use super-
oversubscribed build machines that can barely run the curl tests
already with no parallelism without frequently failing with
timing-induced failures. These continue to be run without parallelism.
Other services provide two fast, unloaded cores and these run with 14
processes, which is a good default for this kind of environment.

Here's a summary of the number of test processes by CI service:

  Appveyor - 2 (Windows MSVC), 1 (others)
  Azure - 2
  Circle CI - 14
  Cirrus - 28 (macOS), 14 (Linux), 7 (FreeBSD), 5 (macOS torture), 2 (Windows)
  GitHub Actions - 3 (macOS), 2 (Linux)

Some of these are a bit conservative to keep timing-induced flakiness down.

The net result is that the first test results should arrive only
3 minutes after a commit submission.

Changes merged via separate commits:
- 2a7c8b27fd #14171
- 72341068a2
- efce544418 #14244
- c6cf411bac

Ref: #10818
Closes #11510
2024-08-03 16:12:44 +02:00
Viktor Szakats
fadb2ee6ec
CI: realign cmake build settings (for nghttp2, libidn2)
- nghttp2 is now on by default, adjust build configuration accordingly.
  Follow-up to 87aa4ebd82 #14136

- GHA/macos: disable libidn2 in combination builds, syncing with
  autotools. Otherwise it's now auto-detected via pkg-config by default.
  Follow-up to f43adc2c49 #14137

Closes #14364
2024-08-03 16:12:44 +02:00
Viktor Szakats
8a3740bc8e
curl: support embedding a CA bundle
Add the ability to embed a CA bundle into the curl binary. It is used
when no other runtime or build-time option set one.

This helps curl-for-win macOS and Linux builds to run standalone, and
also helps Windows builds to avoid picking up the CA bundle from an
arbitrary (possibly world-writable) location (though this behaviour is
not currently disablable).

Usage:
- cmake: `-DCURL_CA_EMBED=/path/to/curl-ca-bundle.crt`
- autotools: `--with-ca-embed=/path/to/curl-ca-bundle.crt`
- Makefile.mk: `CURL_CA_EMBED=/path/to/curl-ca-bundle.crt`

Also add new command-line option `--dump-ca-embed` to dump the embedded
CA bundle to standard output.

Closes #14059
2024-08-03 09:22:26 +02:00
Viktor Szakats
87aa4ebd82
cmake: detect nghttp2 via pkg-config, enable by default
- also detect nghttp2 via `pkg-config` to match nghttp3 detection
  and autotools.

- enable nghttp2 by default to match autotools.

Cherry-picked from #14097
Closes #14136
2024-08-03 09:22:26 +02:00
Viktor Szakats
f518c73a87
cmake: drop unused internal variable
Closes #14361
2024-08-03 09:22:26 +02:00
Tal Regev
bb9c15e97a
vtls: fix MSVC 'cast truncates constant value' warning
Fixes:
```
curl\lib\vtls\cipher_suite.c(193,3): error C2220: the following warning is treated as an error
curl\lib\vtls\cipher_suite.c(193,3): warning C4310: cast truncates constant value
```

Closes #14341
2024-08-03 09:22:25 +02:00
renovate[bot]
170c28805a
ci: Update actions/upload-artifact digest to 89ef406
Closes #14359
2024-08-03 09:22:25 +02:00
Viktor Szakats
b6089c35d9
cmake: drop reference to undefined variable
Undefined since the initial commit adding CMake support.

Closes #14358
2024-08-03 01:21:23 +02:00
Viktor Szakats
f5b826532f
cmake: drop no-op tests/data/CMakeLists.txt
It's a no-op since
d162fca69a #9333 (2022-08-18).

Also revert 476499c75c that is
no longer necessary: move `Makefile.inc` back into `Makefile.am`.

Closes #14357
2024-08-03 01:15:45 +02:00
Viktor Szakats
f87c3363ef
cmake: drop custom CMakeOutput.log/CMakeError.log logs
CMake writes this information into `CMakeConfigureLog.yaml`
automatically.

Closes #14356
2024-08-03 01:15:45 +02:00
Stefan Eissing
39b9ccea8d
x509asn1: raise size limit for x509 certification information
Raise the limit for certification information from 10 thousand to 100
thousand bytes. Certificates can be larger than 10k.

Change the infof() debug output to add '...' at the end when the max
limit it can handle is exceeded.

Reported-by: Sergio Durigan Junior
Fixes #14352
Closes #14354
2024-08-02 23:20:57 +02:00
Daniel Stenberg
d2abf8dede
GHA/distcheck: add a reproducible release check 2024-08-02 23:05:41 +02:00
Daniel Stenberg
86039e6e42
verify-release: shell script that verifies a release tarball
This script remakes a provided curl release and verifies that the newly
built version is identical to the original file.

Due to bugs in releases up to and including curl 8.9.1, it does not work
on tarballs generated before commit 754acd1a9d.

Closes #14350
2024-08-02 23:05:41 +02:00
Daniel Stenberg
fab526c032
Makefile: remove 'scripts' duplicate from DIST_SUBDIRS
Also fix the .dist replacing by avoiding all Makefiles because it
otherwise also went into the temporary release folder and got confused
about the Makefile.dist in there.
2024-08-02 23:05:41 +02:00
Daniel Stenberg
d0afb33959
dmaketgz: only run 'make distclean' if Makefile exists
... so that we can avoid the build failure if we run this in a clean
checkout.

Also remove -it from the docker invoke since it is not interactive and
it needs no TTY. They made the job fail in the CI.
2024-08-02 23:05:41 +02:00
Viktor Szakats
4d34fd26db
autotools: fix typo in tests/data target
Ref: c1b369fd4c (2002-12-12)
Closes #14355
2024-08-02 14:36:16 +02:00
Viktor Szakats
c6cf411bac
GHA/non-native: reduce FreeBSD test parallelism to -j8 [ci skip]
To reduce flakiness.
2024-08-02 14:36:13 +02:00
Stefan Eissing
45246ebca1
tests: gitignore newly generated files
Closes #14351
2024-08-02 11:19:10 +02:00
Stefan Eissing
ba44ac62e3
progress: ratelimit/progress tweaks
- multi.c: when ratelimiting a transfer stops (MSTATE_RATELIMITING ->
  MSTATE_PERFORMING), run the MSTATE_PERFORMING state right away

- urldata.h: factor out upload and download progress counters into a
  struct, use that for passing these to progress update functions

- progress.c/getinfo.c: change names of moved progress counters

- progress.c: use new structs and a helper struct to factor repeated
  calculation into static helpers

Closes #14335
2024-08-02 11:17:44 +02:00
Stefan Eissing
eb0a366b70
http2: improve rate limiting of downloads
Set the initial stream window size to 64KB and increase that to the 10MB
we used to start with on the first server reply, unless a rate limit is
in effect.

Continously monitory changes to the transfers rate limit and adjust the
stream window size accordingly. `max_recv_speed` is a transfer propert
that can be changed during processing by a callback.

Closes #14326
2024-08-02 08:45:01 +02:00
renovate[bot]
4abf97b0a6
GHA: update awslabs/aws-lc to v1.33.0
Closes #14347
2024-08-02 08:43:17 +02:00
Stefan Eissing
f6cb3c6308
tests/http: configure test httpd to honor client cipher order
Let the client, e.g. curl, influence the cipher selected in a TLS
handshake. TLS backends have different preferences and honor that
in httpd the same as Caddy does.

Also makes for a more fair compare of different TLS backends.

Closes #14338
2024-08-02 08:32:34 +02:00
Daniel Stenberg
754acd1a9d
dist: fix reproducible build from release tarball
Make it possible to rebuild an identical copy from a release tarball. It
was previously only possible from a checked out git repository.

- add release-tools.sh to dist
- keep Makefile.dist around to include it in dist
- regenerate tool_huge.c with the new version in dist
- fix the dist CI job to not do make clean like before

Closes #14336
2024-08-02 08:28:56 +02:00
Tal Regev
c73b80a3cd
cmake: add gnutls to multissl feature
Closes #14345
2024-08-02 08:27:31 +02:00
Daniel Stenberg
1f61db5907
curl: allow 500MB data URL encode strings
Previously it would bail out of the generated data reached 8MB in
memory.

Reported-by: Antoine du Hamel
Fixes #14337
Closes #14340
2024-08-02 08:26:36 +02:00
Daniel Stenberg
9bfc7f9234
escape: allow curl_easy_escape to generate 3*input length output
Instead of capping it to the 3 * CURL_MAX_INPUT_LENGTH. To allow users
to URL encode larger chunks of data.

Closes #14339
2024-08-01 23:03:21 +02:00
Daniel Stenberg
8a9c22796b
CHANGES: rename to CHANGES.md, no longer generated
- scripts/log2changes.pl was not included in release tarballs, which broke
  reproducible builds

- since log2changes uses git to generate the contents, it makes it difficult
  to generate the same contents later (it would need to be fixed)

- the CHANGES file has outlived its purpose. the main changes are in the
  RELEASE-NOTES, the rest are better tracked directly using git or on GitHub

- put a fixed CHANGES.md in there instead pointing out where the info lives
  now

Closes #14331
2024-08-01 13:37:12 +02:00
Daniel Stenberg
12774f4505
RELEASE-NOTES: synced
Plus add a link to https://curl.se/changes.html
2024-08-01 13:36:28 +02:00
Daniel Stenberg
e3240db0a7
GHA: scan git repository and detect unvetted binary files
The only binary-looking files that are accepted in the git repository
need to match the checksums in the sha256sum file
".github/scripts/binarycheck.sums".

This is done to make sure that no one has planted any hidden (encrypted)
potentially dangerous payload in the tree.

Closes #14333
2024-08-01 12:30:36 +02:00
Viktor Szakats
c3fe2dd25c
GHA/windows: drop FTP tests
Try reducing hangs.

Closes #14330
2024-08-01 00:32:00 +02:00
Tal Regev
a79dc7b601
GHA/windows: remove vcpkg bin path in MSVC jobs
- the path is wrong, because we compile on debug, and we are using
  the release bin path.
- the path is not needed, cmake curl copy the needed dlls to the
  compilation cmake folder where the curl exe is found.

Closes #14329
2024-08-01 00:32:00 +02:00
Viktor Szakats
0d12528729
GHA/windows: timeout earlier with hung tests
Finishing tests takes on average 10 or less minutes depending on
platform. Reduce job step timeouts to reflect that. It helps
concluding hung/failed tests earlier, which allows to retry them
earlier.

This makes it more difficult to tell from a job if it hung or not,
because we lose the long runtime as a telltale sign. Let's see how it
works out and adjust as necessary.

Also fix a comment while here.

Closes #14236
2024-08-01 00:32:00 +02:00