summaryrefslogtreecommitdiffstats
path: root/aclk/aclk_rx_msgs.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 11:19:16 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 12:07:37 +0000
commitb485aab7e71c1625cfc27e0f92c9509f42378458 (patch)
treeae9abe108601079d1679194de237c9a435ae5b55 /aclk/aclk_rx_msgs.c
parentAdding upstream version 1.44.3. (diff)
downloadnetdata-upstream.tar.xz
netdata-upstream.zip
Adding upstream version 1.45.3+dfsg.upstream/1.45.3+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/aclk/aclk_rx_msgs.c (renamed from aclk/aclk_rx_msgs.c)15
1 files changed, 9 insertions, 6 deletions
diff --git a/aclk/aclk_rx_msgs.c b/src/aclk/aclk_rx_msgs.c
index 0e91e28c0..fb6a2b902 100644
--- a/aclk/aclk_rx_msgs.c
+++ b/src/aclk/aclk_rx_msgs.c
@@ -11,7 +11,6 @@
#include "schema-wrappers/proto_2_json.h"
#define ACLK_V2_PAYLOAD_SEPARATOR "\x0D\x0A\x0D\x0A"
-#define ACLK_CLOUD_REQ_V2_PREFIX "GET /"
#define ACLK_V_COMPRESSION 2
@@ -100,13 +99,17 @@ static inline int aclk_v2_payload_get_query(const char *payload, char **query_ur
{
const char *start, *end;
- // TODO better check of URL
- if(strncmp(payload, ACLK_CLOUD_REQ_V2_PREFIX, strlen(ACLK_CLOUD_REQ_V2_PREFIX))) {
+ if(strncmp(payload, "GET /", 5) == 0 || strncmp(payload, "PUT /", 5) == 0)
+ start = payload + 4;
+ else if(strncmp(payload, "POST /", 6) == 0)
+ start = payload + 5;
+ else if(strncmp(payload, "DELETE /", 8) == 0)
+ start = payload + 7;
+ else {
errno = 0;
- netdata_log_error("Only accepting requests that start with \"%s\" from CLOUD.", ACLK_CLOUD_REQ_V2_PREFIX);
+ netdata_log_error("Only accepting requests that start with GET, POST, PUT, DELETE from CLOUD.");
return 1;
}
- start = payload + 4;
if(!(end = strstr(payload, HTTP_1_1 HTTP_ENDL))) {
errno = 0;
@@ -196,7 +199,7 @@ int aclk_handle_cloud_cmd_message(char *payload)
// Originally we were expecting to have multiple types of 'cmd' message,
// but after the new protocol was designed we will ever only have 'http'
- if (strcmp(cloud_to_agent.type_id, "http")) {
+ if (strcmp(cloud_to_agent.type_id, "http") != 0) {
error_report("Only 'http' cmd message is supported");
goto err_cleanup;
}