diff options
author | Daniel Stenberg <daniel@haxx.se> | 2019-07-21 23:48:58 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2019-07-21 23:49:03 +0200 |
commit | 3af0e76d1e71995b7790c74e79b76af86ee7c681 (patch) | |
tree | b80190acaf03d83f5f408cc6da3ec1a9f831d8d3 /lib/http.c | |
parent | 7644abf8e8101910ed86ab2869b7cc4031b27720 (diff) | |
download | curl-3af0e76d1e71995b7790c74e79b76af86ee7c681.tar.gz |
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
Diffstat (limited to 'lib/http.c')
-rw-r--r-- | lib/http.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/lib/http.c b/lib/http.c index 9fbd7201e..36e94f762 100644 --- a/lib/http.c +++ b/lib/http.c @@ -171,10 +171,22 @@ static CURLcode http_setup_conn(struct connectdata *conn) Curl_mime_initpart(&http->form, conn->data); data->req.protop = http; - if(!CONN_INUSE(conn)) - /* if not already multi-using, setup connection details */ - Curl_http2_setup_conn(conn); - Curl_http2_setup_req(data); + if(data->set.h3opts & CURLH3_DIRECT) { + if(conn->handler->flags & PROTOPT_SSL) + /* Only go h3-direct on HTTPS URLs. It needs a UDP socket and does the + QUIC dance. */ + conn->transport = TRNSPRT_QUIC; + else { + failf(data, "HTTP/3 requested for non-HTTPS URL"); + return CURLE_URL_MALFORMAT; + } + } + else { + if(!CONN_INUSE(conn)) + /* if not already multi-using, setup connection details */ + Curl_http2_setup_conn(conn); + Curl_http2_setup_req(data); + } return CURLE_OK; } @@ -1555,6 +1567,15 @@ static CURLcode https_connecting(struct connectdata *conn, bool *done) CURLcode result; DEBUGASSERT((conn) && (conn->handler->flags & PROTOPT_SSL)); +#ifdef ENABLE_QUIC + if(conn->transport == TRNSPRT_QUIC) { + result = Curl_quic_is_connected(conn, FIRSTSOCKET, done); + if(result) + connclose(conn, "Failed HTTPS connection (over QUIC)"); + return result; + } +#endif + /* perform SSL initialization for this socket */ result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, done); if(result) |