From f0d19bab9755d28e133ddacae9547914e1f17f2a Mon Sep 17 00:00:00 2001 From: John Jones Date: Mon, 25 Sep 2017 12:13:32 -0500 Subject: [PATCH] Small fixes for http api connectivity issues --- core/api.c | 9 +++++---- core/http_request.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/api.c b/core/api.c index b5e3af9..5ba25f7 100644 --- a/core/api.c +++ b/core/api.c @@ -572,13 +572,14 @@ void *api_connection_thread (void *ptr) snprintf(resp, sizeof(resp), "%s 200 OK\r\n" \ "Content-Type: application/json\r\n" "Server: c-ipfs/0.0.0-dev\r\n" - //"X-Chunked-Output: 1\r\n" + "X-Chunked-Output: 1\r\n" "Connection: close\r\n" - //"Transfer-Encoding: chunked\r\n" + "Transfer-Encoding: chunked\r\n" "\r\n" + "%d\r\n" "%s\r\n" - //"0\r\n" - ,req.buf + req.http_ver, response_text); + "0\r\n" + ,req.buf + req.http_ver, strlen(response_text), response_text); if (response_text != NULL) free(response_text); write_str (s, resp); diff --git a/core/http_request.c b/core/http_request.c index 405f575..a8b6076 100644 --- a/core/http_request.c +++ b/core/http_request.c @@ -252,7 +252,7 @@ size_t curl_cb(void* ptr, size_t size, size_t nmemb, struct curl_string* str) { str->len = new_len; } libp2p_logger_debug("http_request", "curl_cb received %s.\n", str->ptr); - return size + nmemb; + return size * nmemb; } /**