diff options
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | src/httpd.c | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog index 3e4973e..bdfe233 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +sear.c (0.0.24-1) stable; urgency=low + + * fixed favicon sending + + -- Anton Luka Šijanec <anton@sijanec.eu> Tue, 19 Jul 2022 20:30:00 +0200 + sear.c (0.0.23-1) stable; urgency=low * added a hreflink with window.external.AddSearchProvider (for palemoon) diff --git a/src/httpd.c b/src/httpd.c index abe025a..0171a11 100644 --- a/src/httpd.c +++ b/src/httpd.c @@ -134,6 +134,7 @@ enum MHD_Result sc_httpd (void * cls, l ? "<input type=hidden name=l value=" : "<!-- Odgovor na dokončno vprašanje o Življenju, Vesolju in sploh Vsem je ", l ? atoi(l) : 42, l ? " />" : " -->"); + size_t response_len = 0; if (!query) { if (url[0] == '/') switch (url[1]) { @@ -161,6 +162,7 @@ enum MHD_Result sc_httpd (void * cls, case 'f': /* favicon.ico */ mhdrmm = MHD_RESPMEM_PERSISTENT; response = (char *) sc_ico; + response_len = sizeof sc_ico; content_type = "image/x-icon"; break; case 'l': /* logs.html */ @@ -256,7 +258,7 @@ retry: } else goto retry; } } - httpd_response = MHD_create_response_from_buffer (strlen(response), (void *) response, mhdrmm); + httpd_response = MHD_create_response_from_buffer (response_len ? response_len : strlen(response), (void *) response, mhdrmm); MHD_add_response_header(httpd_response, "Content-Type", content_type); if (status_code >= 300 && status_code <= 399) MHD_add_response_header(httpd_response, "Location", location); |