#
9acecc92 |
| 25-Oct-2024 |
Viktor Szakats |
tidy-up: whitespace, fix CI spacecheck for docs Also: fixup CI spacecheck to apply to docs again. Closes #15423
|
#
335d3257 |
| 14-Oct-2024 |
Michael Kaufmann |
conncache: More efficient implementation of cpool_remove_bundle Closes #15292
|
#
699a2df3 |
| 08-Oct-2024 |
Daniel Stenberg |
conncache: find bundle again in case it is removed When the pool is cleaned up due to host limits, the bundle may be cleaned up as well making the old pointer invalid. Fixes #15
conncache: find bundle again in case it is removed When the pool is cleaned up due to host limits, the bundle may be cleaned up as well making the old pointer invalid. Fixes #15185 Reported-by: Moritz Knüsel Closes #15186
show more ...
|
#
bcec0840 |
| 02-Oct-2024 |
Daniel Stenberg |
lib: use bool/TRUE/FALSE properly booleans should use the type 'bool' and set the value to TRUE/FALSE non-booleans should not be 'bool' and should not set the value to TRUE/FALS
lib: use bool/TRUE/FALSE properly booleans should use the type 'bool' and set the value to TRUE/FALSE non-booleans should not be 'bool' and should not set the value to TRUE/FALSE Closes #15123
show more ...
|
#
fbf5d507 |
| 18-Sep-2024 |
Daniel Stenberg |
lib/src: white space edits to comply better with code style ... as checksrc now finds and complains about these. Closes #14921
|
#
4ff04615 |
| 02-Sep-2024 |
Daniel Stenberg |
lib: use FMT_ as prefix instead of CURL_FORMAT_ For printf format defines used internally. Makes the code slighly easier to read. Closes #14764
|
#
1be704e1 |
| 23-Aug-2024 |
Stefan Eissing |
cpool: rename "connection cache/conncache" to "Connection Pools/cpool" This is a better match for what they do and the general "cpool" var/function prefix works well. The pool n
cpool: rename "connection cache/conncache" to "Connection Pools/cpool" This is a better match for what they do and the general "cpool" var/function prefix works well. The pool now handles very long hostnames correctly. The following changes have been made: * 'struct connectdata', e.g. connections, keep new members named `destination` and ' destination_len' that fully specifies interface+port+hostname of where the connection is going to. This is used in the pool for "bundling" of connections with the same destination. There is no limit on the length any more. * Locking: all locks are done inside conncache.c when calling into the pool and released on return. This eliminates hazards of the callers keeping track. * 'struct connectbundle' is now internal to the pool. It is no longer referenced by a connection. * 'bundle->multiuse' no longer exists. HTTP/2 and 3 and TLS filters no longer need to set it. Instead, the multi checks on leaving MSTATE_CONNECT or MSTATE_CONNECTING if the connection is now multiplexed and new, e.g. not conn->bits.reuse. In that case the processing of pending handles is triggered. * The pool's init is provided with a callback to invoke on all connections being discarded. This allows the cleanups in `Curl_disconnect` to run, wherever it is decided to retire a connection. * Several pool operations can now be fully done with one call. Pruning dead connections, upkeep and checks on pool limits can now directly discard connections and need no longer return those to the caller for doing that (as we have now the callback described above). * Finding a connection for reuse is now done via `Curl_cpool_find()` and the caller provides callbacks to evaluate the connection candidates. * The 'Curl_cpool_check_limits()' now directly uses the max values that may be set in the transfer's multi. No need to pass them around. Curl_multi_max_host_connections() and Curl_multi_max_total_connections() are gone. * Add method 'Curl_node_llist()' to get the llist a node is in. Used in cpool to verify connection are indeed in the list (or not in any list) as they need to. I left the conncache.[ch] as is for now and also did not touch the documentation. If we update that outside the feature window, we can do this in a separate PR. Multi-thread safety is not achieved by this PR, but since more details on how pools operate are now "internal" it is a better starting point to go for this in the future. Closes #14662
show more ...
|
#
a58b50fc |
| 15-Aug-2024 |
Stefan Eissing |
transfer: Curl_sendrecv() and event related improvements - Renames Curl_readwrite() to Curl_sendrecv() to reflect that it is mainly about talking to the server, not reads or writes to
transfer: Curl_sendrecv() and event related improvements - Renames Curl_readwrite() to Curl_sendrecv() to reflect that it is mainly about talking to the server, not reads or writes to the client. Add a `nowp` parameter since the single caller already has this. - Curl_sendrecv() now runs all possible operations whenever it is called and either it had been polling sockets or the 'select_bits' are set. POLL_IN/POLL_OUT are not always directly related to send/recv operations. Filters like HTTP/2, QUIC or TLS may monitor reverse directions. If a transfer does not want to send (KEEP_SEND), it will not do so, as before. Same for receives. - Curl_update_timer() now checks the absolute timestamp of an expiry and the last/new timeout to determine if the application needs to stop/start/restart its timer. This fixes edge cases where updates did not happen as they should have. - improved --test-event curl_easy_perform() simulation to handle situations where no sockets are registered but a timeout is in place. - fixed bug in events_socket() that complained about removing a socket that was unknown, when indeed it had removed the socket just before, only it was the last in the list - fixed conncache's internal handle to carry the multi instance (where the cache has one) so that operations on the closure handle trigger event callbacks correctly. - fixed conncache to not POLL_REMOVE a socket twice when a conneciton was closed. Closes #14561
show more ...
|
#
c0233a35 |
| 12-Aug-2024 |
Daniel Stenberg |
hash: provide asserts to verify API use - converted the Curl_hash_count() macro to a function - Discourage accessing struct fields directly - Document the internal API in H
hash: provide asserts to verify API use - converted the Curl_hash_count() macro to a function - Discourage accessing struct fields directly - Document the internal API in HASH.md Closes #14503
show more ...
|
#
ba235ab2 |
| 10-Aug-2024 |
Daniel Stenberg |
llist: remove direct struct accesses, use only functions - Turned them all into functions to also do asserts etc. - The llist related structs got all their fields renamed in order t
llist: remove direct struct accesses, use only functions - Turned them all into functions to also do asserts etc. - The llist related structs got all their fields renamed in order to make sure no existing code remains using direct access. - Each list node struct now points back to the list it "lives in", so Curl_node_remove() no longer needs the list pointer. - Rename the node struct and some of the access functions. - Added lots of ASSERTs to verify API being used correctly - Fix some cases of API misuse Add docs/LLIST.md documenting the internal linked list API. Closes #14485
show more ...
|
#
5a9262a3 |
| 12-Jul-2024 |
Stefan Eissing |
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 ** t
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
show more ...
|
#
17e6f06e |
| 29-Jul-2024 |
Stefan Eissing |
connect: fix connection shutdown for event based processing connections being shutdown would register sockets for events, but then never remove these sockets again. Nor would the shutdow
connect: fix connection shutdown for event based processing connections being shutdown would register sockets for events, but then never remove these sockets again. Nor would the shutdown effectively been performed. - If a socket event involves a transfer, check if that is the connection cache internal handle and run its multi_perform() instead (the internal handle is used for all shutdowns). - When a timer triggers for a transfer, check also if it is about the connection cache internal handle. - During processing shutdowns in the connection cache, assess the shutdown timeouts. Register a Curl_expire() of the lowest value for the cache's internal handle. Reported-by: Gordon Parke Fixes #14280 Closes #14296
show more ...
|
#
ae620a70 |
| 22-Jul-2024 |
Stefan Eissing |
conncache: connection shutdown, multi_socket handling - implement the socket hash user/reader/writer processing also for connections that are being shut down by the connection cache.
conncache: connection shutdown, multi_socket handling - implement the socket hash user/reader/writer processing also for connections that are being shut down by the connection cache. - split out handling of current vs. last pollset socket event handling into a function available in other code parts - add `shutdown_poll` pollset to `connectdata` struct so that changes in the pollset can be recorded during shutdown. (The internal handle cannot keep it since it might be used for many connections) Reported-by: calvin2021y on github Fixes #14252 Closes #14257
show more ...
|
#
c074ba64 |
| 01-Jul-2024 |
Daniel Stenberg |
code: language cleanup in comments Based on the standards and guidelines we use for our documentation. - expand contractions (they're => they are etc) - host name = > hostname
code: language cleanup in comments Based on the standards and guidelines we use for our documentation. - expand contractions (they're => they are etc) - host name = > hostname - file name => filename - user name = username - man page => manpage - run-time => runtime - set-up => setup - back-end => backend - a HTTP => an HTTP - Two spaces after a period => one space after period Closes #14073
show more ...
|
#
fde2143d |
| 27-Jun-2024 |
Daniel Stenberg |
conncache: done always evaluates to false Follow-up to c9b95c0bb30f88bf00e1ac Spotted by CodeSonar Reviewed-by: Stefan Eissing Closes #14034
|
#
9a49af5f |
| 27-Jun-2024 |
Daniel Stenberg |
lib: add a few DEBUGASSERT(data) to aid code analyzers ... where 'data' is assumed to always work. Closes #14033
|
#
c9b95c0b |
| 19-Jun-2024 |
Stefan Eissing |
lib: graceful connection shutdown When libcurl discards a connection there are two phases this may go through: "shutdown" and "closing". If a connection is aborted, the shutdown phas
lib: graceful connection shutdown When libcurl discards a connection there are two phases this may go through: "shutdown" and "closing". If a connection is aborted, the shutdown phase is skipped and it is closed right away. The connection filters attached to the connection implement the phases in their `do_shutdown()` and `do_close()` callbacks. Filters carry now a `shutdown` flags next to `connected` to keep track of the shutdown operation. Filters are shut down from top to bottom. If a filter is not connected, its shutdown is skipped. Notable filters that *do* something during shutdown are HTTP/2 and TLS. HTTP/2 sends the GOAWAY frame. TLS sends its close notify and expects to receive a close notify from the server. As sends and receives may EAGAIN on the network, a shutdown is often not successful right away and needs to poll the connection's socket(s). To facilitate this, such connections are placed on a new shutdown list inside the connection cache. Since managing this list requires the cooperation of a multi handle, only the connection cache belonging to a multi handle is used. If a connection was in another cache when being discarded, it is removed there and added to the multi's cache. If no multi handle is available at that time, the connection is shutdown and closed in a one-time, best-effort attempt. When a multi handle is destroyed, all connection still on the shutdown list are discarded with a final shutdown attempt and close. In curl debug builds, the environment variable `CURL_GRACEFUL_SHUTDOWN` can be set to make this graceful with a timeout in milliseconds given by the variable. The shutdown list is limited to the max number of connections configured for a multi cache. Set via CURLMOPT_MAX_TOTAL_CONNECTIONS. When the limit is reached, the oldest connection on the shutdown list is discarded. - In multi_wait() and multi_waitfds(), collect all connection caches involved (each transfer might carry its own) into a temporary list. Let each connection cache on the list contribute sockets and POLLIN/OUT events it's connections are waiting for. - in multi_perform() collect the connection caches the same way and let them peform their maintenance. This will make another non-blocking attempt to shutdown all connections on its shutdown list. - for event based multis (multi->socket_cb set), add the sockets and their poll events via the callback. When `multi_socket()` is invoked for a socket not known by an active transfer, forward this to the multi's cache for processing. On closing a connection, remove its socket(s) via the callback. TLS connection filters MUST NOT send close nofity messages in their `do_close()` implementation. The reason is that a TLS close notify signals a success. When a connection is aborted and skips its shutdown phase, the server needs to see a missing close notify to detect something has gone wrong. A graceful shutdown of FTP's data connection is performed implicitly before regarding the upload/download as complete and continuing on the control connection. For FTP without TLS, there is just the socket close happening. But with TLS, the sent/received close notify signals that the transfer is complete and healthy. Servers like `vsftpd` verify that and reject uploads without a TLS close notify. - added test_19_* for shutdown related tests - test_19_01 and test_19_02 test for TCP RST packets which happen without a graceful shutdown and should no longer appear otherwise. - add test_19_03 for handling shutdowns by the server - add test_19_04 for handling shutdowns by curl - add test_19_05 for event based shutdowny by server - add test_30_06/07 and test_31_06/07 for shutdown checks on FTP up- and downloads. Closes #13976
show more ...
|
#
a35bbe89 |
| 05-May-2024 |
Viktor Szakats |
lib: bump hash sizes to `size_t` Follow-up to cc907e80a2498c0599253271a6f657f614b52a4e #13502 Cherry-picked from #13489 Closes #13601
|
#
e411c98f |
| 11-Apr-2024 |
Viktor Szakats |
build: prefer `USE_IPV6` macro internally (was: `ENABLE_IPV6`) Before this patch, two macros were used to guard IPv6 features in curl sources: `ENABLE_IPV6` and `USE_IPV6`. This patch ma
build: prefer `USE_IPV6` macro internally (was: `ENABLE_IPV6`) Before this patch, two macros were used to guard IPv6 features in curl sources: `ENABLE_IPV6` and `USE_IPV6`. This patch makes the source use the latter for consistency with other similar switches. `-DENABLE_IPV6` remains accepted for compatibility as a synonym for `-DUSE_IPV6`, when passed to the compiler. `ENABLE_IPV6` also remains the name of the CMake and `Makefile.vc` options to control this feature. Closes #13349
show more ...
|
#
c296abd4 |
| 10-Apr-2024 |
Stefan Eissing |
llist: add Curl_llist_append() - use for better readability in all places where the "insert_next" actually performs an append to the list - add some tests in unit1300 Clos
llist: add Curl_llist_append() - use for better readability in all places where the "insert_next" actually performs an append to the list - add some tests in unit1300 Closes #13336
show more ...
|
#
fcef00db |
| 08-Mar-2024 |
Stefan Eissing |
lib: keep conn IP information together new struct ip_quadruple for holding local/remote addr+port - used in data->info and conn and cf-socket.c - copy back and forth complete st
lib: keep conn IP information together new struct ip_quadruple for holding local/remote addr+port - used in data->info and conn and cf-socket.c - copy back and forth complete struct - add 'secondary' to conn - use secondary in reporting success for ftp 2nd connection Reported-by: DasKutti on github Fixes #13084 Closes #13090
show more ...
|
#
476adfea |
| 26-Jan-2024 |
Stefan Eissing |
multi: add xfer_buf to multi handle - can be borrowed by transfer during recv-write operation - needs to be released before borrowing again - adjustis size to `data->set.buffer_size`
multi: add xfer_buf to multi handle - can be borrowed by transfer during recv-write operation - needs to be released before borrowing again - adjustis size to `data->set.buffer_size` - used in transfer.c readwrite_data() Closes #12805
show more ...
|
#
dbf4c403 |
| 25-Nov-2023 |
Daniel Stenberg |
conncache: use the closure handle when disconnecting surplus connections Use the closure handle for disconnecting connection cache entries so that anything that happens during the discon
conncache: use the closure handle when disconnecting surplus connections Use the closure handle for disconnecting connection cache entries so that anything that happens during the disconnect is not stored and associated with the 'data' handle which already just finished a transfer and it is important that details from the unrelated disconnect does not taint meta-data in the data handle. Like storing the response code. This also adjust test 1506. Unfortunately it also removes a key part of the test that verifies that a connection is closed since when this output vanishes (because the closure handle is used), we don't know exactly that the connection actually gets closed in this test... Reported-by: ohyeaah on github Fixes #12367 Closes #12405
show more ...
|
#
2d06eebf |
| 21-Nov-2023 |
Daniel Stenberg |
urldata: make maxconnects a 32 bit value "2^32 idle connections ought to be enough for anybody" Closes #12375
|
#
413a0fed |
| 16-Nov-2023 |
Viktor Szakats |
autotools: stop setting `-std=gnu89` with `--enable-warnings` Do not alter the C standard when building with `--enable-warnings` when building with gcc. On one hand this alters
autotools: stop setting `-std=gnu89` with `--enable-warnings` Do not alter the C standard when building with `--enable-warnings` when building with gcc. On one hand this alters warning results compared to a default build. On the other, it may produce different binaries, which is unexpected. Also fix new warnings that appeared after removing `-std=gnu89`: - include: fix public curl headers to use the correct printf mask for `CURL_FORMAT_CURL_OFF_T` and `CURL_FORMAT_CURL_OFF_TU` with mingw-w64 and Visual Studio 2013 and newer. This fixes the printf mask warnings in examples and tests. E.g. [1] - conncache: fix printf format string [2]. - http2: fix potential null pointer dereference [3]. (seen on Slackware with gcc 11.) - libssh: fix printf format string in SFTP code [4]. Also make MSVC builds compatible with old CRT versions. - libssh2: fix printf format string in SFTP code for MSVC. Applying the same fix as for libssh above. - unit1395: fix `argument is null` and related issues [5]: - stop calling `strcmp()` with NULL to avoid undefined behaviour. - fix checking results if some of them were NULL. - do not pass NULL to printf `%s`. - ci: keep a build job with `-std=gnu89` to continue testing for C89-compliance. We can apply this to other gcc jobs as needed. Ref: b23ce2cee7329bbf425f18b49973b7a5f23dfcb4 (2022-09-23) #9542 [1] https://dev.azure.com/daniel0244/curl/_build/results?buildId=18581&view=logs&jobId=ccf9cc6d-2ef1-5cf2-2c09-30f0c14f923b [2] https://github.com/curl/curl/actions/runs/6896854263/job/18763831142?pr=12346#step:6:67 [3] https://github.com/curl/curl/actions/runs/6896854253/job/18763839238?pr=12346#step:30:214 [4] https://github.com/curl/curl/actions/runs/6896854253/job/18763838007?pr=12346#step:29:895 [5] https://github.com/curl/curl/actions/runs/6896854253/job/18763836775?pr=12346#step:33:1689 Closes #12346
show more ...
|