diff --git a/main.c b/main.c index 8424414..6eb1f2a 100644 --- a/main.c +++ b/main.c @@ -56,6 +56,8 @@ size_t n_blocks = 0; uint64_t n_requests = 0; uint64_t n_allocs_failed = 0; pthread_mutex_t blocks_head_lock = PTHREAD_MUTEX_INITIALIZER; +unsigned int favicon_ico_len = 318; +unsigned char favicon_ico[]; #if ALLOCATE_EVERYTHING uint64_t next_block_number = 0; @@ -233,6 +235,12 @@ void api_handler(struct mg_connection *c, int ev, void *evd, void *fnd) { } else if (mg_http_match_uri(hm, "/lastOdd")) { mg_http_reply(c, 200, "", "%zd", blocks_head->start + 0x7FFFFFF); n_requests++; + } else if (mg_http_match_uri(hm, "/favicon.ico")) { + mg_printf(c, + "HTTP/1.1 200 OK\r\n" + "Content-Type: image/vnd.microsoft.icon\r\n" + "Content-Length: %d\r\n\r\n", favicon_ico_len); + mg_send(c, favicon_ico, favicon_ico_len); } else { mg_http_reply(c, 500, "Content-Type: text/plain; charset=utf-8\r\n", "Internal Server Error"); } @@ -265,3 +273,33 @@ void *allocation_thread(void*_) { } } #endif + +unsigned char favicon_ico[] = { + 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x10, 0x10, 0x10, 0x00, 0x01, 0x00, + 0x04, 0x00, 0x28, 0x01, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x28, 0x00, + 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x13, 0x13, 0x13, 0x00, 0xde, 0xd9, 0xd0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x00, 0x02, 0x20, 0x00, 0x22, 0x22, 0x22, 0x22, + 0x01, 0x02, 0x20, 0x10, 0x22, 0x22, 0x22, 0x22, 0x01, 0x02, 0x20, 0x10, + 0x22, 0x22, 0x22, 0x22, 0x01, 0x02, 0x20, 0x10, 0x22, 0x22, 0x22, 0x22, + 0x01, 0x02, 0x20, 0x10, 0x22, 0x22, 0x22, 0x22, 0x01, 0x02, 0x20, 0x10, + 0x22, 0x22, 0x22, 0x22, 0x01, 0x00, 0x20, 0x10, 0x22, 0x22, 0x22, 0x22, + 0x01, 0x10, 0x00, 0x10, 0x22, 0x22, 0x22, 0x22, 0x01, 0x01, 0x11, 0x00, + 0x22, 0x22, 0x22, 0x22, 0x01, 0x00, 0x00, 0x02, 0x22, 0x22, 0x22, 0x22, + 0x01, 0x02, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x01, 0x02, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x00, 0x02, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0xff, 0xff, 0x00, 0x00, 0xf1, 0x8f, 0x00, 0x00, 0xf1, 0x8f, + 0x00, 0x00, 0xf1, 0x8f, 0x00, 0x00, 0xf1, 0x8f, 0x00, 0x00, 0xf1, 0x8f, + 0x00, 0x00, 0xf1, 0x8f, 0x00, 0x00, 0xf0, 0x8f, 0x00, 0x00, 0xf0, 0x0f, + 0x00, 0x00, 0xf0, 0x0f, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf1, 0xff, + 0x00, 0x00, 0xf1, 0xff, 0x00, 0x00, 0xf1, 0xff, 0x00, 0x00, 0xff, 0xff, + 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 +};