From bc8674d87d6c5dd6f87aa61214b0b295cad746d0 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 25 Oct 2021 17:10:21 +0200 Subject: c-hyper: make CURLOPT_SUPPRESS_CONNECT_HEADERS work Verified by the enabled test 1288 Closes #7905 --- lib/c-hyper.c | 36 ++++++++++++++++++++---------------- lib/http_proxy.c | 3 +++ tests/data/DISABLED | 1 - 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/lib/c-hyper.c b/lib/c-hyper.c index c691544b7..c253cd36e 100644 --- a/lib/c-hyper.c +++ b/lib/c-hyper.c @@ -156,13 +156,15 @@ static int hyper_each_header(void *userdata, Curl_debug(data, CURLINFO_HEADER_IN, headp, len); - writetype = CLIENTWRITE_HEADER; - if(data->set.include_header) - writetype |= CLIENTWRITE_BODY; - result = Curl_client_write(data, writetype, headp, len); - if(result) { - data->state.hresult = CURLE_ABORTED_BY_CALLBACK; - return HYPER_ITER_BREAK; + if(!data->state.hconnect || !data->set.suppress_connect_headers) { + writetype = CLIENTWRITE_HEADER; + if(data->set.include_header) + writetype |= CLIENTWRITE_BODY; + result = Curl_client_write(data, writetype, headp, len); + if(result) { + data->state.hresult = CURLE_ABORTED_BY_CALLBACK; + return HYPER_ITER_BREAK; + } } data->info.header_size += (long)len; @@ -284,16 +286,18 @@ static CURLcode status_line(struct Curl_easy *data, len = Curl_dyn_len(&data->state.headerb); Curl_debug(data, CURLINFO_HEADER_IN, Curl_dyn_ptr(&data->state.headerb), len); - writetype = CLIENTWRITE_HEADER; - if(data->set.include_header) - writetype |= CLIENTWRITE_BODY; - result = Curl_client_write(data, writetype, - Curl_dyn_ptr(&data->state.headerb), len); - if(result) { - data->state.hresult = CURLE_ABORTED_BY_CALLBACK; - return HYPER_ITER_BREAK; - } + if(!data->state.hconnect || !data->set.suppress_connect_headers) { + writetype = CLIENTWRITE_HEADER; + if(data->set.include_header) + writetype |= CLIENTWRITE_BODY; + result = Curl_client_write(data, writetype, + Curl_dyn_ptr(&data->state.headerb), len); + if(result) { + data->state.hresult = CURLE_ABORTED_BY_CALLBACK; + return HYPER_ITER_BREAK; + } + } data->info.header_size += (long)len; data->req.headerbytecount += (long)len; data->req.httpcode = http_status; diff --git a/lib/http_proxy.c b/lib/http_proxy.c index 5244a25bb..fc050a07d 100644 --- a/lib/http_proxy.c +++ b/lib/http_proxy.c @@ -213,6 +213,9 @@ static void connect_done(struct Curl_easy *data) data->info.httpcode = 0; /* clear it as it might've been used for the proxy */ data->req.ignorebody = FALSE; +#ifdef USE_HYPER + data->state.hconnect = FALSE; +#endif infof(data, "CONNECT phase completed!"); } } diff --git a/tests/data/DISABLED b/tests/data/DISABLED index 6856112d4..591b01d3d 100644 --- a/tests/data/DISABLED +++ b/tests/data/DISABLED @@ -64,7 +64,6 @@ 1021 1156 1160 -1288 1294 1417 1430 -- cgit v1.2.1