Change-Id: Ie09bfef199f0624f02e630625ab3c8292c904822
Signed-off-by: pradeep kumar B <b.pradeep@samsung.com>
size_t new_len = 0;
gchar* ptr = NULL;
+ len = g_queue_get_length(request->body_queue);
+ if (len == 0) {
+ *body = NULL;
+ return HTTP_ERROR_NONE;
+ }
+
*body = malloc(curr_len + 1);
if (*body == NULL) {
DBG("malloc() failed\n");
return HTTP_ERROR_OPERATION_FAILED;
}
- len = g_queue_get_length(request->body_queue);
-
for (index = 0; index < len; index++) {
ptr = (gchar*)g_queue_pop_head(request->body_queue);
DBG("The write_event is %d.\n", write_event);
}
- if (!write_event) {
+ if ((_get_method(request->method) == HTTP_METHOD_POST) && !write_event) {
gchar *body = NULL;
_read_request_body(transaction, &body);
- curl_easy_setopt(transaction->easy_handle, CURLOPT_COPYPOSTFIELDS, body);
- free(body);
+ if (body) {
+ curl_easy_setopt(transaction->easy_handle, CURLOPT_COPYPOSTFIELDS, body);
+ free(body);
+ }
}
if (write_event) {