]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
write_http plugin: Clear the response buffer before issuing the request.
authorFlorian Forster <octo@collectd.org>
Sun, 17 Dec 2023 07:57:15 +0000 (08:57 +0100)
committerFlorian Forster <octo@collectd.org>
Wed, 3 Jan 2024 15:39:36 +0000 (16:39 +0100)
Previously all responses were concatenated together until the buffer was
full, at which point no additional responses were accessible.

src/write_http.c

index e0b69163d08f26a230ae25edcd7d6c3d9b06656f..a057709781f045f7e2c5fa934ef72bd3ce189212 100644 (file)
@@ -149,6 +149,7 @@ static void wh_log_http_error(wh_callback_t *cb) {
 static int wh_post(wh_callback_t *cb, char const *data, long size) {
   pthread_mutex_lock(&cb->curl_lock);
 
+  cb->response_buffer_pos = 0;
   curl_easy_setopt(cb->curl, CURLOPT_URL, cb->location);
   curl_easy_setopt(cb->curl, CURLOPT_POSTFIELDSIZE, size);
   curl_easy_setopt(cb->curl, CURLOPT_POSTFIELDS, data);