]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
17 months agoftp: add tracing support
Stefan Eissing [Fri, 10 May 2024 10:59:12 +0000 (12:59 +0200)] 
ftp: add tracing support

- add `Curl_trc_feat_ftp` for tracing via trace config
- add macro CURL_TRC_FTP(data, fmt, ...)
- replace DEBUGF(infof()) statements in ftp.c by CURL_TRC_FTP()
- always trace FTP connection state

Closes #13580

17 months agohttp: remove redundant check
Daniel Stenberg [Fri, 10 May 2024 12:33:34 +0000 (14:33 +0200)] 
http: remove redundant check

Spotted by CodeSonar

Closes #13582

17 months agoldap: fix unused variables (seen on OmniOS)
Viktor Szakats [Fri, 10 May 2024 15:03:26 +0000 (17:03 +0200)] 
ldap: fix unused variables (seen on OmniOS)

```
../../lib/ldap.c: In function 'ldap_do':
  ../../lib/ldap.c:380:11: error: unused variable 'ldap_ca' [-Werror=unused-variable]
    380 |     char *ldap_ca = conn->ssl_config.CAfile;
        |           ^~~~~~~
  ../../lib/ldap.c:379:9: error: unused variable 'ldap_option' [-Werror=unused-variable]
    379 |     int ldap_option;
        |         ^~~~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/9033564377/job/24824192730#step:3:6059

Ref: #13583
Closes #13588

17 months agourl: make parse_login_details use memdup0
Daniel Stenberg [Fri, 10 May 2024 13:32:57 +0000 (15:32 +0200)] 
url: make parse_login_details use memdup0

Also make the user and password arguments mandatory, since all code
paths in libcurl used them anyway.

Adapted unit test case 1620 to the new rules.

Closes #13584

17 months agodigest: replace strcpy for empty string with simple assignment
Orgad Shaneh [Fri, 10 May 2024 15:08:25 +0000 (18:08 +0300)] 
digest: replace strcpy for empty string with simple assignment

Closes #13586

17 months agoautotools: fix `HAVE_IOCTLSOCKET_FIONBIO` test for gcc 14
Viktor Szakats [Fri, 10 May 2024 16:01:22 +0000 (18:01 +0200)] 
autotools: fix `HAVE_IOCTLSOCKET_FIONBIO` test for gcc 14

```
conftest.c:152:41: error: passing argument 3 of 'ioctlsocket' from incompatible pointer type [-Wincompatible-pointer-types]
  152 |         if(0 != ioctlsocket(0, FIONBIO, &flags))
      |                                         ^~~~~~
      |                                         |
      |                                         int *
