Small fixes for http api connectivity issues

yamux
John Jones 2017-09-25 12:13:32 -05:00
parent 88baee62a2
commit f0d19bab97
2 changed files with 6 additions and 5 deletions

View File

@ -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);

View File

@ -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;
}
/**