mirror of
https://github.com/curl/curl.git
synced 2026-07-30 20:18:08 +03:00
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
This commit is contained in:
parent
d0377f5a86
commit
962097b8dd
40 changed files with 899 additions and 134 deletions
|
|
@ -261,6 +261,7 @@ struct OperationConfig {
|
|||
bool xattr; /* store metadata in extended attributes */
|
||||
long gssapi_delegation;
|
||||
bool ssl_allow_beast; /* allow this SSL vulnerability */
|
||||
bool ssl_allow_earlydata; /* allow use of TLSv1.3 early data */
|
||||
bool proxy_ssl_allow_beast; /* allow this SSL vulnerability for proxy */
|
||||
bool ssl_no_revoke; /* disable SSL certificate revocation checks */
|
||||
bool ssl_revoke_best_effort; /* ignore SSL revocation offline/missing
|
||||
|
|
|
|||
|
|
@ -316,6 +316,7 @@ static const struct LongShort aliases[]= {
|
|||
{"tftp-blksize", ARG_STRG, ' ', C_TFTP_BLKSIZE},
|
||||
{"tftp-no-options", ARG_BOOL, ' ', C_TFTP_NO_OPTIONS},
|
||||
{"time-cond", ARG_STRG, 'z', C_TIME_COND},
|
||||
{"tls-earlydata", ARG_BOOL, ' ', C_TLS_EARLYDATA},
|
||||
{"tls-max", ARG_STRG, ' ', C_TLS_MAX},
|
||||
{"tls13-ciphers", ARG_STRG, ' ', C_TLS13_CIPHERS},
|
||||
{"tlsauthtype", ARG_STRG, ' ', C_TLSAUTHTYPE},
|
||||
|
|
@ -1691,6 +1692,10 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
|
|||
config->abstract_unix_socket = TRUE;
|
||||
err = getstr(&config->unix_socket_path, nextarg, DENY_BLANK);
|
||||
break;
|
||||
case C_TLS_EARLYDATA: /* --tls-earlydata */
|
||||
if(feature_ssl)
|
||||
config->ssl_allow_earlydata = toggle;
|
||||
break;
|
||||
case C_TLS_MAX: /* --tls-max */
|
||||
err = str2tls_max(&config->ssl_version_max, nextarg);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -271,6 +271,7 @@ typedef enum {
|
|||
C_TFTP_BLKSIZE,
|
||||
C_TFTP_NO_OPTIONS,
|
||||
C_TIME_COND,
|
||||
C_TLS_EARLYDATA,
|
||||
C_TLS_MAX,
|
||||
C_TLS13_CIPHERS,
|
||||
C_TLSAUTHTYPE,
|
||||
|
|
|
|||
|
|
@ -748,6 +748,9 @@ const struct helptxt helptext[] = {
|
|||
{"-z, --time-cond <time>",
|
||||
"Transfer based on a time condition",
|
||||
CURLHELP_HTTP | CURLHELP_FTP},
|
||||
{" --tls-earlydata",
|
||||
"Allow use of TLSv1.3 early data (0RTT)",
|
||||
CURLHELP_TLS},
|
||||
{" --tls-max <VERSION>",
|
||||
"Maximum allowed TLS version",
|
||||
CURLHELP_TLS},
|
||||
|
|
|
|||
|
|
@ -1932,6 +1932,8 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
|||
long mask =
|
||||
(config->ssl_allow_beast ?
|
||||
CURLSSLOPT_ALLOW_BEAST : 0) |
|
||||
(config->ssl_allow_earlydata ?
|
||||
CURLSSLOPT_EARLYDATA : 0) |
|
||||
(config->ssl_no_revoke ?
|
||||
CURLSSLOPT_NO_REVOKE : 0) |
|
||||
(config->ssl_revoke_best_effort ?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue