]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
2 years agoopenssl: identify the "quictls" backend correctly
Daniel Stenberg [Sat, 4 Nov 2023 22:36:40 +0000 (23:36 +0100)] 
openssl: identify the "quictls" backend correctly

Since vanilla OpenSSL does not support the QUIC API I think it helps
users to identify the correct OpenSSL fork in version output. The best
(crude) way to do that right now seems to be to check if ngtcp2 support
is enabled.

Closes #12270

2 years agocurl: improved IPFS and IPNS URL support
Mark Gaiser [Wed, 18 Oct 2023 00:28:06 +0000 (02:28 +0200)] 
curl: improved IPFS and IPNS URL support

Previously just ipfs://<cid> and ipns://<cid> was supported, which is
too strict for some usecases.

This patch allows paths and query arguments to be used too.
Making this work according to normal http semantics:

 ipfs://<cid>/foo/bar?key=val
 ipns://<cid>/foo/bar?key=val

The gateway url support is changed.
It now only supports gateways in the form of:

 http://<gateway>/foo/bar
 http://<gateway>

Query arguments here are explicitly not allowed and trigger an intended
malformed url error.

There also was a crash when IPFS_PATH was set with a non trailing
forward slash. This has been fixed.

Lastly, a load of test cases have been added to verify the above.

Reported-by: Steven Allen
Fixes #12148
Closes #12152

2 years agodocs: KNOWN_BUGS cleanup
Harry Mallon [Wed, 1 Nov 2023 13:01:12 +0000 (13:01 +0000)] 
docs: KNOWN_BUGS cleanup

* Remove other mention of hyper memory-leaks from `KNOWN_BUGS`.
  Should have been removed in 629723ecf22a8eae78d64cceec2f3bdae703ec95

* Remove mention of aws-sigv4 sort query string from `KNOWN_BUGS`.
  Fixed in #11806

* Remove mention of aws-sigv4 query empty value problems

* Remove mention of aws-sigv4 missing amz-content-sha256
  Fixed in #9995

2 years agohttp_aws_sigv4: canonicalise valueless query params
Harry Mallon [Wed, 1 Nov 2023 14:46:46 +0000 (14:46 +0000)] 
http_aws_sigv4: canonicalise valueless query params

Fixes #8107
Closes #12244

2 years agodocs: preserve the modification date when copying the prebuilt man page
Michael Kaufmann [Sat, 28 Oct 2023 08:24:25 +0000 (10:24 +0200)] 
docs: preserve the modification date when copying the prebuilt man page

The previously built man page "curl.1" must be copied with the original
modification date, otherwise the man page is never updated.

This fixes a bug that has been introduced with commit 2568441cab.

Reviewed-by: Dan Fandrich
Reviewed-by: Daniel Stenberg
Closes #12199

2 years agodocs: remove bold from some man page SYNOPSIS sections
Daniel Stenberg [Sat, 4 Nov 2023 11:01:50 +0000 (12:01 +0100)] 
docs: remove bold from some man page SYNOPSIS sections

In the name of consistency

Closes #12267

2 years agoopenssl: two multi pointer checks should probably rather be asserts
Daniel Stenberg [Fri, 3 Nov 2023 23:01:28 +0000 (00:01 +0100)] 
openssl: two multi pointer checks should probably rather be asserts

... so add the asserts now and consider removing the dynamic checks in a
future.

Ref: #12261
Closes #12264

2 years agodocs: add supported version for the json write-out
boilingoden [Sat, 4 Nov 2023 08:05:13 +0000 (11:35 +0330)] 
docs: add supported version for the json write-out

xref: https://curl.se/changes.html#7_70_0

Closes #12266

2 years agoappveyor: make VS2008-built curl tool runnable
Viktor Szakats [Fri, 3 Nov 2023 22:31:49 +0000 (22:31 +0000)] 
appveyor: make VS2008-built curl tool runnable

By linking the CRT statically. This avoids the error about missing
runtime DLL `MSVCR90.dll` when running the freshly built `curl.exe`.

Closes #12263

2 years agourl: proxy ssl connection reuse fix
Stefan Eissing [Fri, 3 Nov 2023 10:46:14 +0000 (11:46 +0100)] 
url: proxy ssl connection reuse fix

- tunnel https proxy used for http: transfers does
  no check if proxy-ssl configuration matches
- test cases added, test_10_12 fails on 8.4.0

Closes #12255

2 years agocurl_sspi: support more revocation error names in error messages
Jay Satiro [Wed, 1 Nov 2023 07:18:53 +0000 (03:18 -0400)] 
curl_sspi: support more revocation error names in error messages

- Add these revocation errors to sspi error list:
  CRYPT_E_NO_REVOCATION_DLL, CRYPT_E_NO_REVOCATION_CHECK,
  CRYPT_E_REVOCATION_OFFLINE and CRYPT_E_NOT_IN_REVOCATION_DATABASE.

Prior to this change those error codes were not matched to their macro
name and instead shown as "unknown error".

Before:

schannel: next InitializeSecurityContext failed:
Unknown error (0x80092013) - The revocation function was
unable to check revocation because the revocation server was offline.

After:

schannel: next InitializeSecurityContext failed:
CRYPT_E_REVOCATION_OFFLINE (0x80092013) - The revocation function was
unable to check revocation because the revocation server was offline.

Bug: https://github.com/curl/curl/issues/12239
Reported-by: Niracler Li
Closes https://github.com/curl/curl/pull/12241

2 years agostrdup: don't allow Curl_strndup to read past a null terminator
Jay Satiro [Thu, 2 Nov 2023 22:56:06 +0000 (18:56 -0400)] 
strdup: don't allow Curl_strndup to read past a null terminator

- Use malloc + strncpy instead of Curl_memdup to dupe the string before
  null terminating it.

Prior to this change if Curl_strndup was passed a length longer than
the allocated string then it could copy out of bounds.

This change is for posterity. Curl_strndup was added in the parent
commit and currently none of the calls to it pass a length that would
cause it to read past the allocated length of the input.

Follow-up to d3b3ba35.

Closes https://github.com/curl/curl/pull/12254

2 years agolib: add and use Curl_strndup()
Daniel Stenberg [Thu, 2 Nov 2023 12:47:15 +0000 (13:47 +0100)] 
lib: add and use Curl_strndup()

The Curl_strndup() function is similar to memdup(), but copies 'n' bytes
then adds a terminating null byte ('\0').

Closes #12251

2 years agoCURPOST_POSTFIELDS.3: add CURLOPT_COPYPOSTFIELDS in SEE ALSO
Daniel Stenberg [Thu, 2 Nov 2023 19:34:14 +0000 (20:34 +0100)] 
CURPOST_POSTFIELDS.3: add CURLOPT_COPYPOSTFIELDS in SEE ALSO

2 years agopytest: use lower count in repeat tests
Stefan Eissing [Thu, 2 Nov 2023 10:24:03 +0000 (11:24 +0100)] 
pytest: use lower count in repeat tests

- lower large iteration counts in some tests somewhat for
  the same coverage with less duration

Closes #12248

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 2 Nov 2023 15:30:15 +0000 (16:30 +0100)] 
RELEASE-NOTES: synced

2 years agodocs: clarify that curl passes on input unfiltered
Daniel Stenberg [Thu, 2 Nov 2023 12:05:10 +0000 (13:05 +0100)] 
docs: clarify that curl passes on input unfiltered

... for several options.

Reported-by: Ophir Lojkine
Closes #12249

2 years agourlapi: when URL encoding the fragment, pass in the right length
Daniel Stenberg [Thu, 2 Nov 2023 12:43:54 +0000 (13:43 +0100)] 
urlapi: when URL encoding the fragment, pass in the right length

A benign bug because it would only add an extra null terminator.

Made lib1560 get a test that runs this code.

Closes #12250

2 years agovtls: late clone of connection ssl config
Stefan Eissing [Tue, 31 Oct 2023 14:25:08 +0000 (15:25 +0100)] 
vtls: late clone of connection ssl config

- perform connection cache matching against `data->set.ssl.primary`
  and proxy counterpart
- fully clone connection ssl config only when connection is used

Closes #12237

2 years agomsh3: error when built with CURL_DISABLE_SOCKETPAIR set
Stefan Eissing [Thu, 2 Nov 2023 10:40:59 +0000 (11:40 +0100)] 
msh3: error when built with CURL_DISABLE_SOCKETPAIR set

Reported-by: Gisle Vanem
Closes #12252
Fixes #12213

2 years agohsts: skip single-dot hostname
Daniel Stenberg [Thu, 2 Nov 2023 09:52:46 +0000 (10:52 +0100)] 
hsts: skip single-dot hostname

Reported-by: Maksymilian Arciemowicz
Closes #12247

2 years agovtls: fix build without proxy
Daniel Stenberg [Wed, 1 Nov 2023 09:52:21 +0000 (10:52 +0100)] 
vtls: fix build without proxy

Follow-up to bf0e278a3c54bc7fee7360da17c

closes #12243

2 years agodocs/example/keepalive.c: show TCP keep-alive options
Daniel Stenberg [Wed, 1 Nov 2023 09:36:45 +0000 (10:36 +0100)] 
docs/example/keepalive.c: show TCP keep-alive options

Closes #12242

2 years agolib1560: verify appending blank URL encoded query string
Daniel Stenberg [Tue, 31 Oct 2023 15:22:39 +0000 (16:22 +0100)] 
lib1560: verify appending blank URL encoded query string

2 years agourlapi: skip appending NULL pointer query
Daniel Stenberg [Tue, 31 Oct 2023 15:22:07 +0000 (16:22 +0100)] 
urlapi: skip appending NULL pointer query

Reported-by: kirbyn17 on hackerone
Closes #12240

2 years agolib1560: verify setting host to "" with and without URL encode
Daniel Stenberg [Tue, 31 Oct 2023 10:35:25 +0000 (11:35 +0100)] 
lib1560: verify setting host to "" with and without URL encode

2 years agourlapi: avoid null deref if setting blank host to url encode
Daniel Stenberg [Tue, 31 Oct 2023 10:24:13 +0000 (11:24 +0100)] 
urlapi: avoid null deref if setting blank host to url encode

Reported-by: kirbyn17 on hackerone
Closes #12240

2 years agodynbuf: assert for NULL pointer inputs
Daniel Stenberg [Tue, 31 Oct 2023 15:21:35 +0000 (16:21 +0100)] 
dynbuf: assert for NULL pointer inputs

Help us catch more mistakes.

Closes #12238

2 years agoHTTP3: ngtcp2 builds are no longer experimental
Daniel Stenberg [Tue, 17 Oct 2023 16:04:50 +0000 (18:04 +0200)] 
HTTP3: ngtcp2 builds are no longer experimental

The other HTTP/3 backends are still experimental.

Closes #12235

2 years agovtls: cleanup SSL config management
Stefan Eissing [Thu, 26 Oct 2023 09:27:42 +0000 (11:27 +0200)] 
vtls: cleanup SSL config management

- remove `Curl_ssl_get_config()`, no longer needed

Closes #12204

2 years agolibcurl-thread.3: simplify the TLS section
Daniel Stenberg [Mon, 30 Oct 2023 20:26:40 +0000 (21:26 +0100)] 
libcurl-thread.3: simplify the TLS section

All TLS libraries curl can use are threadsafe since OpenSSL 1.1.x, August
2016.

Closes #12233

2 years agoconfigure: better --disable-http
Daniel Stenberg [Sat, 28 Oct 2023 09:05:13 +0000 (11:05 +0200)] 
configure: better --disable-http

- disable HTTPS-proxy as well, since it can't work without HTTP

- curl_setup: when HTTP is disabled, also disable all features that are
  HTTP-only

- version: HTTPS-proxy only exists if HTTP support exists

Closes #12223

2 years agohttp: consider resume with CURLOPT_FAILONERRROR and 416 to be fine
Daniel Stenberg [Sat, 21 Oct 2023 12:32:30 +0000 (14:32 +0200)] 
http: consider resume with CURLOPT_FAILONERRROR and 416 to be fine

Finding a 'Content-Range:' in the response changed the handling.

