From a166bb840277c86f1a6ea784c61daea5aecc05ef Mon Sep 17 00:00:00 2001 From: Stephen Procter Date: Mon, 5 Aug 2024 14:35:49 +0400 Subject: [PATCH] Problem: zhttp_client does not support PUT or PATCH Solution: Add support for PUT and PATCH methods. --- src/zhttp_client.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/zhttp_client.c b/src/zhttp_client.c index 7ebae5c41..0164e8989 100644 --- a/src/zhttp_client.c +++ b/src/zhttp_client.c @@ -216,9 +216,13 @@ static void zhttp_client_actor (zsock_t *pipe, void *args) { curl_easy_setopt (curl, CURLOPT_HEADERDATA, request); curl_easy_setopt (curl, CURLOPT_PRIVATE, request); - if (streq (command, "POST")) { + if (streq (command, "POST") || streq (command, "PUT") || + streq (command, "PATCH")) { curl_easy_setopt (curl, CURLOPT_POSTFIELDS, content); curl_easy_setopt (curl, CURLOPT_POSTFIELDSIZE, content ? strlen (content) : 0); + + if (strneq (command, "POST")) + curl_easy_setopt (curl, CURLOPT_CUSTOMREQUEST, command); } code = curl_multi_add_handle (multi, curl);