hotfix cuz yandex cloud dummy lol

This commit is contained in:
Casey 2022-09-13 20:53:36 +03:00
parent d3fb717d2d
commit 0421e307b2
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 4 additions and 3 deletions

7
main.c
View File

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