HTTP3: initial (experimental) support

USe configure --with-ngtcp2 or --with-quiche

Using either option will enable a HTTP3 build.
Co-authored-by: Alessandro Ghedini <alessandro@ghedini.me>

Closes #3500
This commit is contained in:
Daniel Stenberg 2019-07-21 23:48:58 +02:00
parent 7644abf8e8
commit 3af0e76d1e
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
33 changed files with 2520 additions and 23 deletions

View file

@ -258,6 +258,7 @@ struct OperationConfig {
0 is valid. default: CURL_HET_DEFAULT. */
bool haproxy_protocol; /* whether to send HAProxy protocol v1 */
bool disallow_username_in_url; /* disallow usernames in URLs */
bool h3direct; /* go HTTP/3 directly */
struct GlobalConfig *global;
struct OperationConfig *prev;
struct OperationConfig *next; /* Always last in the struct */

View file

@ -200,6 +200,7 @@ static const struct LongShort aliases[]= {
{"01", "http1.1", ARG_NONE},
{"02", "http2", ARG_NONE},
{"03", "http2-prior-knowledge", ARG_NONE},
{"04", "http3-direct", ARG_NONE},
{"09", "http0.9", ARG_BOOL},
{"1", "tlsv1", ARG_NONE},
{"10", "tlsv1.0", ARG_NONE},
@ -1189,10 +1190,14 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
/* HTTP version 2.0 */
config->httpversion = CURL_HTTP_VERSION_2_0;
break;
case '3':
case '3': /* --http2-prior-knowledge */
/* HTTP version 2.0 over clean TCP*/
config->httpversion = CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE;
break;
case '4': /* --http3-direct */
/* HTTP version 3 over QUIC - at once */
config->h3direct = toggle;
break;
case '9':
/* Allow HTTP/0.9 responses! */
config->http09_allowed = toggle;

View file

@ -191,6 +191,8 @@ static const struct helptxt helptext[] = {
"Use HTTP 2"},
{" --http2-prior-knowledge",
"Use HTTP 2 without HTTP/1.1 Upgrade"},
{" --http3-direct",
"Use HTTP v3"},
{" --ignore-content-length",
"Ignore the size of the remote resource"},
{"-i, --include",
@ -530,6 +532,7 @@ static const struct feat feats[] = {
{"CharConv", CURL_VERSION_CONV},
{"TLS-SRP", CURL_VERSION_TLSAUTH_SRP},
{"HTTP2", CURL_VERSION_HTTP2},
{"HTTP3", CURL_VERSION_HTTP3},
{"UnixSockets", CURL_VERSION_UNIX_SOCKETS},
{"HTTPS-proxy", CURL_VERSION_HTTPS_PROXY},
{"MultiSSL", CURL_VERSION_MULTI_SSL},

View file

@ -1118,6 +1118,9 @@ static CURLcode create_transfers(struct GlobalConfig *global,
if(config->tcp_fastopen)
my_setopt(curl, CURLOPT_TCP_FASTOPEN, 1L);
if(config->h3direct)
my_setopt(curl, CURLOPT_H3, CURLH3_DIRECT);
/* where to store */
my_setopt(curl, CURLOPT_WRITEDATA, per);
my_setopt(curl, CURLOPT_INTERLEAVEDATA, per);