Add test case 1475 to verify -C - with 416 and Content-Range: header,
which is almost exactly like test 194 which instead uses a fixed -C
offset. Adjusted test 194 to also be considered fine.

Fixes #10521
Reported-by: Smackd0wn
Fixes #12174
Reported-by: Anubhav Rai
Closes #12176

2 years agoGHA: fix checkout of quictls repository to use correct branch name
Stefan Eissing [Mon, 30 Oct 2023 14:16:49 +0000 (15:16 +0100)] 
GHA: fix checkout of quictls repository to use correct branch name

Follow-up to c868b0e30f10cd0ac7

Closes #12232

2 years agodocs/example/localport.c: show off CURLOPT_LOCALPORT
Daniel Stenberg [Mon, 30 Oct 2023 10:48:19 +0000 (11:48 +0100)] 
docs/example/localport.c: show off CURLOPT_LOCALPORT

Closes #12230

2 years agodocs/examples/interface.c: show CURLOPT_INTERFACE use
Daniel Stenberg [Mon, 30 Oct 2023 10:40:07 +0000 (11:40 +0100)] 
docs/examples/interface.c: show CURLOPT_INTERFACE use

Although super simple.

Closes #12229

2 years agobuild: fix compiler warning with auths disabled
Viktor Szakats [Sun, 29 Oct 2023 20:37:20 +0000 (20:37 +0000)] 
build: fix compiler warning with auths disabled

```
./curl/lib/http.c:979:12: warning: unused function 'is_valid_auth_separator' [-Wunused-function]
static int is_valid_auth_separator(char ch)
           ^
5 warnings generated.
```

Follow-up to e92edfbef64448ef461117769881f3ed776dec4e #11490

Closes #12227

2 years agobuild: require Windows XP or newer
Viktor Szakats [Sat, 28 Oct 2023 10:52:23 +0000 (10:52 +0000)] 
build: require Windows XP or newer

After this patch we assume availability of `getaddrinfo` and
`freeaddrinfo`, first introduced in Windows XP. Meaning curl
now requires building for Windows XP as a minimum.

TODO: assume these also in autotools.

Ref: https://github.com/curl/curl/pull/12221#issuecomment-1783761806
Closes #12225

2 years agoappveyor: bump one job to OpenSSL 3.1 (was 1.1.1)
Viktor Szakats [Sun, 29 Oct 2023 18:15:11 +0000 (18:15 +0000)] 
appveyor: bump one job to OpenSSL 3.1 (was 1.1.1)

Use 3.1 with the modern runner image.

We still use 1.1.1 in 8 jobs.

1.1.1 is EOL since 2023-09-11:
https://www.openssl.org/blog/blog/2023/03/28/1.1.1-EOL/

Also:
- add missing SSL-backend to job descriptions.
- tidy up CPU in job descriptions.

Closes #12226

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 30 Oct 2023 07:48:26 +0000 (08:48 +0100)] 
RELEASE-NOTES: synced

2 years agoGHA: bump ngtcp2, nghttp3, nghttp2 and quictls versions
Daniel Stenberg [Fri, 27 Oct 2023 14:37:41 +0000 (16:37 +0200)] 
GHA: bump ngtcp2, nghttp3, nghttp2 and quictls versions

ngtcp2 1.0.1
nghttp3 1.0.0
nghttp2 1.58.0
quictls 3.1.4+quic

also sync HTTP3.md with these changes

Closes #12132

2 years agowolfssl: add default case for wolfssl_connect_step1 switch
Kareem [Fri, 27 Oct 2023 21:23:33 +0000 (14:23 -0700)] 
wolfssl: add default case for wolfssl_connect_step1 switch

Closes #12218

2 years agocurl_setup: disallow Windows IPv6 builds missing getaddrinfo
Jay Satiro [Sat, 28 Oct 2023 04:23:40 +0000 (00:23 -0400)] 
curl_setup: disallow Windows IPv6 builds missing getaddrinfo

- On Windows if IPv6 is enabled but getaddrinfo is missing then #error
  the build.

curl can be built with IPv6 support (ENABLE_IPV6) but without the
ability to resolve hosts to IPv6 addresses (HAVE_GETADDRINFO). On
Windows this is highly unlikely and should be considered a bad build
configuration.

Such a bad configuration has already given us a bug that was hard to
diagnose. See #12134 and #12136 for discussion.

Ref: https://github.com/curl/curl/issues/12134
Ref: https://github.com/curl/curl/pull/12136

Closes https://github.com/curl/curl/pull/12221

2 years agoopenssl: make CURLSSLOPT_NATIVE_CA import Windows intermediate CAs
Nico Rieck [Mon, 23 Oct 2023 10:38:19 +0000 (12:38 +0200)] 
openssl: make CURLSSLOPT_NATIVE_CA import Windows intermediate CAs

- If CURLSSLOPT_NATIVE_CA on Windows then import from intermediate CA
  "CA" store after importing from root CA "ROOT" store.

This change allows curl to work in situations where a server does not
send all intermediate certs and they are present in the "CA" store (the
store with intermediate CAs). This is already allowed by the Schannel
backend.

Also this change makes partial chain verification possible for those
certs since we allow partial chain verification by default for OpenSSL
(unless CURLSSLOPT_NO_PARTIALCHAIN). This is not allowed by the Schannel
backend.

Prior to this change CURLSSLOPT_NATIVE_CA only imported "ROOT" certs.

Fixes https://github.com/curl/curl/issues/12155
Closes https://github.com/curl/curl/pull/12185

2 years agoMakefile.mk: fix `-rtmp` option for non-Windows [ci skip]
Viktor Szakats [Sat, 28 Oct 2023 10:06:43 +0000 (10:06 +0000)] 
Makefile.mk: fix `-rtmp` option for non-Windows [ci skip]

2 years agoasyn-ares: handle no connection in the addrinfo callback
Daniel Stenberg [Fri, 27 Oct 2023 22:22:49 +0000 (00:22 +0200)] 
asyn-ares: handle no connection in the addrinfo callback

To avoid crashing.

Follow-up from 56a4db2
Closes #12219