```

Reported-by: LigH
Fixes #13579
Closes #13587

17 months agoCI: ignore test 286 on Appveyor gcc 7 build
Viktor Szakats [Fri, 10 May 2024 07:49:57 +0000 (09:49 +0200)] 
CI: ignore test 286 on Appveyor gcc 7 build

Disabled earlier for gcc 9 builds. gcc 7 uses the same runner and
prone to similar intermittent failures.

Follow-up to f1e05a6e6e7225fa09952abb2c935ae1abe44f45 #12106 #12040
Closes #13575

17 months agocf-socket: don't try getting local IP without socket
Daniel Stenberg [Fri, 10 May 2024 08:52:58 +0000 (10:52 +0200)] 
cf-socket: don't try getting local IP without socket

In cf_tcp_connect(), it might fail and not get a socket assigned to
ctx->sock but set_local_ip() is still called which would make
getsockname() get invoked with a negative file desriptor and fail.

By adding this check, set_local_ip() will now instead blank out the
fields correctly.

Spotted by CodeSonar

Closes #13577

17 months agotool_getparam: remove two redundant conditions
Daniel Stenberg [Fri, 10 May 2024 08:24:15 +0000 (10:24 +0200)] 
tool_getparam: remove two redundant conditions

When getstr() does not return error, it returns a valid pointer.

Spotted by CodeSonar

Closes #13576

17 months agoquiche: trust its timeout handling
Stefan Eissing [Fri, 10 May 2024 12:01:20 +0000 (14:01 +0200)] 
quiche: trust its timeout handling

- set the idle timeout transport parameter
  in milliseconds as documented by quiche
- do not calculate the idle timeout, rely on
  quiche handling it

Closes #13581

17 months agodmaketgz: accept a SOURCE_DATE_EPOCH as an second argument
Daniel Stenberg [Fri, 10 May 2024 06:50:47 +0000 (08:50 +0200)] 
dmaketgz: accept a SOURCE_DATE_EPOCH as an second argument

to make it easier to reproduce a tarball

Closes #13573

17 months agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 10 May 2024 07:33:26 +0000 (09:33 +0200)] 
RELEASE-NOTES: synced

17 months agoh3/ngtcp2: improve error handling
Stefan Eissing [Wed, 8 May 2024 11:44:35 +0000 (13:44 +0200)] 
h3/ngtcp2: improve error handling

- identify ngtcp2 and nghttp3 error codes that are fatal
- close quic connection on fatal errors
- refuse further filter operations once connection is closed
- confusion about the nghttp3 API. We should close the QUIC stream on
  cancel and not use the nghttp3 calls intended to be invoked when the
  QUIC stream was closed by the peer.

Closes #13562

17 months agodocs: fix some CURLINFO examples
Jay Satiro [Wed, 8 May 2024 07:37:12 +0000 (03:37 -0400)] 
docs: fix some CURLINFO examples

- improve getinfo result check for example sections:
  CURLINFO_ACTIVESOCKET, CURLINFO_LASTSOCKET, CURLINFO_SSL_VERIFYRESULT,
  CURLINFO_PROXY_SSL_VERIFYRESULT

- fix getinfo result check for example sections:
  CURLINFO_NUM_CONNECTS, CURLINFO_OS_ERRNO

- fix verify result check for example sections:
  CURLINFO_PROXY_SSL_VERIFYRESULT

Bug: https://github.com/curl/curl/discussions/13557#discussion-6625507
Reported-by: farazrbx@users.noreply.github.com
Closes https://github.com/curl/curl/pull/13559

18 months agoKNOWN_BUGS: gssapi library name + version is missing in curl_version_info()
Daniel Stenberg [Thu, 9 May 2024 09:24:07 +0000 (11:24 +0200)] 
KNOWN_BUGS: gssapi library name + version is missing in curl_version_info()

Closes #13492
Closes #13570

18 months agokrb5: use dynbuf
Daniel Stenberg [Wed, 8 May 2024 13:20:23 +0000 (15:20 +0200)] 
krb5: use dynbuf

Closes #13568

18 months agomanagen: fix the option sort order
Daniel Stenberg [Wed, 8 May 2024 21:50:55 +0000 (23:50 +0200)] 
managen: fix the option sort order

... it used to strip off the .d file extension to sort correctly but
ever since the extension changed to .md the operation failed and the
sort got wrong.

Follow-up to 2494b8dd5175cee7f2e

Closes #13567

18 months agoGHA: repair the linux-old job
Stefan Eissing [Wed, 8 May 2024 13:39:06 +0000 (15:39 +0200)] 
GHA: repair the linux-old job

package libc6_2.28-10+deb10u2_amd64.deb changed to
libc6_2.28-10+deb10u3_amd64.deb

Closes #13564

18 months agoappveyor: make gcc 6 mingw64 job build-only
Viktor Szakats [Wed, 8 May 2024 17:43:07 +0000 (19:43 +0200)] 
appveyor: make gcc 6 mingw64 job build-only

This job has proven to be the flakiest of all, and it's also the oldest
Windows runner we had tests running on: 'Visual Studio 2015', that is
running on Windows Server 2012 R2:
  https://www.appveyor.com/docs/windows-images-software/

Turn off tests on this job to help stabilizing CI runs.

This was also one of the slowest running job amongst the AppVeyor CI ones.

Flakiness data:
  https://testclutch.curl.se/static/reports/summary.html
Entries:
  Appveyor / CMake, mingw-w64, gcc 6, Debug, x86, Schannel, Static, no-unity (curl) [current]
  Appveyor / CMake, mingw-w64, gcc 6, Debug, x86, Schannel, Static (curl) [former]

Closes #13566

18 months agounit2604: use alloc instead of overlong string const
Stefan Eissing [Wed, 8 May 2024 13:32:28 +0000 (15:32 +0200)] 
unit2604: use alloc instead of overlong string const

Closes #13563

18 months agobufq: remove duplicate word in comment
Daniel Gustafsson [Wed, 8 May 2024 17:12:03 +0000 (19:12 +0200)] 
bufq: remove duplicate word in comment

Inspired by 13552.

Closes: #13554
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
18 months agolib/cf-h1-proxy: silence compiler warnings (gcc 14)
Viktor Szakats [Tue, 7 May 2024 15:50:42 +0000 (17:50 +0200)] 
lib/cf-h1-proxy: silence compiler warnings (gcc 14)

They came up ealier with gcc 12 (Windows), but apparently gcc 14 is
still reporting them, also under Linux.

```
/home/runner/work/curl-for-win/curl-for-win/curl/lib/cf-h1-proxy.c: In function 'cf_h1_proxy_close':
/home/runner/work/curl-for-win/curl-for-win/curl/lib/cf-h1-proxy.c:1060:17: warning: null pointer dereference [-Wnull-dereference]
 1060 |   cf->connected = FALSE;
