diff mbox series

[10/14] suricatta: Adapt to CHANNEL_PARSE_NONE

Message ID 20200914145712.4989-10-christian.storm@siemens.com
State Accepted
Headers show
Series [01/14] channel_curl: Make setting request_body symmetric | expand

Commit Message

Storm, Christian Sept. 14, 2020, 2:57 p.m. UTC
Adapt suricatta modules to CHANNEL_PARSE_NONE instead of CHANNEL_PARSE_RAW
where CHANNEL_PARSE_RAW was used but the response body actually not.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 suricatta/server_general.c |  2 +-
 suricatta/server_hawkbit.c | 11 ++---------
 2 files changed, 3 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/suricatta/server_general.c b/suricatta/server_general.c
index e346295..57c09a8 100644
--- a/suricatta/server_general.c
+++ b/suricatta/server_general.c
@@ -106,7 +106,7 @@  static channel_data_t channel_data_defaults = {.debug = false,
 #ifdef CONFIG_SURICATTA_SSL
 					       .usessl = true,
 #endif
-					       .format = CHANNEL_PARSE_RAW,
+					       .format = CHANNEL_PARSE_NONE,
 					       .nocheckanswer = true,
 					       .nofollow = true,
 					       .strictssl = true};
diff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c
index 05337f4..95a0a8b 100644
--- a/suricatta/server_hawkbit.c
+++ b/suricatta/server_hawkbit.c
@@ -316,6 +316,7 @@  server_op_res_t server_send_cancel_reply(channel_t *channel, const int action_id
 	channel_data_reply.url = url;
 	channel_data_reply.request_body = json_reply_string;
 	channel_data_reply.method = CHANNEL_POST;
+	channel_data_reply.format = CHANNEL_PARSE_NONE;
 	result = map_channel_retcode(channel->put(channel, (void *)&channel_data_reply));
 
 cleanup:
@@ -325,11 +326,6 @@  cleanup:
 	if (json_reply_string != NULL) {
 		free(json_reply_string);
 	}
-	if (channel_data_reply.json_reply != NULL &&
-	    json_object_put(channel_data_reply.json_reply) !=
-		JSON_OBJECT_FREED) {
-		ERROR("JSON object should be freed but was not.");
-	}
 
 	/*
 	 * Send always a notification
@@ -433,6 +429,7 @@  server_send_deployment_reply(channel_t *channel,
 	}
 	channel_data.url = url;
 	channel_data.request_body = json_reply_string;
+	channel_data.format = CHANNEL_PARSE_NONE;
 	channel_data.method = CHANNEL_POST;
 	result = map_channel_retcode(channel->put(channel, (void *)&channel_data));
 
@@ -445,10 +442,6 @@  cleanup:
 	if (json_reply_string != NULL) {
 		free(json_reply_string);
 	}
-	if (channel_data.json_reply != NULL &&
-	    json_object_put(channel_data.json_reply) != JSON_OBJECT_FREED) {
-		ERROR("JSON object should be freed but was not.");
-	}
 	return result;
 }