2 years agohostip6: fix DEBUG_ADDRINFO builds
Jay Satiro [Fri, 27 Oct 2023 07:40:05 +0000 (03:40 -0400)] 
hostip6: fix DEBUG_ADDRINFO builds

- Removed unused and incorrect parameter from dump_addrinfo().

Bug: https://github.com/curl/curl/commit/56a4db2e#commitcomment-131050442
Reported-by: Gisle Vanem
Closes https://github.com/curl/curl/pull/12212

2 years agoMakefile.mk: restore `_mingw.h` for default `_WIN32_WINNT`
Viktor Szakats [Fri, 27 Oct 2023 10:20:47 +0000 (10:20 +0000)] 
Makefile.mk: restore `_mingw.h` for default `_WIN32_WINNT`

In 8.4.0 we deleted `_mingw.h` as part of purging old-mingw support.
Turns out `_mingw.h` had the side-effect of setting a default
`_WIN32_WINNT` value expected by `lib/config-win32.h` to enable
`getaddrinfo` support in `Makefile.mk` mingw-w64 builds. This caused
disabling support for this unless specifying the value manually.

Restore this header and update its comment to tell why we continue
to need it.

This triggered a regression in official Windows curl builds starting
with 8.4.0_1. Fixed in 8.4.0_6. (8.5.0 will be using CMake.)

Regression from 38029101e2d78ba125732b3bab6ec267b80a0e72 #11625

Reported-by: zhengqwe on github
Helped-by: Nico Rieck
Fixes #12134
Fixes #12136
Closes #12217

2 years agohostip: silence compiler warning `-Wparentheses-equality`
Viktor Szakats [Fri, 27 Oct 2023 09:48:41 +0000 (09:48 +0000)] 
hostip: silence compiler warning `-Wparentheses-equality`

Seen with LLVM 17.

```
hostip.c:1336:22: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
 1336 |        (a->ai_family == PF_INET)) {
      |         ~~~~~~~~~~~~~^~~~~~~~~~
hostip.c:1336:22: note: remove extraneous parentheses around the comparison to silence this warning
 1336 |        (a->ai_family == PF_INET)) {
      |        ~             ^         ~
hostip.c:1336:22: note: use '=' to turn this equality comparison into an assignment
 1336 |        (a->ai_family == PF_INET)) {
      |                      ^~
      |                      =
1 warning generated.
```

Follow-up to b651aba0962bb31353f55de4dc35f745952a1b10 #12145

Reviewed-by: Daniel Stenberg
Closes #12215

2 years agodoh: use PIPEWAIT when HTTP/2 is attempted
Stefan Eissing [Fri, 27 Oct 2023 09:26:19 +0000 (11:26 +0200)] 
doh: use PIPEWAIT when HTTP/2 is attempted

Closes #12214

2 years agosetopt: remove outdated cookie comment
Daniel Stenberg [Thu, 26 Oct 2023 14:11:01 +0000 (16:11 +0200)] 
setopt: remove outdated cookie comment

Closes #12206

2 years agocfilter: provide call to tell connection to forget a socket
Stefan Eissing [Thu, 26 Oct 2023 15:02:45 +0000 (17:02 +0200)] 
cfilter: provide call to tell connection to forget a socket

- fixed libssh.c workaround for a socket being closed by
  the library
- eliminate the terrible hack in cf-socket.c to guess when
  this happened and try not closing the socket again.
- fixes race in eyeballing when socket could have failed to
  be closed for a discarded connect attempt

Closes #12207

2 years agourl: protocol handler lookup tidy-up
Stefan Eissing [Fri, 27 Oct 2023 09:53:26 +0000 (11:53 +0200)] 
url: protocol handler lookup tidy-up

- rename lookup to what it does
- use ARRAYSIZE instead of NULL check for end
- offer alternate lookup for 0-terminated strings

Closes #12216

2 years agobuild: variadic macro tidy-ups
Viktor Szakats [Fri, 13 Oct 2023 00:25:20 +0000 (00:25 +0000)] 
build: variadic macro tidy-ups

- delete unused `HAVE_VARIADIC_MACROS_C99/GCC` feature checks.
  (both autotools and CMake.)
- delete duplicate `NULL` check in `Curl_trc_cf_infof()`.
- fix compiler warning in `CURL_DISABLE_VERBOSE_STRINGS` builds.
  ```
  ./lib/cf-socket.c:122:41: warning: unused parameter 'data' [-Wunused-parameter]
  static void nosigpipe(struct Curl_easy *data,
                                          ^
  ```
- fix `#ifdef` comments in `lib/curl_trc.{c,h}`.
- fix indentation in some `infof()` calls.

Follow-up to dac293cfb7026b1ca4175d88b80f1432d3d3c684 #12167

Cherry-picked from #12105
Closes #12210

2 years agocmake: speed up threads setup for Windows
Viktor Szakats [Thu, 26 Oct 2023 08:28:20 +0000 (08:28 +0000)] 
cmake: speed up threads setup for Windows

Win32 threads are always available. We enabled them unconditionally
(with `ENABLE_THREADED_RESOLVER`). CMake built-in thread detection
logic has this condition hard-coded for Windows as well (since at least
2007).

Instead of doing all the work of detecting pthread combinations on
Windows, then discarding those results, skip these efforts and assume
built-in thread support when building for Windows.

This saves 1-3 slow CMake configuration steps.

Reviewed-by: Daniel Stenberg
Closes #12202

2 years agocmake: speed up zstd detection
Viktor Szakats [Wed, 25 Oct 2023 23:37:48 +0000 (23:37 +0000)] 
cmake: speed up zstd detection

Before this patch we detected the presence of a specific zstd API to
see if we can use the library. zstd published that API in its first
stable release: v1.0.0 (2016-08-31).

Replace that method by detecting the zstd library version instead and
accepting if it's v1.0.0 or newer. Also display this detected version
and display a warning if the zstd found is unfit for curl.

We use the same version detection method as zstd itself, via its public
C header.

This deviates from autotools which keeps using the slow method of
looking for the API by building a test program. The outcome is the same
as long as zstd keeps offering this API.

