curl/src
Stefan Eissing df672695e5
shutdowns: split shutdown handling from connection pool
Further testing with timeouts in event based processing revealed that
our current shutdown handling in the connection pool was not clear
enough. Graceful shutdowns can only happen inside a multi handle and it
was confusing to track in the code which situation actually applies. It
seems better to split the shutdown handling off and have that code
always be part of a multi handle.

Add `cshutdn.[ch]` with its own struct to maintain connections being
shut down. A `cshutdn` always belongs to a multi handle and uses that
for socket/timeout monitoring.

The `cpool`, which can be part of a multi or share, either passes
connections to a `cshutdn` or terminates them with a one-time, best
effort.

Add an `admin` easy handle to each multi and share. This is used to
perform all maintenance operations where no "real" easy handle is
available. This solves the problem that the multi admin handle requires
some additional initialisation (e.g. timeout list).

The share needs its admin handle as it is often cleaned up when no other
transfer or multi handle exists any more. But we need a `data` in almost
every call.

Fix file:// handling of errors when adding a new connection to the pool.

Changes in `curl` itself:

- for parallel transfers, do not set a connection pool in the share,
  rely on the multi's connection pool instead. While not a requirement
  for the new `cshutdn` to work, this is

  a) helpful in testing to trigger graceful shutdowns
  b) a broader code coverage of libcurl via the curl tool

- on test_event with uv, cleanup the multi handle before returning from
  parallel_event(). The uv struct is on the stack, cleanup of the multi
  later will crash when it tries to register sockets. This is a "eat
  your own dogfood" related fix.

