]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
c-hyper: make CURLOPT_SUPPRESS_CONNECT_HEADERS work
authorDaniel Stenberg <daniel@haxx.se>
Mon, 25 Oct 2021 15:10:21 +0000 (17:10 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 25 Oct 2021 21:32:45 +0000 (23:32 +0200)
Verified by the enabled test 1288

Closes #7905

lib/c-hyper.c
lib/http_proxy.c
tests/data/DISABLED

index c691544b7ba5825aeb9d8c2a9acecda21c3d29d3..c253cd36eda17fac85515cbaeccac5616da34531 100644 (file)
@@ -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;
index 5244a25bba5f088cfb1c52b6c4ad25d0631c5214..fc050a07d5956b2c9c3a29894fa4f827812add15 100644 (file)
@@ -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!");
   }
 }
index 6856112d4a32a7dfa5971d8fef440304ade04316..591b01d3dbbfa03faf778e1d353c2d3597fe6ae0 100644 (file)
@@ -64,7 +64,6 @@
 1021
 1156
 1160
-1288
 1294
 1417
 1430