Ref: https://github.com/facebook/zstd/commit/5a0c8e24395079f8e8cdc90aa1659cd5ab1b7427 (2016-08-12, committed)
Ref: https://github.com/facebook/zstd/releases/tag/v0.8.1 (2016-08-18, first released)
Ref: https://github.com/facebook/zstd/releases/tag/v1.0.0

Reviewed-by: Daniel Stenberg
Closes #12200

2 years agoopenssl: fix infof() to avoid compiler warning for %s with null
Daniel Stenberg [Wed, 25 Oct 2023 07:26:23 +0000 (09:26 +0200)] 
openssl: fix infof() to avoid compiler warning for %s with null

vtls/openssl.c: In function ‘ossl_connect_step2’:
../lib/curl_trc.h:120:10: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  120 |          Curl_infof(data, __VA_ARGS__); } while(0)
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vtls/openssl.c:4008:5: note: in expansion of macro ‘infof’
 4008 |     infof(data, "SSL connection using %s / %s / %s / %s",
      |     ^~~~~
vtls/openssl.c:4008:49: note: format string is defined here
 4008 |     infof(data, "SSL connection using %s / %s / %s / %s",
      |                                                 ^~

Follow-up to b6e6d4ff8f253c8b8055bab
Closes #12196

2 years agolib: apache style infof and trace macros/functions
Stefan Eissing [Fri, 20 Oct 2023 11:11:34 +0000 (13:11 +0200)] 
lib: apache style infof and trace macros/functions

- test for a simplified C99 variadic check
- args to infof() in --disable-verbose are no longer disregarded but
  must compile.

Closes #12167
Fixes #12083
Fixes #11880
Fixes #11891

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 26 Oct 2023 15:33:25 +0000 (17:33 +0200)] 
RELEASE-NOTES: synced

2 years agourldata: move async resolver state from easy handle to connectdata
Stefan Eissing [Wed, 25 Oct 2023 10:31:34 +0000 (12:31 +0200)] 
urldata: move async resolver state from easy handle to connectdata

- resolving is done for a connection, not for every transfer
- save create/dup/free of a cares channel for each transfer
- check values of setopt calls against a local channel if no
  connection has been attached yet, when needed.

Closes #12198

2 years agoCURLOPT_WRITEFUNCTION.3: clarify what libcurl returns for CURL_WRITEFUNC_ERROR
Daniel Stenberg [Thu, 26 Oct 2023 12:03:47 +0000 (14:03 +0200)] 
CURLOPT_WRITEFUNCTION.3: clarify what libcurl returns for CURL_WRITEFUNC_ERROR

It returns CURLE_WRITE_ERROR. It was not previously stated clearly.

Reported-by: enWILLYado on github
Fixes #12201
Closes #12203

2 years agoautotools: update references to deleted `crypt-auth` option
Viktor Szakats [Wed, 25 Oct 2023 03:33:16 +0000 (03:33 +0000)] 
autotools: update references to deleted `crypt-auth` option

Delete leftovers of the `crypt-auth` `./configure` option and
add the new ones that replaced them.

Follow-up to e92edfbef64448ef461117769881f3ed776dec4e #11490

Reviewed-by: Daniel Stenberg
Closes #12194

2 years agolib: introduce struct easy_poll_set for poll information
Stefan Eissing [Mon, 4 Sep 2023 10:06:07 +0000 (12:06 +0200)] 
lib: introduce struct easy_poll_set for poll information

Connection filter had a `get_select_socks()` method, inspired by the
various `getsocks` functions involved during the lifetime of a
transfer. These, depending on transfer state (CONNECT/DO/DONE/ etc.),
return sockets to monitor and flag if this shall be done for POLLIN
and/or POLLOUT.

Due to this design, sockets and flags could only be added, not
removed. This led to problems in filters like HTTP/2 where flow control
prohibits the sending of data until the peer increases the flow
window. The general transfer loop wants to write, adds POLLOUT, the
socket is writeable but no data can be written.

This leads to cpu busy loops. To prevent that, HTTP/2 did set the
`SEND_HOLD` flag of such a blocked transfer, so the transfer loop cedes
further attempts. This works if only one such filter is involved. If a
HTTP/2 transfer goes through a HTTP/2 proxy, two filters are
setting/clearing this flag and may step on each other's toes.

Connection filters `get_select_socks()` is replaced by
`adjust_pollset()`. They get passed a `struct easy_pollset` that keeps
up to `MAX_SOCKSPEREASYHANDLE` sockets and their `POLLIN|POLLOUT`
flags. This struct is initialized in `multi_getsock()` by calling the
various `getsocks()` implementations based on transfer state, as before.

After protocol handlers/transfer loop have set the sockets and flags
they want, the `easy_pollset` is *always* passed to the filters. Filters
"higher" in the chain are called first, starting at the first
not-yet-connection one. Each filter may add sockets and/or change
flags. When all flags are removed, the socket itself is removed from the
pollset.

Example:

 * transfer wants to send, adds POLLOUT
 * http/2 filter has a flow control block, removes POLLOUT and adds
   POLLIN (it is waiting on a WINDOW_UPDATE from the server)
 * TLS filter is connected and changes nothing
 * h2-proxy filter also has a flow control block on its tunnel stream,
   removes POLLOUT and adds POLLIN also.
 * socket filter is connected and changes nothing
 * The resulting pollset is then mixed together with all other transfers
   and their pollsets, just as before.

Use of `SEND_HOLD` is no longer necessary in the filters.

All filters are adapted for the changed method. The handling in
`multi.c` has been adjusted, but its state handling the the protocol
handlers' `getsocks` method are untouched.

The most affected filters are http/2, ngtcp2, quiche and h2-proxy. TLS
filters needed to be adjusted for the connecting handshake read/write
handling.

No noticeable difference in performance was detected in local scorecard
runs.

Closes #11833

2 years agotests/README: SOCKS tests are not using OpenSSH, it has its own server
Daniel Stenberg [Wed, 25 Oct 2023 05:56:56 +0000 (07:56 +0200)] 
tests/README: SOCKS tests are not using OpenSSH, it has its own server

Follow-up to 04fd67555cc

Closes #12195

2 years agotets: make test documentation more user-friendly
Jacob Hoffman-Andrews [Tue, 24 Oct 2023 21:08:12 +0000 (14:08 -0700)] 
tets: make test documentation more user-friendly

Put the instructions to run tests right at the top of tests/README.md.

Give instructions to read the runtests.1 man page for information
about flags. Delete redundant copy of the flags documentation in the
README.

Add a mention in README.md of the important parallelism flag, to make
test runs go much faster.

Move documentation of output line format into the runtests.1 man page,
and update it with missing flags.

Fix the order of two flags in the man page.

Closes #12193

2 years agocmake: pre-fill rest of detection values for Windows
Viktor Szakats [Thu, 5 Oct 2023 23:38:59 +0000 (23:38 +0000)] 
cmake: pre-fill rest of detection values for Windows

The goal of this patch is to avoid unnecessary feature detection work
when doing Windows builds with CMake. Do this by pre-filling well-known
detection results for Windows and specifically for mingw-w64 and MSVC
compilers. Also limit feature checks to platforms where the results are
actually used. Drop a few redundant ones. And some tidying up.

- pre-fill remaining detection values in Windows CMake builds.

  Based on actual detection results observed in CI runs, preceding
  similar work over libssh2 and matching up values with
  `lib/config-win32.h`.

  This brings down CMake configuration time from 58 to 14 seconds on the
  same local machine.

  On AppVeyor CI this translates to:
  - 128 seconds -> 50 seconds VS2022 MSVC with OpenSSL (per CMake job):
    https://ci.appveyor.com/project/curlorg/curl/builds/48208419/job/4gw66ecrjpy7necb#L296
    https://ci.appveyor.com/project/curlorg/curl/builds/48217440/job/8m4fwrr2fe249uo8#L186
  - 62 seconds -> 16 seconds VS2017 MINGW (per CMake job):
    https://ci.appveyor.com/project/curlorg/curl/builds/48208419/job/s1y8q5ivlcs7ub29?fullLog=true#L290
    https://ci.appveyor.com/project/curlorg/curl/builds/48217440/job/pchpxyjsyc9kl13a?fullLog=true#L194

  The formula is about 1-3 seconds delay for each detection. Almost all
  of these trigger a full compile-link cycle behind the scenes, slow
  even today, both cross and native, mingw-w64 and apparently MSVC too.
  Enabling .map files or other custom build features slows it down
  further. (Similar is expected for autotools configure.)

- stop detecting `idn2.h` if idn2 was deselected.
  autotools does this.

- stop detecting `idn2.h` if idn2 was not found.
  This deviates from autotools. Source code requires both header and
  lib, so this is still correct, but faster.

- limit `ADDRESS_FAMILY` detection to Windows.

- normalize `HAVE_WIN32_WINNT` value to lowercase `0x0a12` format.

- pre-fill `HAVE_WIN32_WINNT`-dependent detection results.
  Saving 4 (slow) feature-detections in most builds: `getaddrinfo`,
  `freeaddrinfo`, `inet_ntop`, `inet_pton`

- fix pre-filled `HAVE_SYS_TIME_H`, `HAVE_SYS_PARAM_H`,
  `HAVE_GETTIMEOFDAY` for mingw-w64.
  Luckily this do not change build results, as `WIN32` took
  priority over `HAVE_GETTIMEOFDAY` with the current source
  code.

- limit `HAVE_CLOCK_GETTIME_MONOTONIC_RAW` and
  `HAVE_CLOCK_GETTIME_MONOTONIC` detections to non-Windows.
  We're not using these in the source code for Windows.

- reduce compiler warning noise in CMake internal logs:
  - fix to include `winsock2.h` before `windows.h`.
    Apply it to autotools test snippets too.
  - delete previous `-D_WINSOCKAPI_=` hack that aimed to fix the above.
  - cleanup `CMake/CurlTests.c` to emit less warnings.

- delete redundant `HAVE_MACRO_SIGSETJMP` feature check.
  It was the same check as `HAVE_SIGSETJMP`.

- delete 'experimental' marking from `CURL_USE_OPENSSL`.

- show CMake version via `CMakeLists.txt`.
  Credit to the `zlib-ng` project for the idea:
  https://github.com/zlib-ng/zlib-ng/blob/61e181c8ae93dbf56040336179c9954078bd1399/CMakeLists.txt#L7

- make `CMake/CurlTests.c` pass `checksrc`.

- `CMake/WindowsCache.cmake` tidy-ups.

- replace `WIN32` guard with `_WIN32` in `CMake/CurlTests.c`.

Closes #12044

2 years agopage-footer: clarify exit code 25
Jay Satiro [Tue, 24 Oct 2023 06:01:12 +0000 (02:01 -0400)] 
page-footer: clarify exit code 25

- Clarify that curl tool exit code 25 means an upload failed to start.

Exit code 25 is equivalent to CURLE_UPLOAD_FAILED (25). Prior to this
change the documentation only mentioned the case of FTP STOR failing.

Reported-by: Emanuele Torre
Ref: https://github.com/curl/curl/blob/curl-8_4_0/docs/libcurl/libcurl-errors.3#L113-L115

Fixes https://github.com/curl/curl/issues/12189
Closes https://github.com/curl/curl/pull/12190

2 years agoscripts/cijobs.pl: adjust for appveyor
Daniel Stenberg [Tue, 24 Oct 2023 07:19:58 +0000 (09:19 +0200)] 
scripts/cijobs.pl: adjust for appveyor

Follow-up to a1d73a6bb

2 years agoOpenSSL: Include SIG and KEM algorithms in verbose
Alex Bozarth [Tue, 3 Oct 2023 22:30:13 +0000 (17:30 -0500)] 
OpenSSL: Include SIG and KEM algorithms in verbose

Currently the verbose output does not include which algorithms are used
for the signature and key exchange when using OpenSSL. Including the
algorithms used will enable better debugging when working on using new
algorithm implementations. Know what algorithms are used has become more
important with the fast growing research into new quantum-safe
algorithms.

This implementation includes a build time check for the OpenSSL version
to use a new function that will be included in OpenSSL 3.2 that was
introduced in openssl/openssl@6866824

Based-on-patch-by: Martin Schmatz <mrt@zurich.ibm.com>
Closes #12030

2 years agohttp2: provide an error callback and failf the message
Daniel Stenberg [Sun, 22 Oct 2023 09:22:08 +0000 (11:22 +0200)] 
http2: provide an error callback and failf the message

Getting nghttp2's error message helps users understand what's going
on. For example when the connection is brought down due a forbidden
header is used - as that header is then not displayed by curl itself.

Example:

  curl: (92) Invalid HTTP header field was received: frame type: 1,
  stream: 1, name: [upgrade], value: [h2,h2c]

Ref: #12172
Closes #12179

2 years agoBINDINGS: add V binding
Turiiya [Mon, 23 Oct 2023 05:17:14 +0000 (07:17 +0200)] 
BINDINGS: add V binding

Closes #12182

2 years agoconfigure: check for the fseeko declaration too
Daniel Stenberg [Thu, 19 Oct 2023 12:55:37 +0000 (14:55 +0200)] 
configure: check for the fseeko declaration too

... and make the code require both symbol and declaration.

This is because for Android, the symbol is always present in the lib at
build-time even when not actually available in run-time.

Assisted-by: Viktor Szakats
Reported-by: 12932 on github
Fixes #12086
Closes #12158

2 years agocmake: fix OpenSSL quic detection in quiche builds
Viktor Szakats [Thu, 19 Oct 2023 21:12:48 +0000 (21:12 +0000)] 
cmake: fix OpenSSL quic detection in quiche builds

An orphan call to `CheckQuicSupportInOpenSSL()` remained after a recent
update when checking QUIC for quiche. Move back QUIC detection to
a function and fixup callers to use that. Also make sure that quiche
gets QUIC from BoringSSL, because it doesn't support other forks at this
time.

Regression from dee310d54261f9a8416e87d50bccfe2cbe404949 #11555

Reported-by: Casey Bodley <cbodley@redhat.com>
Fixes #12160
Closes #12162

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Sun, 22 Oct 2023 08:58:08 +0000 (10:58 +0200)] 
RELEASE-NOTES: synced

