From: Daniel Stenberg Date: Thu, 6 May 2021 07:35:18 +0000 (+0200) Subject: http: reset the header buffer when sending the request X-Git-Tag: curl-7_77_0~78 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=04cc27460ea15943873de6dac4983e52e3645756;p=thirdparty%2Fcurl.git http: reset the header buffer when sending the request 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 --- diff --git a/lib/http.c b/lib/http.c index b42d37efa5..eece05513e 100644 --- a/lib/http.c +++ b/lib/http.c @@ -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);