mirror of
https://github.com/curl/curl.git
synced 2025-09-16 17:12:43 +03:00
http3: fix the HTTP/3 in the request, make alt-svc set right versions
Closes #4200
This commit is contained in:
parent
98c3f14871
commit
a93b43cde8
17
lib/http.c
17
lib/http.c
|
@ -1666,6 +1666,12 @@ static bool use_http_1_1plus(const struct Curl_easy *data,
|
||||||
static const char *get_http_string(const struct Curl_easy *data,
|
static const char *get_http_string(const struct Curl_easy *data,
|
||||||
const struct connectdata *conn)
|
const struct connectdata *conn)
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_QUIC
|
||||||
|
if((data->set.httpversion == CURL_HTTP_VERSION_3) ||
|
||||||
|
(conn->httpversion == 30))
|
||||||
|
return "3";
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_NGHTTP2
|
#ifdef USE_NGHTTP2
|
||||||
if(conn->proto.httpc.h2)
|
if(conn->proto.httpc.h2)
|
||||||
return "2";
|
return "2";
|
||||||
|
@ -2005,8 +2011,9 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
||||||
the rest of the request in the PERFORM phase. */
|
the rest of the request in the PERFORM phase. */
|
||||||
*done = TRUE;
|
*done = TRUE;
|
||||||
|
|
||||||
if(conn->httpversion < 20) { /* unless the connection is re-used and already
|
if(conn->transport != TRNSPRT_QUIC) {
|
||||||
http2 */
|
if(conn->httpversion < 20) { /* unless the connection is re-used and
|
||||||
|
already http2 */
|
||||||
switch(conn->negnpn) {
|
switch(conn->negnpn) {
|
||||||
case CURL_HTTP_VERSION_2:
|
case CURL_HTTP_VERSION_2:
|
||||||
conn->httpversion = 20; /* we know we're on HTTP/2 now */
|
conn->httpversion = 20; /* we know we're on HTTP/2 now */
|
||||||
|
@ -2024,8 +2031,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
||||||
if(conn->data->set.httpversion ==
|
if(conn->data->set.httpversion ==
|
||||||
CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE) {
|
CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE) {
|
||||||
if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) {
|
if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) {
|
||||||
/* We don't support HTTP/2 proxies yet. Also it's debatable whether
|
/* We don't support HTTP/2 proxies yet. Also it's debatable
|
||||||
or not this setting should apply to HTTP/2 proxies. */
|
whether or not this setting should apply to HTTP/2 proxies. */
|
||||||
infof(data, "Ignoring HTTP/2 prior knowledge due to proxy\n");
|
infof(data, "Ignoring HTTP/2 prior knowledge due to proxy\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2047,7 +2054,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
http = data->req.protop;
|
http = data->req.protop;
|
||||||
DEBUGASSERT(http);
|
DEBUGASSERT(http);
|
||||||
|
|
||||||
|
|
|
@ -3195,14 +3195,14 @@ static CURLcode parse_connect_to_slist(struct Curl_easy *data,
|
||||||
/* protocol version switch */
|
/* protocol version switch */
|
||||||
switch(nalpnid) {
|
switch(nalpnid) {
|
||||||
case ALPN_h1:
|
case ALPN_h1:
|
||||||
conn->httpversion = CURL_HTTP_VERSION_1_1;
|
conn->httpversion = 11;
|
||||||
break;
|
break;
|
||||||
case ALPN_h2:
|
case ALPN_h2:
|
||||||
conn->httpversion = CURL_HTTP_VERSION_2TLS;
|
conn->httpversion = 20;
|
||||||
break;
|
break;
|
||||||
case ALPN_h3:
|
case ALPN_h3:
|
||||||
conn->transport = TRNSPRT_QUIC;
|
conn->transport = TRNSPRT_QUIC;
|
||||||
conn->httpversion = CURL_HTTP_VERSION_3;
|
conn->httpversion = 30;
|
||||||
break;
|
break;
|
||||||
default: /* shouldn't be possible */
|
default: /* shouldn't be possible */
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user