/home/runner/work/curl-for-win/curl-for-win/curl/lib/cf-h1-proxy.c:1061:8: warning: null pointer dereference [-Wnull-dereference]
 1061 |   if(cf->ctx) {
      |      ~~^~~~~
In function 'tunnel_free',
    inlined from 'cf_h1_proxy_destroy' at /home/runner/work/curl-for-win/curl-for-win/curl/lib/cf-h1-proxy.c:1053:3:
/home/runner/work/curl-for-win/curl-for-win/curl/lib/cf-h1-proxy.c:198:27: warning: null pointer dereference [-Wnull-dereference]
  198 |   struct h1_tunnel_state *ts = cf->ctx;
      |                           ^~
```
Ref: https://github.com/curl/curl-for-win/actions/runs/8985369476/job/24679219528#step:3:6320

Fixes #13237
Closes #13555

18 months agombedtls: support TLS 1.3
MAntoniak [Thu, 8 Feb 2024 20:12:49 +0000 (21:12 +0100)] 
mbedtls: support TLS 1.3

Closes #13539

18 months agoversion: use msnprintf instead of strncpy
Daniel Stenberg [Wed, 8 May 2024 06:41:28 +0000 (08:41 +0200)] 
version: use msnprintf instead of strncpy

- to ensure a terminating null byte
- to avoid zero-padding the target

debug code only

Closes #13549

18 months agocurl_path: make Curl_get_pathname use dynbuf
Daniel Stenberg [Tue, 7 May 2024 12:28:29 +0000 (14:28 +0200)] 
curl_path: make Curl_get_pathname use dynbuf

... instead of malloc and memcpy

- unit test 2604 verifies Curl_get_pathname()

Closes #13550

18 months agolib: make protocol handlers store scheme name lowercase
Daniel Stenberg [Tue, 7 May 2024 14:55:23 +0000 (16:55 +0200)] 
lib: make protocol handlers store scheme name lowercase

- saves a lowercase operation when the "[scheme]_proxy" name is
  generated
- appears less "shouting"
- update test 970, 972, 1438 and 1536

Closes #13553

18 months agolib: remove two instances of "only only" messages
Daniel Stenberg [Tue, 7 May 2024 14:25:37 +0000 (16:25 +0200)] 
lib: remove two instances of "only only" messages

Fixes #13551
Reported-by: Lucas Nussbaum
Closes #13552

18 months agoasyn-thread: fix curl_global_cleanup crash in Windows
Pavel P [Thu, 2 May 2024 04:15:44 +0000 (06:15 +0200)] 
asyn-thread: fix curl_global_cleanup crash in Windows

- Make sure that asynchronous resolves handled by Winsock are stopped
  before WSACleanup is called.

This is implemented by ensuring that when Curl_resolver_kill is called
(eg via multi_done) it will cancel the Winsock asynchronous resolve and
wait for the cancellation to complete. Winsock runs the asynchronous
completion routine immediately when a resolve is canceled.

Prior to this change it was possible that during curl_global_cleanup
"a DNS resolver thread created by GetAddrInfoExW did not terminate yet,
however curl is already shutting down, deinitializing Winsock with
WSACleanup() leading to an access violation."

Background:

If libcurl is built with the asynchronous threaded resolver option for
Windows then it resolves in one of two ways. For Windows 8.1 and later,
libcurl resolves by using the Winsock asynchronous resolver which does
its own thread management. For older versions of Windows, libcurl
resolves by creating a separate thread that calls getaddrinfo. This
change only affects the former and it's already handled for the latter.

Reported-by: Ch40zz@users.noreply.github.com
Fixes https://github.com/curl/curl/issues/13509
Closes https://github.com/curl/curl/pull/13518

18 months agoasyn-thread: fix Curl_thread_create result check
Jay Satiro [Mon, 6 May 2024 18:49:43 +0000 (14:49 -0400)] 
asyn-thread: fix Curl_thread_create result check

- Compare to curl_thread_t_null instead of 0 for error.

Currently for both supported thread libraries (pthreads and Windows)
curl_thread_t_null is defined as 0. However, the pattern throughout the
code is to check against curl_thread_t_null and not 0 since for
posterity some thread library may not use 0 for error.

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

18 months agocurl_multibyte: remove access() function wrapper for Windows
Jay Satiro [Fri, 3 May 2024 23:31:00 +0000 (19:31 -0400)] 
curl_multibyte: remove access() function wrapper for Windows

- Remove curlx_win32_access() which was a wrapper to use access() in
  Windows.

This is a follow-up to 602fc213, one of two commits which removed
access() calls from the codebase and banned use of the function.

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

18 months agotls: Remove EXAMPLEs from deprecated options
Daniel Gustafsson [Mon, 6 May 2024 18:55:27 +0000 (20:55 +0200)] 
tls: Remove EXAMPLEs from deprecated options

CURLOPT_EGDSOCKET and CURLOPT_RANDOM_FILE are both completely dead
so remove their example sections since the code there is useless.
There is still a way to inject a random file for OpenSSL older than
1.1.0 but it's not what the example showed (and it's not even done
with this option) so we refrain from documenting it here.

Closes: #13540
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
18 months agotests: Only require EXAMPLE for non-deprecated options
Daniel Gustafsson [Mon, 6 May 2024 18:55:00 +0000 (20:55 +0200)] 
tests: Only require EXAMPLE for non-deprecated options

Manpages which document deprecated CURLOPT_ or CURLINFO_ are not
required to have an EXAMPLE section since they might effectively
be dead no-ops which we don't want to trick users into believing
they can use by copying example code.

Closes: #13540
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
18 months agoEXPERIMENTAL: add graduation requirements for each feature
Daniel Stenberg [Mon, 6 May 2024 12:02:31 +0000 (14:02 +0200)] 
EXPERIMENTAL: add graduation requirements for each feature

Starting now, experimental features should have a set of documentated
requirements of what is needed for the feature to graduate.

This adds requirements to all existing experiments.

Closes #13541

18 months agomisc: fix typos, quoting and spelling
Ivan [Mon, 6 May 2024 08:35:53 +0000 (10:35 +0200)] 
misc: fix typos, quoting and spelling

Fix wording of comments, and misquotings where `' is markdown parsed
where it shouldn't be, and remove a misspelled preprocessor comment
which really isn't needed (and removing it makes it match surrounding
code better).

