diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2022-07-19 20:37:49 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2022-07-19 20:37:49 +0200 |
commit | 62cc2f4ac6cb45c280b70a98891a51a2d3b55520 (patch) | |
tree | 4ebc152c5004e6bf0d416fb36eb0cf5cae92ed0e /src | |
parent | merge upstream work for 0.0.23 (diff) | |
download | sear.c-62cc2f4ac6cb45c280b70a98891a51a2d3b55520.tar sear.c-62cc2f4ac6cb45c280b70a98891a51a2d3b55520.tar.gz sear.c-62cc2f4ac6cb45c280b70a98891a51a2d3b55520.tar.bz2 sear.c-62cc2f4ac6cb45c280b70a98891a51a2d3b55520.tar.lz sear.c-62cc2f4ac6cb45c280b70a98891a51a2d3b55520.tar.xz sear.c-62cc2f4ac6cb45c280b70a98891a51a2d3b55520.tar.zst sear.c-62cc2f4ac6cb45c280b70a98891a51a2d3b55520.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/httpd.c | 4 |
1 files changed, 3 insertions, 1 deletions
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); |