diff options
Diffstat (limited to 'libs/libcurl/src/http_proxy.c')
| -rw-r--r-- | libs/libcurl/src/http_proxy.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/libs/libcurl/src/http_proxy.c b/libs/libcurl/src/http_proxy.c index 684bd738b6..892ac56449 100644 --- a/libs/libcurl/src/http_proxy.c +++ b/libs/libcurl/src/http_proxy.c @@ -29,9 +29,6 @@ #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_PROXY)
#include <curl/curl.h>
-#ifdef USE_HYPER
-#include <hyper.h>
-#endif
#include "sendf.h"
#include "http.h"
#include "url.h"
@@ -59,7 +56,7 @@ static bool hd_name_eq(const char *n1, size_t n1len, }
static CURLcode dynhds_add_custom(struct Curl_easy *data,
- bool is_connect,
+ bool is_connect, int httpversion,
struct dynhds *hds)
{
struct connectdata *conn = data->conn;
@@ -172,9 +169,9 @@ static CURLcode dynhds_add_custom(struct Curl_easy *data, Connection: */
hd_name_eq(name, namelen, STRCONST("Connection:")))
;
- else if((conn->httpversion >= 20) &&
+ else if((httpversion >= 20) &&
hd_name_eq(name, namelen, STRCONST("Transfer-Encoding:")))
- /* HTTP/2 does not support chunked requests */
+ /* HTTP/2 and HTTP/3 do not support chunked requests */
;
else if((hd_name_eq(name, namelen, STRCONST("Authorization:")) ||
hd_name_eq(name, namelen, STRCONST("Cookie:"))) &&
@@ -224,11 +221,18 @@ CURLcode Curl_http_proxy_get_destination(struct Curl_cfilter *cf, return CURLE_OK;
}
+struct cf_proxy_ctx {
+ /* the protocol specific sub-filter we install during connect */
+ struct Curl_cfilter *cf_protocol;
+ int httpversion; /* HTTP version used to CONNECT */
+};
+
CURLcode Curl_http_proxy_create_CONNECT(struct httpreq **preq,
struct Curl_cfilter *cf,
struct Curl_easy *data,
int http_version_major)
{
+ struct cf_proxy_ctx *ctx = cf->ctx;
const char *hostname = NULL;
char *authority = NULL;
int port;
@@ -289,7 +293,7 @@ CURLcode Curl_http_proxy_create_CONNECT(struct httpreq **preq, goto out;
}
- result = dynhds_add_custom(data, TRUE, &req->headers);
+ result = dynhds_add_custom(data, TRUE, ctx->httpversion, &req->headers);
out:
if(result && req) {
@@ -301,12 +305,6 @@ out: return result;
}
-
-struct cf_proxy_ctx {
- /* the protocol specific sub-filter we install during connect */
- struct Curl_cfilter *cf_protocol;
-};
-
static CURLcode http_proxy_cf_connect(struct Curl_cfilter *cf,
struct Curl_easy *data,
bool blocking, bool *done)
@@ -328,6 +326,7 @@ connect_sub: *done = FALSE;
if(!ctx->cf_protocol) {
struct Curl_cfilter *cf_protocol = NULL;
+ int httpversion = 0;
int alpn = Curl_conn_cf_is_ssl(cf->next) ?
cf->conn->proxy_alpn : CURL_HTTP_VERSION_1_1;
@@ -343,6 +342,7 @@ connect_sub: if(result)
goto out;
cf_protocol = cf->next;
+ httpversion = (alpn == CURL_HTTP_VERSION_1_0) ? 10 : 11;
break;
#ifdef USE_NGHTTP2
case CURL_HTTP_VERSION_2:
@@ -352,6 +352,7 @@ connect_sub: if(result)
goto out;
cf_protocol = cf->next;
+ httpversion = 20;
break;
#endif
default:
@@ -361,6 +362,7 @@ connect_sub: }
ctx->cf_protocol = cf_protocol;
+ ctx->httpversion = httpversion;
/* after we installed the filter "below" us, we call connect
* on out sub-chain again.
*/
|