Closes: #13538
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
18 months agotests: Mark tftpd timer function as noreturn
Daniel Gustafsson [Mon, 6 May 2024 07:51:16 +0000 (09:51 +0200)] 
tests: Mark tftpd timer function as noreturn

This avoids the below compiler warning:

tftpd.c:280:1: warning: function 'timer' could be declared with
    attribute 'noreturn' [-Wmissing-noreturn]

Closes: #13534
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
18 months agodoh: Remove unused function prototype
Daniel Gustafsson [Mon, 6 May 2024 07:50:37 +0000 (09:50 +0200)] 
doh: Remove unused function prototype

Closes: #13536
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
18 months agodoh: cleanups in ECH related functions
Daniel Stenberg [Fri, 3 May 2024 13:06:54 +0000 (15:06 +0200)] 
doh: cleanups in ECH related functions

- make local_decode_rdata_name use dynbuf instead of calloc + memcpy
- avoid extra memdup in local_decode_rdata_alpn
- no need to if() before free()
- use memdup instead of calloc + memcpy in Curl_doh_decode_httpsrr

Reviewed-by: Stephen Farrell
Closes #13526

18 months agolibssh2: delete redundant feature guard
Viktor Szakats [Sun, 5 May 2024 09:49:11 +0000 (11:49 +0200)] 
libssh2: delete redundant feature guard

Delete `HAVE_LIBSSH2_VERSION` (equivalent to
`LIBSSH2_VERSION_NUM` > 0x010100) guard surrounding
a `LIBSSH2_VERSION_NUM` > 0x010B00 one.

Reviewed-by: Daniel Gustafsson
Closes #13537

18 months agotool_cfgable: free {proxy_}cipher13_list on exit
Jan Venekamp [Sat, 4 May 2024 01:05:51 +0000 (03:05 +0200)] 
tool_cfgable: free {proxy_}cipher13_list on exit

Author: Jan Venekamp
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Closes: #13531
18 months agodoh: Fix typo in comment
RainRat [Sat, 4 May 2024 09:52:43 +0000 (11:52 +0200)] 
doh: Fix typo in comment

Closes: #13504
Author: RainRat on Github
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
18 months agodynbuf: Fix returncode on memory error
Christian Schmitz [Sat, 4 May 2024 09:44:02 +0000 (11:44 +0200)] 
dynbuf: Fix returncode on memory error

Curl_dyn_vaddf should return a proper error code in case allocating
memory failed.

Closes: #13533
Author: Christian Schmitz <support@monkeybreadsoftware.de>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
18 months agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 3 May 2024 12:39:39 +0000 (14:39 +0200)] 
RELEASE-NOTES: synced

18 months agobearssl: use common code for cipher suite lookup
Jan Venekamp [Wed, 24 Apr 2024 15:37:14 +0000 (17:37 +0200)] 
bearssl: use common code for cipher suite lookup

Take advantage of the Curl_cipher_suite_walk_str() and
Curl_cipher_suite_get_str() functions introduced in commit fba9afeb.

This also fixes CURLOPT_SSL_CIPHER_LIST not working at all for bearssl
due to commit ff74cef5.

Closes #13464

18 months agocurl.h: change CURL_SSLVERSION_* from enum to defines
Daniel Stenberg [Tue, 30 Apr 2024 21:11:59 +0000 (23:11 +0200)] 
curl.h: change CURL_SSLVERSION_* from enum to defines

C++20 and later compilers emit a deprecation warning if values from two
different enums are combined with a bitwise operation the way the
CURL_SSLVERSION_* values were previously created.

Reported-by: Michael Kaufmann
Fixes #13510
Closes #13511

18 months agoconfigure: error on missing perl if docs or manual is enabled
Daniel Stenberg [Wed, 1 May 2024 08:48:16 +0000 (10:48 +0200)] 
configure: error on missing perl if docs or manual is enabled

Fixes #13508
Reported-by: Harmen Stoppels
Closes #13514

18 months agotool_cb_rea: limit rate unpause for -T . uploads
Daniel Stenberg [Tue, 30 Apr 2024 09:07:28 +0000 (11:07 +0200)] 
tool_cb_rea: limit rate unpause for -T . uploads

To avoid getting stuck in a busy-loop when nothing is read from stdin,
this function now checks the call rate and might enforce a short sleep
when called repeatedly without uploading anything. It is a crude
work-around to avoid a 100% busy CPU.

Reported-by: magisterquis on hackerone
Fixes #13174
Closes #13506

18 months agoappveyor: enable websockets for VS2017 jobs
Viktor Szakats [Wed, 1 May 2024 08:20:58 +0000 (10:20 +0200)] 
appveyor: enable websockets for VS2017 jobs

Follow-up to eb4fe6c6340c3d5b0c347c6e30be004d4f9117d7 #13232
Closes #13513

