diff mbox series

[11/13] channel_curl: implement DELETE as part of put

Message ID 20231120155459.45188-12-stefano.babic@swupdate.org
State Accepted
Headers show
Series Native Docker Support | expand

Commit Message

Stefano Babic Nov. 20, 2023, 3:54 p.m. UTC
Implement the DELETE API and reuse the put entry point by changing the
HTTP request.

Signed-off-by: Stefano Babic <stefano.babic@swupdate.org>
---
 corelib/channel_curl.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c
index 4ac089b8..c498c666 100644
--- a/corelib/channel_curl.c
+++ b/corelib/channel_curl.c
@@ -1073,6 +1073,10 @@  static channel_op_res_t channel_post_method(channel_t *this, void *data, int met
 			curl_result |= channel_set_read_callback(channel_curl->handle, channel_data);
 		break;
 
+	case CHANNEL_DELETE:
+		curl_result = curl_easy_setopt(channel_curl->handle, CURLOPT_CUSTOMREQUEST, "DELETE");
+		break;
+
 	case CHANNEL_PUT:
 		curl_result = curl_easy_setopt(channel_curl->handle,
 						#if LIBCURL_VERSION_NUM >= 0x70C01
@@ -1135,6 +1139,7 @@  channel_op_res_t channel_put(channel_t *this, void *data)
 	case CHANNEL_PUT:
 	case CHANNEL_POST:
 	case CHANNEL_PATCH:
+	case CHANNEL_DELETE:
 		return channel_post_method(this, data, channel_data->method);
 	default:
 		TRACE("Channel method (POST, PUT, PATCH) is not set !");