bump to 8.5.0 for pending release

2 years agotest3103: add missing quotes around a test tag attribute
Dan Fandrich [Sat, 21 Oct 2023 18:09:12 +0000 (11:09 -0700)] 
test3103: add missing quotes around a test tag attribute

2 years agotool: fix --capath when proxy support is disabled
Loïc Yhuel [Wed, 11 Oct 2023 11:09:23 +0000 (13:09 +0200)] 
tool: fix --capath when proxy support is disabled

After 95e8515ca0, --capath always sets CURLOPT_PROXY_CAPATH, which fails
with CURLE_UNKNOWN_OPTION when proxy support is disabled.

Closes #12089

2 years agoopenldap: move the alloc of ldapconninfo to *connect()
Daniel Stenberg [Fri, 20 Oct 2023 09:15:40 +0000 (11:15 +0200)] 
openldap: move the alloc of ldapconninfo to *connect()

Fixes a minor memory leak on LDAP connection reuse.

Doing the allocation already in *setup_connection() is wrong since that
connect struct might get discarded early when an existing connection is
reused instead.

Closes #12166

2 years agoopenldap: set the callback argument in oldap_do
Daniel Stenberg [Thu, 19 Oct 2023 22:04:28 +0000 (00:04 +0200)] 
openldap: set the callback argument in oldap_do

