@@ -469,12 +469,12 @@ channel_op_res_t channel_set_options(channel_t *this,
if ((curl_easy_setopt(channel_curl->handle, CURLOPT_POST, 1L) !=
CURLE_OK) ||
(curl_easy_setopt(channel_curl->handle, CURLOPT_POSTFIELDS,
- channel_data->json_string) != CURLE_OK)) {
+ channel_data->request_body) != CURLE_OK)) {
result = CHANNEL_EINIT;
goto cleanup;
}
if (channel_data->debug) {
- TRACE("Post JSON: %s\n", channel_data->json_string);
+ TRACE("Posted: %s\n", channel_data->request_body);
}
break;
}
@@ -537,14 +537,14 @@ static size_t put_read_callback(void *ptr, size_t size, size_t nmemb, void *data
size_t n;
/* Check data to be sent */
- bytes = strlen(channel_data->json_string) - channel_data->offs;
+ bytes = strlen(channel_data->request_body) - channel_data->offs;
if (!bytes)
return 0;
n = min(bytes, size * nmemb);
- memcpy(ptr, &channel_data->json_string[channel_data->offs], n);
+ memcpy(ptr, &channel_data->request_body[channel_data->offs], n);
channel_data->offs += n;
return n;
@@ -646,7 +646,7 @@ static channel_op_res_t channel_put_method(channel_t *this, void *data)
if ((curl_easy_setopt(channel_curl->handle, CURLOPT_READFUNCTION, put_read_callback) !=
CURLE_OK) ||
(curl_easy_setopt(channel_curl->handle, CURLOPT_INFILESIZE_LARGE,
- (curl_off_t)strlen(channel_data->json_string)) != CURLE_OK) ||
+ (curl_off_t)strlen(channel_data->request_body)) != CURLE_OK) ||
(curl_easy_setopt(channel_curl->handle, CURLOPT_READDATA, channel_data) !=
CURLE_OK)) {
ERROR("Set channel option failed.\n");
@@ -34,7 +34,7 @@ typedef enum {
typedef struct {
char *url;
char *auth;
- char *json_string;
+ char *request_body;
#ifdef CONFIG_JSON
json_object *json_reply;
#endif
@@ -325,7 +325,7 @@ server_op_res_t server_send_cancel_reply(channel_t *channel, const int action_id
goto cleanup;
}
channel_data_reply.url = url;
- channel_data_reply.json_string = json_reply_string;
+ channel_data_reply.request_body = json_reply_string;
channel_data_reply.method = CHANNEL_POST;
result = map_channel_retcode(channel->put(channel, (void *)&channel_data_reply));
@@ -443,8 +443,8 @@ server_send_deployment_reply(const int action_id, const int job_cnt_max,
goto cleanup;
}
channel_data.url = url;
- channel_data.json_string = json_reply_string;
- TRACE("PUTing to %s: %s\n", channel_data.url, channel_data.json_string);
+ channel_data.request_body = json_reply_string;
+ TRACE("PUTing to %s: %s\n", channel_data.url, channel_data.request_body);
channel_data.method = CHANNEL_POST;
result = map_channel_retcode(channel->put(channel, (void *)&channel_data));
@@ -1434,8 +1434,8 @@ server_op_res_t server_send_target_data(void)
}
channel_data_reply.url = url;
- channel_data_reply.json_string = json_reply_string;
- TRACE("URL=%s JSON=%s", channel_data_reply.url, channel_data_reply.json_string);
+ channel_data_reply.request_body = json_reply_string;
+ TRACE("URL=%s JSON=%s", channel_data_reply.url, channel_data_reply.request_body);
channel_data_reply.method = CHANNEL_PUT;
result = map_channel_retcode(channel->put(channel, (void *)&channel_data_reply));
As channel_curl should not be bound to be used exclusively with JSON, channel_data_t's json_string field is renamed to a more generic name request_body. Signed-off-by: Christian Storm <christian.storm@siemens.com> --- corelib/channel_curl.c | 10 +++++----- include/channel_curl.h | 2 +- suricatta/server_hawkbit.c | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-)