diff mbox series

[10/13] channel_curl: allow different content-type for send and receive

Message ID 20231120155459.45188-11-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
Allow to have different content-type. This can happen when a file is
uploaded, and the server answers with a message about the status.

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

Patch

diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c
index 27b31247..4ac089b8 100644
--- a/corelib/channel_curl.c
+++ b/corelib/channel_curl.c
@@ -547,6 +547,8 @@  static channel_op_res_t channel_set_content_type(channel_t *this,
 		}
 	}
 
+	if (channel_data->accept_content_type)
+		content = channel_data->accept_content_type;
 	if (ENOMEM_ASPRINTF == asprintf(&accept, "Accept: %s", content)) {
 		ERROR("OOM when setting Accept.");
 		result = CHANNEL_EINIT;
diff --git a/include/channel_curl.h b/include/channel_curl.h
index b3b51e85..b346a6c5 100644
--- a/include/channel_curl.h
+++ b/include/channel_curl.h
@@ -61,6 +61,7 @@  typedef struct {
 	char *info;
 	char *auth_token;
 	const char *content_type;
+	const char *accept_content_type;
 	unsigned int retry_sleep;
 	unsigned int offs;
 	unsigned int method;