diff options
author | Daniel Stenberg <daniel@haxx.se> | 2022-12-08 17:47:54 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2022-12-08 23:36:23 +0100 |
commit | c8d24d4e77d5cb1b1e30e847ea3dc26942bf235c (patch) | |
tree | 00fed527b0d840ca5672e35f0b2781cdfed6707f /lib/c-hyper.c | |
parent | d31915a8dbbd8cb3c122a847efdd62c1fd6d1078 (diff) | |
download | curl-c8d24d4e77d5cb1b1e30e847ea3dc26942bf235c.tar.gz |
c-hyper: CONNECT respones are not server responses
Together with d31915a8dbbd it makes test 265 run fine.
Fixes #8853
Assisted-by: Prithvi MK
Assisted-by: Sean McArthur
Closes #10060
Diffstat (limited to 'lib/c-hyper.c')
-rw-r--r-- | lib/c-hyper.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/lib/c-hyper.c b/lib/c-hyper.c index ad7a88df9..6e5e1ab1f 100644 --- a/lib/c-hyper.c +++ b/lib/c-hyper.c @@ -174,8 +174,8 @@ static int hyper_each_header(void *userdata, } } - data->info.header_size += (long)len; - data->req.headerbytecount += (long)len; + data->info.header_size += (curl_off_t)len; + data->req.headerbytecount += (curl_off_t)len; return HYPER_ITER_CONTINUE; } @@ -264,23 +264,25 @@ static CURLcode status_line(struct Curl_easy *data, int writetype; vstr = http_version == HYPER_HTTP_VERSION_1_1 ? "1.1" : (http_version == HYPER_HTTP_VERSION_2 ? "2" : "1.0"); - conn->httpversion = - http_version == HYPER_HTTP_VERSION_1_1 ? 11 : - (http_version == HYPER_HTTP_VERSION_2 ? 20 : 10); - if(http_version == HYPER_HTTP_VERSION_1_0) - data->state.httpwant = CURL_HTTP_VERSION_1_0; - - if(data->state.hconnect) - /* CONNECT */ - data->info.httpproxycode = http_status; /* We need to set 'httpcodeq' for functions that check the response code in a single place. */ data->req.httpcode = http_status; - result = Curl_http_statusline(data, conn); - if(result) - return result; + if(data->state.hconnect) + /* CONNECT */ + data->info.httpproxycode = http_status; + else { + conn->httpversion = + http_version == HYPER_HTTP_VERSION_1_1 ? 11 : + (http_version == HYPER_HTTP_VERSION_2 ? 20 : 10); + if(http_version == HYPER_HTTP_VERSION_1_0) + data->state.httpwant = CURL_HTTP_VERSION_1_0; + + result = Curl_http_statusline(data, conn); + if(result) + return result; + } Curl_dyn_reset(&data->state.headerb); @@ -303,9 +305,8 @@ static CURLcode status_line(struct Curl_easy *data, if(result) return result; } - data->info.header_size += (long)len; - data->req.headerbytecount += (long)len; - data->req.httpcode = http_status; + data->info.header_size += (curl_off_t)len; + data->req.headerbytecount += (curl_off_t)len; return CURLE_OK; } |