... to make sure it has the current 'data' pointer and not a stale old
one.

Reported-by: Dan Fandrich
Closes #12166

2 years agognutls: support CURLSSLOPT_NATIVE_CA
Daniel Stenberg [Mon, 16 Oct 2023 12:46:36 +0000 (14:46 +0200)] 
gnutls: support CURLSSLOPT_NATIVE_CA

Remove the CURL_CA_FALLBACK logic. That build option was added to allow
primarily OpenSSL to use the default paths for loading the CA certs. For
GnuTLS it was instead made to load the "system certs", which is
different and not desirable.

The native CA store loading is now asked for with this option.

Follow-up to 7b55279d1d856

Co-authored-by: Jay Satiro
Closes #12137

2 years agoRTSP: improved RTP parser
Stefan Eissing [Sat, 7 Oct 2023 13:13:09 +0000 (15:13 +0200)] 
RTSP: improved RTP parser

- fix HTTP header parsing to report incomplete
  lines it buffers as consumed!
- re-implement the RTP parser for interleave RTP
  messages for robustness. It is now keeping its
  state at the connection
- RTSP protocol handler "readwrite" implementation
  now tracks if the response is before/in/after
  header parsing or "in" a bod by calling
  "Curl_http_readwrite_headers()" itself. This
  allows it to know when non-RTP bytes are "junk"
  or HEADER or BODY.
- tested with #12035 and various small receive
  sizes where current master fails

Closes #12052

2 years agohttp2: header conversion tightening
Stefan Eissing [Thu, 12 Oct 2023 08:15:05 +0000 (10:15 +0200)] 
http2: header conversion tightening

- fold the code to convert dynhds to the nghttp2 structs
  into a dynhds internal method
- saves code duplication
- pacifies compiler analyzers

Closes #12097

2 years agocurl_ntlm_wb: fix elif typo
Daniel Stenberg [Sat, 21 Oct 2023 08:28:08 +0000 (10:28 +0200)] 
curl_ntlm_wb: fix elif typo

Reported-by: Manfred Schwarb
Follow-up to d4314cdf65ae
Bug: https://github.com/curl/curl/commit/d4314cdf65aee295db627016934bd9eb621ab077#r130551295

2 years agotest1683: remove commented-out check alternatives
Dan Fandrich [Fri, 20 Oct 2023 22:32:21 +0000 (15:32 -0700)] 
test1683: remove commented-out check alternatives

Python precheck/postcheck alternatives were included but commented out.
Since these are not used and perl is guaranteed to be available to run
the perl versions anyway, the Python ones are removed.

2 years agohostip: show the list of IPs when resolving is done
Daniel Stenberg [Tue, 17 Oct 2023 15:01:52 +0000 (17:01 +0200)] 
hostip: show the list of IPs when resolving is done