18 months agoif2ip: make the buf_size arg a size_t
Daniel Stenberg [Tue, 30 Apr 2024 07:11:00 +0000 (09:11 +0200)] 
if2ip: make the buf_size arg a size_t

sizes should be size_t

Ref: #13489
Closes #13505

18 months agocf-https-connect: use timeouts as unsigned ints
Daniel Stenberg [Tue, 30 Apr 2024 06:56:53 +0000 (08:56 +0200)] 
cf-https-connect: use timeouts as unsigned ints

To match the type used in 'set.happy_eyeballs_timeout'.

Ref: #13489
Closes #13503

18 months agohash: change 'slots' to size_t from int
Daniel Stenberg [Tue, 30 Apr 2024 06:46:54 +0000 (08:46 +0200)] 
hash: change 'slots' to size_t from int

- an unsigned type makes more sense
- size_t seems suitable
- on 64 bit args, the struct alignment makes the new Curl_hash remain
  the same size

Closes #13502

18 months agolibssh2: replace `access()` with `stat()`
Viktor Szakats [Mon, 29 Apr 2024 11:49:03 +0000 (13:49 +0200)] 
libssh2: replace `access()` with `stat()`

Prefer `stat()` to verify the presence of key files.

This drops the last uses of `access()` in the codebase, which was
reported to cause issues in some cases.

Also add `access()` to the list of banned functions in checksrc.

Ref: https://github.com/curl/curl/pull/13412#issuecomment-2065505415
Ref: https://github.com/curl/curl/pull/13482#issuecomment-2078980522
Ref: #13497
Co-authored-by: Jay Satiro
Closes #13498

18 months agomulti: remove useless assignment
Daniel Stenberg [Mon, 29 Apr 2024 14:32:46 +0000 (16:32 +0200)] 
multi: remove useless assignment

Spotted by CodeSonar

Closes #13500

18 months agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 30 Apr 2024 07:08:57 +0000 (09:08 +0200)] 
RELEASE-NOTES: synced

18 months agocmake: FindNGHTTP2 add static lib name to find_library call
fuzzard [Mon, 29 Apr 2024 01:27:39 +0000 (11:27 +1000)] 
cmake: FindNGHTTP2 add static lib name to find_library call

Add the static library name, nghttp2_static as a name to search.

This provides cmake parity with the winbuild Makefile.vc allowing
the cmake build to find and allow the link to static nghttp2 library.

18 months agoDISTROS: add patch and issues link for curl-for-win
Viktor Szakats [Mon, 29 Apr 2024 12:08:38 +0000 (14:08 +0200)] 
DISTROS: add patch and issues link for curl-for-win

curl-for-win sometimes includes curl patches that were already merged in
master, but not yet part of a stable release.

Also include the Issues link. Build-specific issues are handled there.

Ref: #13493
Closes #13499

18 months agomime: avoid using access()
Daniel Stenberg [Mon, 29 Apr 2024 09:50:56 +0000 (11:50 +0200)] 
mime: avoid using access()

If stat() fails, there is no point in calling access()

Also: return error immediately if the stat() fails.

Ref: #13482
Closes #13497

18 months agotests: add SNI and peer name checks
Stefan Eissing [Fri, 26 Apr 2024 12:13:23 +0000 (14:13 +0200)] 
tests: add SNI and peer name checks

- connect to DNS names with trailing dot
- connect to DNS names with double trailing dot
- rustls, always give `peer->hostname` and let it
  figure out SNI itself
- add SNI tests for ip address and localhost
- document in code and TODO that QUIC with ngtcp2+wolfssl
  does not do proper peer verification of the certificate
- mbedtls, skip tests with ip address verification as not
  supported by the library

Closes #13486

18 months agocurl_getdate.md: document two-digit year handling
Daniel Stenberg [Sun, 28 Apr 2024 21:07:49 +0000 (23:07 +0200)] 
curl_getdate.md: document two-digit year handling

Mentioned-by: Paul Gilmartin
Ref: https://curl.se/mail/archive-2024-04/0014.html
Closes #13494

18 months agocmake: add `BUILD_EXAMPLES` option to build examples
Viktor Szakats [Sat, 27 Apr 2024 22:11:38 +0000 (00:11 +0200)] 
cmake: add `BUILD_EXAMPLES` option to build examples

You can enable it with `-DBUILD_EXAMPLES=ON`.

To match autotools' `make examples` feature.
Windows (static) builds not tested.

Also enable examples in a pair of CI jobs.

Apply related updates to the macOS CI workflow:
- drop unused `CXX` envs.
- drop no longer needed `-Wno-error=undef -Wno-error=conversion` flags.
- pass `-Wno-deprecated-declarations` to GCC too (for `BUILD_EXAMPLES`).
- document why `-Wno-deprecated-declarations` is necessary.

Closes #13491

18 months agohttp3: quiche+ngtcp2 improvements
Stefan Eissing [Thu, 25 Apr 2024 11:12:18 +0000 (13:12 +0200)] 
http3: quiche+ngtcp2 improvements

- quiche: error transfers that try to receive on a closed
  or draining connection
- ngtcp2: use callback for extending max bidi streams. This
  allows more precise calculation of MAX_CONCURRENT as we
  only can start a new stream when the server acknowledges
  the close - not when we locally have closed it.