Closes #16508
2025-03-02 11:13:34 +01:00
..
.checksrc checksrc: introduce 'banfunc' to ban specific functions 2024-12-30 08:25:56 +01:00
.gitignore gitignore: add generated unity sources for lib and src 2025-01-27 22:55:39 +01:00
CMakeLists.txt build: add Windows CE / CeGCC support, with CI jobs 2025-02-21 13:56:34 +01:00
curl.rc windows: drop code and curl manifest targeting W2K and older 2025-02-24 21:00:31 +01:00
Makefile.am GHA/linux: build out-of-tree, make autotools tidy target support it 2025-02-26 12:35:03 +01:00
Makefile.inc strparse: switch to curl_off_t as base data type 2025-02-15 21:58:48 +01:00
mk-file-embed.pl src: guard for double declaration of curl_ca_embed in unity builds 2024-10-16 17:27:56 +02:00
mkhelp.pl build: drop tool_hugehelp.c.cvs, tidy up macros, drop buildconf.bat 2025-01-26 14:22:49 +01:00
slist_wc.c copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
slist_wc.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
terminal.c build: add Windows CE / CeGCC support, with CI jobs 2025-02-21 13:56:34 +01:00
terminal.h curl: make warnings and other messages aware of terminal width 2024-05-28 23:12:32 +02:00
tool_binmode.h binmode: convert to macro and use it from tests 2024-12-21 13:29:24 +01:00
tool_bname.c copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_bname.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_cb_dbg.c curl: use realtime in trace timestamps 2024-12-02 21:21:18 +01:00
tool_cb_dbg.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_cb_hdr.c build: add Windows CE / CeGCC support, with CI jobs 2025-02-21 13:56:34 +01:00
tool_cb_hdr.h tool: support --show-headers AND --remote-header-name 2024-10-02 08:04:33 +02:00
tool_cb_prg.c lib/src: white space edits to comply better with code style 2024-09-19 14:59:12 +02:00
tool_cb_prg.h curl: make warnings and other messages aware of terminal width 2024-05-28 23:12:32 +02:00
tool_cb_rea.c build: add Windows CE / CeGCC support, with CI jobs 2025-02-21 13:56:34 +01:00
tool_cb_rea.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_cb_see.c build: add Windows CE / CeGCC support, with CI jobs 2025-02-21 13:56:34 +01:00
tool_cb_see.h tool: move tool_ftruncate64 to tool_util.c 2024-04-25 09:20:38 +02:00
tool_cb_soc.c curl: (on linux) add MPTCP support 2024-06-07 10:54:19 +02:00
tool_cb_soc.h curl: (on linux) add MPTCP support 2024-06-07 10:54:19 +02:00
tool_cb_wrt.c build: add Windows CE / CeGCC support, with CI jobs 2025-02-21 13:56:34 +01:00
tool_cb_wrt.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_cfgable.c curl: detect ECH support dynamically, not at build time 2024-10-24 16:10:39 +02:00
tool_cfgable.h curl.h: change some enums to defines with L suffix 2025-02-26 07:58:15 +01:00
tool_dirhie.c build: add Windows CE / CeGCC support, with CI jobs 2025-02-21 13:56:34 +01:00
tool_dirhie.h tool: use errorf() for error output 2023-06-01 08:19:11 +02:00
tool_doswin.c build: add Windows CE / CeGCC support, with CI jobs 2025-02-21 13:56:34 +01:00
tool_doswin.h build: add Windows CE / CeGCC support, with CI jobs 2025-02-21 13:56:34 +01:00
tool_easysrc.c lib, src: delete stray curl_ prefix from printf calls 2024-08-26 11:00:15 +02:00
tool_easysrc.h build: enable missing OpenSSF-recommended warnings, with fixes 2023-12-16 13:12:37 +00:00
tool_filetime.c tidy-up: rename CURL_WINDOWS_APP to CURL_WINDOWS_UWP 2024-09-19 19:24:12 +02:00
tool_filetime.h windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_findfile.c Makefile.mk: drop in favour of autotools and cmake (MS-DOS, AmigaOS3) 2024-12-16 23:20:55 +01:00
tool_findfile.h windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_formparse.c build: add Windows CE / CeGCC support, with CI jobs 2025-02-21 13:56:34 +01:00
tool_formparse.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_getparam.c tool_getparam: make --url support a file with URLs 2025-02-25 09:16:54 +01:00
tool_getparam.h tool_getparam: clear sensitive arguments better 2025-02-20 09:56:09 +01:00
tool_getpass.c build: add Windows CE / CeGCC support, with CI jobs 2025-02-21 13:56:34 +01:00
tool_getpass.h code: language cleanup in comments 2024-07-01 22:58:55 +02:00
tool_help.c tidy-up: make per-file ARRAYSIZE macros global as CURL_ARRAYSIZE 2025-02-07 14:21:59 +01:00
tool_help.h tool_help: handle longer lines, exit on too long 2024-08-07 00:31:07 +02:00
tool_helpers.c curl: add byte range support to --variable reading from file 2024-12-21 11:46:27 +01:00
tool_helpers.h src: tidy up types, add necessary casts 2024-05-17 12:32:04 +02:00
tool_hugehelp.h build: drop tool_hugehelp.c.cvs, tidy up macros, drop buildconf.bat 2025-01-26 14:22:49 +01:00
tool_ipfs.c ipfs: add options to disable 2024-09-21 12:08:32 +02:00
tool_ipfs.h ipfs: add options to disable 2024-09-21 12:08:32 +02:00
tool_libinfo.c tidy-up: use CURL_ARRAYSIZE() 2025-02-19 00:59:45 +01:00
tool_libinfo.h tool_getparam: fail --hostpubsha256 if libssh2 is not used 2025-01-28 10:30:40 +01:00
tool_listhelp.c tool_getparam: make --url support a file with URLs 2025-02-25 09:16:54 +01:00
tool_main.c build: add Windows CE / CeGCC support, with CI jobs 2025-02-21 13:56:34 +01:00
tool_main.h tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
tool_msgs.c lib, src: delete stray curl_ prefix from printf calls 2024-08-26 11:00:15 +02:00
tool_msgs.h build: enable missing OpenSSF-recommended warnings, with fixes 2023-12-16 13:12:37 +00:00
tool_operate.c shutdowns: split shutdown handling from connection pool 2025-03-02 11:13:34 +01:00
tool_operate.h tool_cfgable: sort struct fields by size, use bitfields for booleans 2025-02-07 09:51:43 +01:00
tool_operhlp.c tidy-up: drop parenthesis around return expression 2025-01-14 12:11:42 +01:00
tool_operhlp.h tool_cb_wrt: use "curl_response" if no file name in URL 2024-09-17 13:39:51 +02:00
tool_paramhlp.c build: add Windows CE / CeGCC support, with CI jobs 2025-02-21 13:56:34 +01:00
tool_paramhlp.h curl: add byte range support to --variable reading from file 2024-12-21 11:46:27 +01:00
tool_parsecfg.c build: add Windows CE / CeGCC support, with CI jobs 2025-02-21 13:56:34 +01:00
tool_parsecfg.h tool_ssls: switch to tool-specific get_line function 2025-02-06 22:25:35 +01:00
tool_progress.c tool_progress: fix percent output of large parallel transfers 2025-02-10 11:12:44 +01:00
tool_progress.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_sdecls.h tool_getparam: make --url support a file with URLs 2025-02-25 09:16:54 +01:00
tool_setopt.c tidy-up: delete, comment or scope C macros reported unused 2025-02-14 10:37:14 +01:00
tool_setopt.h curl: make --libcurl output better CURLOPT_*SSLVERSION 2024-03-14 17:59:22 +01:00
tool_setup.h build: add Windows CE / CeGCC support, with CI jobs 2025-02-21 13:56:34 +01:00
tool_sleep.c select: use poll() if existing, avoid poll() with no sockets 2024-10-01 15:11:50 +02:00
tool_sleep.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_ssls.c tool_ssls: switch to tool-specific get_line function 2025-02-06 22:25:35 +01:00
tool_ssls.h vtls: feature ssls-export for SSL session im-/export 2025-01-08 23:32:07 +01:00
tool_stderr.c tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
tool_stderr.h tool: use errorf() for error output 2023-06-01 08:19:11 +02:00
tool_strdup.c copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_strdup.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_urlglob.c build: add Windows CE / CeGCC support, with CI jobs 2025-02-21 13:56:34 +01:00
tool_urlglob.h tool_operate: split up the huge single_transfer into sub functions 2024-10-23 23:12:54 +02:00
tool_util.c build: add Windows CE / CeGCC support, with CI jobs 2025-02-21 13:56:34 +01:00
tool_util.h build: add Windows CE / CeGCC support, with CI jobs 2025-02-21 13:56:34 +01:00
tool_version.h config: rename the OS define to CURL_OS to reduce collision risk 2024-10-30 14:59:54 +01:00
tool_vms.c docs: use lowercase curl and libcurl 2025-01-02 17:15:54 +01:00
tool_vms.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_writeout.c curl: add write-out variable 'tls_earlydata' 2025-02-22 10:02:39 +01:00
tool_writeout.h curl: add write-out variable 'tls_earlydata' 2025-02-22 10:02:39 +01:00
tool_writeout_json.c wolfssl: silence compiler warning (MSVC 2019), simplify existing 2025-02-07 10:52:55 +01:00
tool_writeout_json.h tool_writeout: bsearch the variable name 2024-06-10 23:12:05 +02:00
tool_xattr.c tool_xattr: create the user.creator xattr attribute 2024-10-11 10:13:37 -07:00
tool_xattr.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
var.c var: add a '64dec' function that can base64 decode a string 2025-02-22 11:38:52 +01:00
var.h Rename struct var to fix AIX build 2024-11-15 13:55:55 -08:00