Getting 'curl.se' today then gets this verbose output which might help
debugging connectivity related matters.

* Host curl.se:80 was resolved.
* IPv6: 2a04:4e42::347, 2a04:4e42:200::347, 2a04:4e42:400::347,
  2a04:4e42:600::347, 2a04:4e42:800::347, 2a04:4e42:a00::347,
  2a04:4e42:c00::347, 2a04:4e42:e00::347
* IPv4: 151.101.193.91, 151.101.1.91, 151.101.65.91, 151.101.129.91

Co-authored-by: Jay Satiro
Closes #12145

2 years agodocs: fix function typo in curl_easy_option_next.3
rilysh [Fri, 20 Oct 2023 18:57:12 +0000 (14:57 -0400)] 
docs: fix function typo in curl_easy_option_next.3

Closes #12170

2 years agovssh: remove the #ifdef for Curl_ssh_init, use empty macro
Daniel Stenberg [Fri, 20 Oct 2023 16:19:55 +0000 (18:19 +0200)] 
vssh: remove the #ifdef for Curl_ssh_init, use empty macro

In the same style as other init calls

2 years agoeasy: remove duplicate wolfSSH init call
Daniel Stenberg [Fri, 20 Oct 2023 15:59:46 +0000 (17:59 +0200)] 
easy: remove duplicate wolfSSH init call

It is already done in Curl_ssh_init() where it belongs.

Closes #12168

2 years agosocks: make SOCKS5 use the CURLOPT_IPRESOLVE choice
Daniel Stenberg [Fri, 20 Oct 2023 08:20:12 +0000 (10:20 +0200)] 
socks: make SOCKS5 use the CURLOPT_IPRESOLVE choice

Fixes #11949
Reported-by: Ammar Faizi
Closes #12163

2 years agourldata: move the 'internal' boolean to the state struct
Daniel Stenberg [Fri, 20 Oct 2023 09:33:08 +0000 (11:33 +0200)] 
urldata: move the 'internal' boolean to the state struct

... where all the other state bits for the easy handles live.

Closes #12165

2 years agourl: don't touch the multi handle when closing internal handles
Daniel Stenberg [Thu, 19 Oct 2023 07:24:27 +0000 (09:24 +0200)] 
url: don't touch the multi handle when closing internal handles

Reported-by: Maksymilian Arciemowicz
Closes #12165

2 years agogetenv: PlayStation doesn't have getenv()
Faraz Fallahi [Tue, 17 Oct 2023 03:37:22 +0000 (20:37 -0700)] 
getenv: PlayStation doesn't have getenv()

Closes #12140

2 years agotransfer: only reset the FTP wildcard engine in CLEAR state
Daniel Stenberg [Thu, 19 Oct 2023 11:10:38 +0000 (13:10 +0200)] 
transfer: only reset the FTP wildcard engine in CLEAR state

To avoid the state machine to start over and redownload all the files
*again*.

Reported-by: lkordos on github
Regression from 843b3baa3e3cb228 (shipped in 8.1.0)
Bisect-by: Dan Fandrich
Fixes #11775
Closes #12156

2 years agoGHA: move mod_h2 version in CI to v2.0.25
Stefan Eissing [Thu, 19 Oct 2023 11:29:35 +0000 (13:29 +0200)] 
GHA: move mod_h2 version in CI to v2.0.25

Closes #12157

2 years agontlm_wb: use pipe instead of socketpair when possible
Daniel Stenberg [Wed, 18 Oct 2023 07:10:30 +0000 (09:10 +0200)] 
ntlm_wb: use pipe instead of socketpair when possible

Closes #12149

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 18 Oct 2023 07:22:07 +0000 (09:22 +0200)] 
RELEASE-NOTES: synced

2 years agoasyn-thread: use pipe instead of socketpair for IPC when available
Daniel Stenberg [Tue, 17 Oct 2023 15:56:09 +0000 (17:56 +0200)] 
asyn-thread: use pipe instead of socketpair for IPC when available

If pipe() is present. Less overhead.

Helped-by: Viktor Szakats
Closes #12146

2 years agotests: Fix Windows test helper tool search & use it for handle64 origin/master
Dan Fandrich [Fri, 13 Oct 2023 18:46:39 +0000 (11:46 -0700)] 
tests: Fix Windows test helper tool search & use it for handle64

The checkcmd() and checktestcmd() functions would not have worked on
Windows due to hard-coding the UNIX PATH separator character and not
adding .exe file extension. This meant that tools like stunnel, valgrind
and nghttpx would not have been found and used on Windows, and
inspection of previous test runs show none of those being found in pure
Windows CI builds.

With this fixed, they can be used to detect the handle64.exe program
before attempting to use it. When handle64.exe was called
unconditionally without it existing, it caused perl to abort the test
run with the error

    The running command stopped because the preference variable
    "ErrorActionPreference" or common parameter is set to Stop:
    sh: handle64.exe: command not found

Closes #12115

2 years agomulti: use pipe instead of socketpair to *wakeup()
Daniel Stenberg [Tue, 17 Oct 2023 06:28:55 +0000 (08:28 +0200)] 
multi: use pipe instead of socketpair to *wakeup()

If pipe() is present. Less overhead.

Closes #12142

2 years agobuild: fix 'threadsafe' feature detection for older gcc
Jay Satiro [Sun, 15 Oct 2023 01:55:42 +0000 (21:55 -0400)] 
build: fix 'threadsafe' feature detection for older gcc

- Add 'threadsafe' to the feature list shown during build if POSIX
  threads are being used.

This is a follow-up to 5adb6000 which added support for building a
thread-safe libcurl with older versions of gcc where atomic is not
available but pthread is.

Reported-by: Dan Fandrich
Co-authored-by: Dan Fandrich
Fixes https://github.com/curl/curl/issues/12125
Closes https://github.com/curl/curl/pull/12127

2 years agotest729: verify socks4a with excessive proxy user name length
Daniel Stenberg [Fri, 13 Oct 2023 12:16:47 +0000 (14:16 +0200)] 
test729: verify socks4a with excessive proxy user name length