]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
http: reset the header buffer when sending the request
authorDaniel Stenberg <daniel@haxx.se>
Thu, 6 May 2021 07:35:18 +0000 (09:35 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 6 May 2021 21:28:45 +0000 (23:28 +0200)
A reused transfer handle could otherwise reuse the previous leftover
buffer and havoc would ensue.

Reported-by: sergio-nsk on github
Fixes #7018
Closes #7021

lib/http.c

index b42d37efa5386f5231d29f45dcafac144de49de1..eece05513e2e829b0d014251146bddbb70b71f13 100644 (file)
@@ -3120,6 +3120,10 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
   /* initialize a dynamic send-buffer */
   Curl_dyn_init(&req, DYN_HTTP_REQUEST);
 
+  /* make sure the header buffer is reset - if there are leftovers from a
+     previous transfer */
+  Curl_dyn_reset(&data->state.headerb);
+
   /* add the main request stuff */
   /* GET/HEAD/POST/PUT */
   result = Curl_dyn_addf(&req, "%s ", request);