From 0421e307b2c9ce14ac9b5500b05f76fdc9fa507f Mon Sep 17 00:00:00 2001 From: hkc Date: Tue, 13 Sep 2022 20:53:36 +0300 Subject: [PATCH] hotfix cuz yandex cloud dummy lol --- main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 95d7556..bca4ee0 100644 --- a/main.c +++ b/main.c @@ -173,7 +173,8 @@ void api_handler(struct mg_connection *c, int ev, void *evd, void *fnd) { printf("%-16s %-8s %s\n", addr, method, url); if (mg_http_match_uri(hm, "/analytics")) { - mg_http_reply(c, 200, "Content-Type: application/json\r\n", + char buffer[1024] = { 0 }; + snprintf(buffer, 1023, "{" "\"ts\":%lf," "\"n_blocks\":%zd," @@ -187,8 +188,8 @@ void api_handler(struct mg_connection *c, int ev, void *evd, void *fnd) { get_mem_usage(), blocks_head ? blocks_head->start + 0x8000000 - 1 : -1, n_requests, - n_allocs_failed - ); + n_allocs_failed); + mg_http_reply(c, 200, "Content-Type: application/json\r\n", buffer); } else if (mg_http_match_uri(hm, "/blocks")) { mg_printf(c, "HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n"); for (OddBlock *blk = blocks_head; blk; blk = blk->next) {