summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpradeep kumar B <b.pradeep@samsung.com>2016-03-21 11:29:53 +0530
committerpradeep kumar B <b.pradeep@samsung.com>2016-03-21 11:29:53 +0530
commit02ec85d46abc800e9d1dd33f8f1ddd1ff1cfd589 (patch)
tree7783a550d109059cbee394d416a523af18fc68f4
parentebc6e7feba62238c95933193232aa65006ded3e3 (diff)
downloadhttp-02ec85d46abc800e9d1dd33f8f1ddd1ff1cfd589.tar.gz
http-02ec85d46abc800e9d1dd33f8f1ddd1ff1cfd589.tar.bz2
http-02ec85d46abc800e9d1dd33f8f1ddd1ff1cfd589.zip
[capi-http] Fixed the https GET request issue
Change-Id: Ie09bfef199f0624f02e630625ab3c8292c904822 Signed-off-by: pradeep kumar B <b.pradeep@samsung.com>
-rw-r--r--src/http_request.c8
-rw-r--r--src/http_transaction.c8
2 files changed, 11 insertions, 5 deletions
diff --git a/src/http_request.c b/src/http_request.c
index c5c5e76..673f931 100644
--- a/src/http_request.c
+++ b/src/http_request.c
@@ -230,14 +230,18 @@ int _read_request_body(http_transaction_h http_transaction, char **body)
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);
diff --git a/src/http_transaction.c b/src/http_transaction.c
index 11ec436..18ec22c 100644
--- a/src/http_transaction.c
+++ b/src/http_transaction.c
@@ -231,13 +231,15 @@ int _transaction_submit(gpointer user_data)
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) {