- remove a fprintf() from h2-download client to avoid excess
  log files on tests timing out.

Closes #13475

18 months agovtls: TLS session storage overhaul
Stefan Eissing [Fri, 26 Apr 2024 08:11:51 +0000 (10:11 +0200)] 
vtls: TLS session storage overhaul

- add session with destructor callback
- remove vtls `session_free` method
- let `Curl_ssl_addsessionid()` take ownership
  of session object, freeing it also on failures
- change tls backend use
- test_17, add tests for SSL session resumption

Closes #13386

18 months agomulti: multi_wait improvements
Stefan Eissing [Wed, 20 Mar 2024 07:08:43 +0000 (08:08 +0100)] 
multi: multi_wait improvements

 - only call `multi_getsock()` once for all transfers
 - realloc pollset array on demand
 - fold repeated sockets

Closes #13150

18 months agoci: remove microsoft-prod.list
Philip H. [Thu, 25 Apr 2024 09:46:41 +0000 (09:46 +0000)] 
ci: remove microsoft-prod.list

This is added by default, and it is often broken, but we don't need
anything from it.

Closes #13473

18 months agocurl_setup.h: detect 'inline' support
Evgeny Grin [Thu, 11 Apr 2024 21:44:38 +0000 (23:44 +0200)] 
curl_setup.h: detect 'inline' support

Closes #13355

18 months agomulti: avoid memory-leak risk
Daniel Stenberg [Thu, 25 Apr 2024 07:52:51 +0000 (09:52 +0200)] 
multi: avoid memory-leak risk

'newurl' is allocated in some conditions and used in a few scenarios,
but there were theoretical combinations in which it would not get freed.
Move the free to happen unconditionally. Never triggered by tests, but
spotted by Coverity.

Closes #13471

18 months agosendf: Curl_cwriter_write: remove comment disallowing zero length writes
Johann Sebastian Schicho [Thu, 25 Apr 2024 11:53:39 +0000 (13:53 +0200)] 
sendf: Curl_cwriter_write: remove comment disallowing zero length writes

They are needed to pass CLIENTWRITE_EOS.

Closes #13477

18 months agoCI: macos fixes for new ARM GHA images
Stefan Eissing [Thu, 25 Apr 2024 15:35:50 +0000 (17:35 +0200)] 
CI: macos fixes for new ARM GHA images

- based on #13478 with additions from #13476
- make homebrew install path flexible
- fix OpenSSL pkgconfig files libdir
- add path to --with-libssh2 target
- disable gcc securetransport due to linker
  errors (missing symbols), probably because
  the os version is no longer low enough

Assisted-by: Viktor Szakats
Closes #13479

18 months agocontent_encoding: ignore duplicate chunked encoding
Stefan Eissing [Wed, 24 Apr 2024 09:11:11 +0000 (11:11 +0200)] 
content_encoding: ignore duplicate chunked encoding

- ignore duplicate "chunked" transfer-encodings from
  a server to accomodate for broken implementations
- add test1482 and test1483

Reported-by: Mel Zuser
Fixes #13451
Closes #13461

18 months agotool: move tool_ftruncate64 to tool_util.c
Daniel Stenberg [Wed, 24 Apr 2024 08:35:45 +0000 (10:35 +0200)] 
tool: move tool_ftruncate64 to tool_util.c

... and the prototype to tool_setup.h, to make them both available more
widely and accurately.

Follow-up to 00bef95946d3511

Fixes #13458
Closes #13459

18 months agolib: silence `-Wsign-conversion` in base64, strcase, mprintf
Viktor Szakats [Wed, 24 Apr 2024 17:34:12 +0000 (19:34 +0200)] 
lib: silence `-Wsign-conversion` in base64, strcase, mprintf

Closes #13467

18 months agoCI: retain failure code after `./configure` with Circle CI
Viktor Szakats [Wed, 24 Apr 2024 19:07:53 +0000 (21:07 +0200)] 
CI: retain failure code after `./configure` with Circle CI

Suggested-by: Dan Fandrich
Follow-up to 43299e93c06b96fea8a8dc9b1c2e49c82bc21801 #13462
Follow-up to d7332e3e46c3ef401b34e6a1a129eb4dd846c452 #12635
Closes #13468

18 months agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 24 Apr 2024 12:34:39 +0000 (14:34 +0200)] 
RELEASE-NOTES: synced

18 months agombedTLS: implement CURLOPT_SSL_CIPHER_LIST option
Jan Venekamp [Tue, 23 Apr 2024 15:42:45 +0000 (17:42 +0200)] 
mbedTLS: implement CURLOPT_SSL_CIPHER_LIST option

Use a lookup list to set the cipher suites, allowing the
ciphers to be set by either openssl or IANA names.

To keep the binary size of the lookup list down we compress
each entry in the cipher list down to 2 + 6 bytes using the
C preprocessor.

Closes #13442

18 months agoCI: show more failed `config.log` on Circle CI
Viktor Szakats [Wed, 24 Apr 2024 09:15:58 +0000 (11:15 +0200)] 
CI: show more failed `config.log` on Circle CI

