On-behalf-of: SAP stefan.ko...@sap.com
Signed-off-by: Stefan Kober <stefan.ko...@cyberus-technology.de>
---
 src/ch/ch_monitor.c | 40 +---------------------------------------
 1 file changed, 1 insertion(+), 39 deletions(-)

diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c
index 63c8425b4b..5f3e2adbee 100644
--- a/src/ch/ch_monitor.c
+++ b/src/ch/ch_monitor.c
@@ -931,45 +931,7 @@ int
 virCHMonitorPutNoContent(virCHMonitor *mon, const char *endpoint,
                          domainLogContext *logCtxt)
 {
-    VIR_LOCK_GUARD lock = virObjectLockGuard(mon);
-    g_autofree char *url = NULL;
-    int responseCode = 0;
-    int ret = -1;
-    struct curl_data data = {0};
-    struct curl_slist *headers = NULL;
-
-    url = g_strdup_printf("%s/%s", URL_ROOT, endpoint);
-
-    /* reset all options of a libcurl session handle at first */
-    curl_easy_reset(mon->handle);
-
-    curl_easy_setopt(mon->handle, CURLOPT_UNIX_SOCKET_PATH, mon->socketpath);
-    curl_easy_setopt(mon->handle, CURLOPT_URL, url);
-    curl_easy_setopt(mon->handle, CURLOPT_UPLOAD, 1L);
-    curl_easy_setopt(mon->handle, CURLOPT_HTTPHEADER, NULL);
-    curl_easy_setopt(mon->handle, CURLOPT_INFILESIZE, 0L);
-
-    headers = curl_slist_append(headers, "Accept: application/json");
-    curl_easy_setopt(mon->handle, CURLOPT_HTTPHEADER, headers);
-    curl_easy_setopt(mon->handle, CURLOPT_WRITEFUNCTION, curl_callback);
-    curl_easy_setopt(mon->handle, CURLOPT_WRITEDATA, (void *)&data);
-
-    responseCode = virCHMonitorCurlPerform(mon->handle);
-
-    if (logCtxt && data.size) {
-        /* Do this to append a NULL char at the end of data */
-        data.content = g_realloc(data.content, data.size + 1);
-        data.content[data.size] = 0;
-        domainLogContextWrite(logCtxt, "HTTP response code from CH: %d\n", 
responseCode);
-        domainLogContextWrite(logCtxt, "Response = %s\n", data.content);
-    }
-
-    if (responseCode == 200 || responseCode == 204)
-        ret = 0;
-
-    curl_slist_free_all(headers);
-
-    return ret;
+    return virCHMonitorPut(mon, endpoint, NULL, logCtxt, NULL);
 }
 
 static int
-- 
2.50.1

Reply via email to