#
962097b8 |
| 09-Oct-2024 |
Stefan Eissing |
TLS: TLSv1.3 earlydata support for curl Based on #14135, implement TLSv1.3 earlydata support for the curl command line, libcurl and its implementation in GnuTLS. If a known TLS
TLS: TLSv1.3 earlydata support for curl Based on #14135, implement TLSv1.3 earlydata support for the curl command line, libcurl and its implementation in GnuTLS. If a known TLS session announces early data support, and the feature is enabled *and* it is not a "connect-only" transfer, delay the TLS handshake until the first request is being sent. - Add --tls-earldata as new boolean command line option for curl. - Add CURLSSLOPT_EARLYDATA to libcurl to enable use of the feature. - Add CURLINFO_EARLYDATA_SENT_T to libcurl, reporting the amount of bytes sent and accepted/rejected by the server. Implementation details: - store the ALPN protocol selected at the SSL session. - When reusing the session and enabling earlydata, use exactly that ALPN protocol for negoptiation with the server. When the sessions ALPN does not match the connections ALPN, earlydata will not be enabled. - Check that the server selected the correct ALPN protocol for an earlydata connect. If the server does not confirm or reports something different, the connect fails. - HTTP/2: delay sending the initial SETTINGS frames during connect, if not connect-only. Verification: - add test_02_32 to verify earlydata GET with nghttpx. - add test_07_70 to verify earlydata PUT with nghttpx. - add support in 'hx-download', 'hx-upload' clients for the feature Assisted-by: ad-chaos on github Closes #15211
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 ...
|
#
d83b528a |
| 10-Sep-2024 |
Viktor Szakats |
tidy-up: spelling C89, Schannel, Secure Transport, contractions. Cherry-picked from #14692 Closes #14996
|
#
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
|
#
5a263710 |
| 14-Sep-2024 |
Gabriel Marin |
lib, src, tests: added space around ternary expressions Closes #14912
|
#
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 ...
|
#
aebd5087 |
| 21-Aug-2024 |
Jan Venekamp <1422460+jan2000@users.noreply.github.com> |
sectransp: fix setting tls version Had multiple failures on test_17_09_ssl_min_max with --tlsv1 and --tlsv1.3. Closes #14621
|
#
71d3ab58 |
| 11-Aug-2024 |
Viktor Szakats |
vtls: fix static function name collisions between TLS backends When using CMake Unity build. - use unique name for `set_ssl_version_min_max()` Fixes collision between GnuTLS,
vtls: fix static function name collisions between TLS backends When using CMake Unity build. - use unique name for `set_ssl_version_min_max()` Fixes collision between GnuTLS, mbedTLS and SecureTransport. ``` lib\vtls\mbedtls.c(317,1): error C2084: function 'CURLcode set_ssl_version_min_max(Curl_easy *,ssl_peer *,ssl_primary_config *,const char **,const char *)' already has a body lib\vtls\mbedtls.c(837,49): warning C4133: 'function': incompatible types - from 'Curl_cfilter *' to 'Curl_easy *' lib\vtls\mbedtls.c(837,53): warning C4133: 'function': incompatible types - from 'Curl_easy *' to 'ssl_peer *' lib\vtls\mbedtls.c(837,25): error C2198: 'set_ssl_version_min_max': too few arguments for call ``` - use unique name for `do_file_type()` Fixes collision between GnuTLS, OpenSSL and wolfSSL. ``` lib\vtls\openssl.c(1053,12): error C2084: function 'gnutls_x509_crt_fmt_t do_file_type(const char *)' already has a body ``` Ref: https://github.com/curl/curl/actions/runs/10341162641/job/28622681573?pr=14484#step:10:31 Cherry-picked from #14495 Closes #14516
show more ...
|
#
0a5ea09a |
| 29-Feb-2024 |
Max Faxälv |
spnego_gssapi: implement TLS channel bindings for openssl Channel Bindings are used to tie the session context to a specific TLS channel. This is to provide additional proof of valid ide
spnego_gssapi: implement TLS channel bindings for openssl Channel Bindings are used to tie the session context to a specific TLS channel. This is to provide additional proof of valid identity, mitigating authentication relay attacks. Major web servers have the ability to require (None/Accept/Require) GSSAPI channel binding, rendering Curl unable to connect to such websites unless support for channel bindings is implemented. IIS calls this feature Extended Protection (EPA), which is used in Enterprise environments using Kerberos for authentication. This change require krb5 >= 1.19, otherwise channel bindings won't be forwarded through SPNEGO. Co-Authored-By: Steffen Kieß <947515+steffen-kiess@users.noreply.github.com> Closes #13098
show more ...
|
#
5c2ab55a |
| 05-Aug-2024 |
Jan Venekamp <1422460+jan2000@users.noreply.github.com> |
vtls: add SSLSUPP_CIPHER_LIST Added SSLSUPP_CIPHER_LIST so be able to differniate SSL Backends that support CURLOPT_SSL_CIPHER_LIST. Closes #14406
|
#
f81f351b |
| 02-Aug-2024 |
Viktor Szakats |
tidy-up: OS names Use these words and casing more consistently across text, comments and one curl tool output: AIX, ALPN, ANSI, BSD, Cygwin, Darwin, FreeBSD, GitHub, HP-UX, Linux,
tidy-up: OS names Use these words and casing more consistently across text, comments and one curl tool output: AIX, ALPN, ANSI, BSD, Cygwin, Darwin, FreeBSD, GitHub, HP-UX, Linux, macOS, MS-DOS, MSYS, MinGW, NTLM, POSIX, Solaris, UNIX, Unix, Unicode, WINE, WebDAV, Win32, winbind, WinIDN, Windows, Windows CE, Winsock. Mostly OS names and a few more. Also a couple of other minor text fixups. Closes #14360
show more ...
|
#
911c3166 |
| 18-Jul-2024 |
Stefan Eissing |
lib: add eos flag to send methods Adds a `bool eos` flag to send methods to indicate that the data is the last chunk the invovled transfer wants to send to the server. This will
lib: add eos flag to send methods Adds a `bool eos` flag to send methods to indicate that the data is the last chunk the invovled transfer wants to send to the server. This will help protocol filters like HTTP/2 and 3 to forward the stream's EOF flag and also allow to EAGAIN such calls when buffers are not yet fully flushed. Closes #14220
show more ...
|
#
25321de3 |
| 18-Jul-2024 |
Daniel Stenberg |
Revert "lib: send eos flag" This reverts commit be93299f10ef0b2bf7fe5c82140120073831867a.
|
#
be93299f |
| 18-Jul-2024 |
Stefan Eissing |
lib: send eos flag Adds a `bool eos` flag to send methods to indicate that the data is the last chunk the invovled transfer wants to send to the server. This will help protocol
lib: send eos flag Adds a `bool eos` flag to send methods to indicate that the data is the last chunk the invovled transfer wants to send to the server. This will help protocol filters like HTTP/2 and 3 to forward the stream's EOF flag and also allow to EAGAIN such calls when buffers are not yet fully flushed. Closes #14220
show more ...
|
#
5fa534b0 |
| 06-Jul-2024 |
Viktor Szakats |
sectransp: fix clang compiler warnings, stop silencing them Fix `-Wpointer-bool-conversion` warnings with the method suggested by both Apple clang and mainline llvm. This was already tri
sectransp: fix clang compiler warnings, stop silencing them Fix `-Wpointer-bool-conversion` warnings with the method suggested by both Apple clang and mainline llvm. This was already tried and dropped in #1705 (in year 2017), but the issue reported there no longer replicates. Verified with Apple clang 14, llvm 15, llvm 18 and gcc 11, 14 that the generated objects are bit by bit identical before and after this patch. Also: - stop silencing `-Wtautological-pointer-compare`. This warning don't seem to be appearing anymore (with or without this patch), at least with the tested compilers and SDKs (clang 13.1.6-16.0.0beta, llvm 15, 18, gcc 11, 14) and minimum macOS target of 10.8. Older targets fail to build curl with SecureTransport. - silence `-Wunreachable-code` for clang only. Previously I applied it also to GCC, by mistake. Ref: https://github.com/curl/curl/pull/12331/commits/8d7172d20a48ebc6c1b1d94a76e2c5fb19dd9bfa Apple clang `-Wpointer-bool-conversion`: ``` curl/lib/vtls/sectransp.c:1103:6: error: address of function 'SSLCreateContext' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] if(SSLCreateContext) { /* use the newer API if available */ ~~ ^~~~~~~~~~~~~~~~ curl/lib/vtls/sectransp.c:1103:6: note: prefix with the address-of operator to silence this warning if(SSLCreateContext) { /* use the newer API if available */ ^ & ``` Ref: https://github.com/curl/curl/actions/runs/9819538439/job/27113201384#step:8:382 llvm `-Wpointer-bool-conversion`: ``` curl/lib/vtls/sectransp.c:2663:8: error: address of function 'SSLCreateContext' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] if(SSLCreateContext) ~~ ^~~~~~~~~~~~~~~~ curl/lib/vtls/sectransp.c:2663:8: note: prefix with the address-of operator to silence this warning if(SSLCreateContext) ^ & ``` Ref: https://github.com/curl/curl/actions/runs/9819538439/job/27113200291#step:8:417 gcc still needs `-Waddress` suppressed to avoid these: ``` curl/lib/vtls/n/sectransp.c: In function 'getsubject': curl/lib/vtls/n/sectransp.c:379:6: warning: the address of 'SecCertificateCopyLongDescription' will always evaluate as 'true' [-Waddress] 379 | if(&SecCertificateCopyLongDescription) | ^ [...] ``` Follow-up to 59cadacfcc1d39472245979cdbd614c7a9af6f0d #14128 Follow-up to af271ce9b9717ba289417e9cbb7f278c2a12f959 #1722 Follow-up to 2b7ce3f56dfede107113c6de7d0ca457109d3eda #1706 Cherry-picked from #14097 Closes #14162
show more ...
|
#
59cadacf |
| 06-Jul-2024 |
Viktor Szakats |
build: sync warning options between autotools, cmake & compilers - cmake: enable Apple-specific `-Werror=partial-availability` to match autotools. - autotools: enable `-pedant
build: sync warning options between autotools, cmake & compilers - cmake: enable Apple-specific `-Werror=partial-availability` to match autotools. - autotools: enable `-pedantic-errors` with llvm/clang to match gcc and CMake. - autotools: enable `-Werror-implicit-function-declaration` for llvm/clang to match gcc. - cmake: enable `-Werror-implicit-function-declaration` to match autotools. - move `-Wpointer-bool-conversion` from autotools to the local file (`sectransp.c`) it was meant to apply. This way it applies to all build methods. - autotoos: show `CURL_CFLAG_EXTRAS` in the `./configure` summary. (it may contain `-Werror` and/or `-pedentic-errors`.) Cherry-picked from #14097 Closes #14128
show more ...
|
#
46a26f12 |
| 08-Jul-2024 |
Stefan Eissing |
vtls: replace addsessionid with set_sessionid - deduplicate the code in many tls backends that check for an existing id and delete it before adding the new one - rename ssl_primary
vtls: replace addsessionid with set_sessionid - deduplicate the code in many tls backends that check for an existing id and delete it before adding the new one - rename ssl_primary_config's `sessionid` bool to `cache_session` Closes #14121
show more ...
|
#
b05dc7eb |
| 06-Jul-2024 |
Viktor Szakats |
sectransp: fix `HAVE_BUILTIN_AVAILABLE` checks to not emit warnings `HAVE_BUILTIN_AVAILABLE` is a curl macro set via autotools and cmake. Like other `HAVE_`s it signals availability if d
sectransp: fix `HAVE_BUILTIN_AVAILABLE` checks to not emit warnings `HAVE_BUILTIN_AVAILABLE` is a curl macro set via autotools and cmake. Like other `HAVE_`s it signals availability if defined. SecureTransport code was specifically looking for the value 1, which triggered compiler warnings when the feature was not present. Replace the existing workaround of locally suppressing the compiler warning with using `defined()`. autotools: ``` 767 | #if (CURL_BUILD_MAC_10_13 || CURL_BUILD_IOS_11) && HAVE_BUILTIN_AVAILABLE == 1 | ^~~~~~~~~~~~~~~~~~~~~~ ../../lib/vtls/sectransp.c: In function 'sectransp_connect_step1': ../../lib/vtls/sectransp.c:1140:52: error: "HAVE_BUILTIN_AVAILABLE" is not defined, evaluates to 0 [-Werror=undef] 1140 | #if (CURL_BUILD_MAC_10_13 || CURL_BUILD_IOS_11) && HAVE_BUILTIN_AVAILABLE == 1 | ^~~~~~~~~~~~~~~~~~~~~~ ../../lib/vtls/sectransp.c:1240:52: error: "HAVE_BUILTIN_AVAILABLE" is not defined, evaluates to 0 [-Werror=undef] 1240 | #if (CURL_BUILD_MAC_10_13 || CURL_BUILD_IOS_11) && HAVE_BUILTIN_AVAILABLE == 1 | ^~~~~~~~~~~~~~~~~~~~~~ ../../lib/vtls/sectransp.c: In function 'sectransp_connect_step2': ``` Ref: https://github.com/curl/curl/actions/runs/9815428701/job/27104448045#step:6:499 cmake gcc: ``` 1140 | #if (CURL_BUILD_MAC_10_13 || CURL_BUILD_IOS_11) && HAVE_BUILTIN_AVAILABLE == 1 | ^~~~~~~~~~~~~~~~~~~~~~ /Users/runner/work/curl/curl/lib/vtls/sectransp.c:1240:52: error: "HAVE_BUILTIN_AVAILABLE" is not defined, evaluates to 0 [-Werror=undef] 1240 | #if (CURL_BUILD_MAC_10_13 || CURL_BUILD_IOS_11) && HAVE_BUILTIN_AVAILABLE == 1 | ^~~~~~~~~~~~~~~~~~~~~~ /Users/runner/work/curl/curl/lib/vtls/sectransp.c: In function 'sectransp_connect_step2': /Users/runner/work/curl/curl/lib/vtls/sectransp.c:2231:51: error: "HAVE_BUILTIN_AVAILABLE" is not defined, evaluates to 0 [-Werror=undef] 2231 | #if(CURL_BUILD_MAC_10_13 || CURL_BUILD_IOS_11) && HAVE_BUILTIN_AVAILABLE == 1 | ^~~~~~~~~~~~~~~~~~~~~~ ``` Ref: https://github.com/curl/curl/actions/runs/9815428701/job/27104445425#step:8:355 Cherry-picked from #14097 Closes #14122
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 ...
|
#
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 ...
|
#
c31041b1 |
| 07-Jun-2024 |
Stefan Eissing |
connection: shutdown TLS (for FTP) better This adds connection shutdown infrastructure and first use for FTP. FTP data connections, when not encountering an error, are now shut down in a
connection: shutdown TLS (for FTP) better This adds connection shutdown infrastructure and first use for FTP. FTP data connections, when not encountering an error, are now shut down in a blocking way with a 2sec timeout. - add cfilter `Curl_cft_shutdown` callback - keep a shutdown start timestamp and timeout at connectdata - provide shutdown timeout default and member in `data->set.shutdowntimeout`. - provide methods for starting, interrogating and clearing shutdown timers - provide `Curl_conn_shutdown_blocking()` to shutdown the `sockindex` filter chain in a blocking way. Use that in FTP. - add `Curl_conn_cf_poll()` to wait for socket events during shutdown of a connection filter chain. This gets the monitoring sockets and events via the filters "adjust_pollset()" methods. This gives correct behaviour when shutting down a TLS connection through a HTTP/2 proxy. - Implement shutdown for all socket filters - for HTTP/2 and h2 proxying to send GOAWAY - for TLS backends to the best of their capabilities - for tcp socket filter to make a final, nonblocking receive to avoid unwanted RST states - add shutdown forwarding to happy eyeballers and https connect ballers when applicable. Closes #13904
show more ...
|
#
937ba94e |
| 04-Jun-2024 |
Stefan Eissing |
vtls: new io_need flags for poll handling - decouple need to recv/send from negotiation state, we need this later in shutdown handling as well - move ssl enums from urldata.h to vt
vtls: new io_need flags for poll handling - decouple need to recv/send from negotiation state, we need this later in shutdown handling as well - move ssl enums from urldata.h to vtls_int.h - implement use of `connssl->io_need` in vtls.c. and all backends Closes #13879
show more ...
|
#
08872971 |
| 13-May-2024 |
Viktor Szakats |
lib/v*: tidy up types and casts Also add a couple of negative checks. Cherry-picked from #13489 Closes #13622
|
#
4e2c4511 |
| 29-May-2024 |
Jan Venekamp <1422460+jan2000@users.noreply.github.com> |
sectransp: remove large cipher table Previously a large table of ciphers was used to determine the default ciphers and to lookup manually selected ciphers names. With the lookup
sectransp: remove large cipher table Previously a large table of ciphers was used to determine the default ciphers and to lookup manually selected ciphers names. With the lookup of the manually selected cipher names moved to Curl_cipher_suite_walk_str() the large table is no longer needed for that purpose. The list of manually selected cipher can now be intersected with the ciphers supported by Secure Transport (SSLGetSupportedCiphers()), instead of using the fixed table for that. The other use of the table was to filter the list of all supported ciphers offered by Secure Transport to create a list of ciphers to use by default, excluding ciphers in the table marked as weak. Instead of using a complement based approach (exclude weak), switch to using an intersection with a smaller list of ciphers deemed appropriate. Closes #13823
show more ...
|
#
2b52fe41 |
| 08-May-2024 |
Jan Venekamp <1422460+jan2000@users.noreply.github.com> |
sectransp: 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 fba9afe. Clo
sectransp: 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 fba9afe. Closes #13521
show more ...
|