Show last 1000 lines of `config.log` if `./configure` fails. This was
already done for one job, this patch extends it to all.

Ref: #13438
Closes #13462

18 months agotelnet: check return code from fileno()
Daniel Stenberg [Wed, 24 Apr 2024 06:07:34 +0000 (08:07 +0200)] 
telnet: check return code from fileno()

and return error if necessary

Spotted by CodeSonar

Closes #13457

18 months agotls: fix SecureTransport + BearSSL cmake unity builds
Viktor Szakats [Tue, 23 Apr 2024 14:34:39 +0000 (16:34 +0200)] 
tls: fix SecureTransport + BearSSL cmake unity builds

Avoid clashing static function names by namespacing them.

Pointed-out-by: Jan Venekamp
Ref: https://github.com/curl/curl/pull/13442#discussion_r1576350700
Closes #13450

18 months agodllmain: Call OpenSSL thread cleanup for Windows and Cygwin
Jay Satiro [Tue, 28 Nov 2023 08:39:09 +0000 (03:39 -0500)] 
dllmain: Call OpenSSL thread cleanup for Windows and Cygwin

- Call OPENSSL_thread_stop on thread termination (DLL_THREAD_DETACH)
  to prevent a memory leak in case OpenSSL is linked statically.

- Warn in libcurl-thread.3 that if OpenSSL is linked statically then it
  may require thread cleanup.

OpenSSL may need per-thread cleanup to stop a memory leak. For Windows
and Cygwin if libcurl was built as a DLL then we can do that for the
user by calling OPENSSL_thread_stop on thread termination. However, if
libcurl was built statically then we do not have notification of thread
termination and cannot do that for the user.

Also, there are several other unusual cases where it may be necessary
for the user to call OPENSSL_thread_stop, so in the libcurl-thread
warning I added a link to the OpenSSL documentation.

Co-authored-by: Viktor Szakats
Reported-by: southernedge@users.noreply.github.com
Reported-by: zmcx16@users.noreply.github.com
Ref: https://www.openssl.org/docs/man3.0/man3/OPENSSL_thread_stop.html#NOTES

Fixes https://github.com/curl/curl/issues/12327
Closes https://github.com/curl/curl/pull/12408

18 months agorustls: remove incorrect SSLSUPP_TLS13_CIPHERSUITES flag
Jan Venekamp [Tue, 23 Apr 2024 15:59:46 +0000 (17:59 +0200)] 
rustls: remove incorrect SSLSUPP_TLS13_CIPHERSUITES flag

The rustls backend advertises SSLSUPP_TLS13_CIPHERSUITES, but
the code does not actually seem to support it (yet?). Removed
the flag and corrected documentation.

Closes #13452

18 months agoquiche: expire all active transfers on connection close
Stefan Eissing [Tue, 23 Apr 2024 10:51:30 +0000 (12:51 +0200)] 
quiche: expire all active transfers on connection close

- when a connection close is detected, all ongoing transfers
  need to expire bc no more POLL events are likely to happen
  for them.

Fixes #13439
Reported-by: Jay Satiro
Closes #13447

18 months agotests: fix feature case in test1481
Dan Fandrich [Tue, 23 Apr 2024 00:15:58 +0000 (17:15 -0700)] 
tests: fix feature case in test1481

This test was being skipped everywhere because the feature never
matched.

Closes #13445

18 months agotool_operate: don't truncate the etag save file by default
Gusted [Sat, 20 Apr 2024 16:44:42 +0000 (18:44 +0200)] 
tool_operate: don't truncate the etag save file by default

This fixes a regression of 75d79a4486b279100209ddf8c7fdb12955fb66e9. The
code in tool-operate truncated the etag save file, under the assumption
that the file would be written with a new etag value. However since
75d79a4486b279100209ddf8c7fdb12955fb66e9 that might not be the case
anymore and could result in the file being truncated when --etag-compare
and --etag-save was used and that the etag value matched with what the
server responded. Instead the truncation should not be done when a new
etag value should be written.

Test 3204 was added to verify that the file with the etag value doesn't
change the contents when used by --etag-compare and --etage-save and
that value matches with what the server returns on a non 2xx response.

Closes #13432

18 months agotests: enable test 1117 for hyper
Abdullah Alyan [Sun, 21 Apr 2024 13:24:57 +0000 (16:24 +0300)] 
tests: enable test 1117 for hyper

Closes #13436

18 months agosendf: useless assignment in cr_lc_read()
Daniel Stenberg [Sun, 21 Apr 2024 15:29:18 +0000 (17:29 +0200)] 
sendf: useless assignment in cr_lc_read()

Spotted by CodeSonar

Closes #13437

18 months agotool_paramhlp: remove duplicate assign
Daniel Stenberg [Sat, 20 Apr 2024 21:06:24 +0000 (23:06 +0200)] 
tool_paramhlp: remove duplicate assign

Spotted by CodeSonar

Closes #13433

18 months agotransfer: remove useless assignment
Daniel Stenberg [Sat, 20 Apr 2024 21:21:02 +0000 (23:21 +0200)] 
transfer: remove useless assignment

in Curl_xfer_recv_resp

Spotted by CodeSonar

Closes #13435

18 months agohttp: acknowledge a returned error code
Daniel Stenberg [Sat, 20 Apr 2024 21:15:00 +0000 (23:15 +0200)] 
http: acknowledge a returned error code

... and do not overwrite it with a new value that could then hide the
problem.

Spotted by CodeSonar

Closes #13434

18 months agotool_operate: init vars unconditionally in post_per_transfer
Daniel Stenberg [Sat, 20 Apr 2024 12:15:39 +0000 (14:15 +0200)] 
tool_operate: init vars unconditionally in post_per_transfer

In case of (the unlikely) early return, they could otherwise remain
uninitialized

Spotted by CodeSonar

Closes #13430

18 months agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 19 Apr 2024 21:59:43 +0000 (23:59 +0200)] 
RELEASE-NOTES: synced

18 months agourlapi: allow setting port number zero
Daniel Stenberg [Fri, 19 Apr 2024 12:42:39 +0000 (14:42 +0200)] 
urlapi: allow setting port number zero

Also set and check errno when strtoul() parsing numbers for better error
checking.

Updated test 1560

Closes #13427

18 months agohttp_aws_sigv4: remove useless assignment
Daniel Stenberg [Fri, 19 Apr 2024 12:12:36 +0000 (14:12 +0200)] 
http_aws_sigv4: remove useless assignment

This code assigned the variable the same value it already had

Spotted by CodeSonar

Closes #13426

18 months agofile: remove useless assignment
Daniel Stenberg [Fri, 19 Apr 2024 12:09:54 +0000 (14:09 +0200)] 
file: remove useless assignment

This code assigned the variable the same value it already had.

Spotted by CodeSonar

Closes #13425

18 months agotest2406: verify -f with HTTP/2
Daniel Stenberg [Fri, 19 Apr 2024 06:55:10 +0000 (08:55 +0200)] 
test2406: verify -f with HTTP/2

18 months agohttp2 + ngtcp2: pass CURLcode errors from callbacks
Stefan Eissing [Thu, 18 Apr 2024 21:24:34 +0000 (23:24 +0200)] 
http2 + ngtcp2: pass CURLcode errors from callbacks

- errors returned by Curl_xfer_write_resp() and the header variant are
  not errors in the protocol. The result needs to be returned on the
  next recv() from the protocol filter.

- make xfer write errors for response data cause the stream to be
  cancelled

- added pytest test_02_14 and test_02_15 to verify that also for
  parallel processing

Reported-by: Laramie Leavitt
Fixes #13411
Closes #13424

18 months agorequest: make Curl_req_init return void
Daniel Stenberg [Fri, 19 Apr 2024 08:46:42 +0000 (10:46 +0200)] 
request: make Curl_req_init return void

Since it could not return error and therefore this change removes dead
code for the caller.

Spotted by CodeSonar.

Closes #13423

18 months agomulti: remove the unused Curl_preconnect function
Daniel Stenberg [Fri, 19 Apr 2024 08:37:37 +0000 (10:37 +0200)] 
multi: remove the unused Curl_preconnect function

The implementation has been removed, no point in keeping it around.

Follow-up to 476adfeac019ed

Closes #13422

18 months agoCurl_creader_read: init two variables to avoid using them uninited
Daniel Stenberg [Fri, 19 Apr 2024 07:42:25 +0000 (09:42 +0200)] 
Curl_creader_read: init two variables to avoid using them uninited

Spotted by CodeSonar

Closes #13419

18 months agohttp: reject HTTP major version switch mid connection
Daniel Stenberg [Fri, 19 Apr 2024 08:27:04 +0000 (10:27 +0200)] 
http: reject HTTP major version switch mid connection

A connection that has seen an HTTP major version now refuses any other
major HTTP version in future responses. Previously, a HTTP/1.x
connection would just silently accept HTTP/2 or HTTP/3 in the status
lines as long as it had support for those built-in. It would then just
lead to confusion and badness.

Indirectly Spotted by CodeSonar which identified a duplicate assignment
in this function.

Add test 471 to verify

Closes #13421

18 months agomqtt: when Curl_xfer_recv returns error, don't use nread
Daniel Stenberg [Fri, 19 Apr 2024 07:32:23 +0000 (09:32 +0200)] 
mqtt: when Curl_xfer_recv returns error, don't use nread

A returned error code makes other return value unreliable, and in this
case potentially uninitialized. On error, do not read other return
values like the nread counter.

Spotted by CodeSonar

Closes #13418

18 months agoftp: fix socket leak on rare error
Daniel Stenberg [Fri, 19 Apr 2024 07:13:42 +0000 (09:13 +0200)] 
ftp: fix socket leak on rare error

In the function AcceptServerConnect() the newly created socket would
leak if Curl_conn_tcp_accepted_set() returns error. Which basically
should never happen.

Spotted by CodeSonar.

Closes #13417

18 months agourlapi: remove unused flags argument from Curl_url_set_authority
Daniel Stenberg [Thu, 18 Apr 2024 14:49:10 +0000 (16:49 +0200)] 
urlapi: remove unused flags argument from Curl_url_set_authority

The function is only called from a single place (for HTTP/2 server push)
so might as well just assume this fixed option every time.

Closes #13409