diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2021-10-05 16:10:31 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2021-10-05 16:10:31 +0200 |
commit | 4225b3ffd98f365dd8e73dd7f9e8b6a0054b5e2a (patch) | |
tree | 688c7ba72f3921576aaadc4abc2278b5a1d1b0aa /src/httpd.c | |
parent | 0.0.15-1 (diff) | |
download | sear.c-4225b3ffd98f365dd8e73dd7f9e8b6a0054b5e2a.tar sear.c-4225b3ffd98f365dd8e73dd7f9e8b6a0054b5e2a.tar.gz sear.c-4225b3ffd98f365dd8e73dd7f9e8b6a0054b5e2a.tar.bz2 sear.c-4225b3ffd98f365dd8e73dd7f9e8b6a0054b5e2a.tar.lz sear.c-4225b3ffd98f365dd8e73dd7f9e8b6a0054b5e2a.tar.xz sear.c-4225b3ffd98f365dd8e73dd7f9e8b6a0054b5e2a.tar.zst sear.c-4225b3ffd98f365dd8e73dd7f9e8b6a0054b5e2a.zip |
Diffstat (limited to '')
-rw-r--r-- | src/httpd.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/httpd.c b/src/httpd.c index dfa06db..514f57a 100644 --- a/src/httpd.c +++ b/src/httpd.c @@ -152,16 +152,19 @@ enum MHD_Result sc_httpd (void * cls, sprintf(response, sc_osdd, host); content_type = "application/opensearchdescription+xml"; break; -#ifdef SC_LOGMEM case 'l': /* logs.html */ { +#ifdef SC_LOGMEM char * logshtml = sc_logshtml(c); - response = malloc(strlen((char *) sc_hp)+strlen(SC_I18N_LOGS)+strlen(logshtml ? logshtml : SC_I18N_LOGS_ERROR)); - sprintf(response, (char *) sc_hp, "", "", SC_I18N_LOGS, logshtml ? logshtml : SC_I18N_LOGS_ERROR); + response = malloc(strlen((char *) sc_hp)+strlen(SC_I18N_LOGS)+strlen(logshtml ? logshtml : SC_I18N_LOGS_ERROR)+strlen(add_form)); + sprintf(response, (char *) sc_hp, "", "", add_form, SC_I18N_LOGS, logshtml ? logshtml : SC_I18N_LOGS_ERROR); free(logshtml); +#else + response = malloc(strlen((char *) sc_hp)+strlen(SC_I18N_LOGS_NOT_ENABLED)+strlen(SC_I18N_HP_ERROR_HEADING)+strlen(SC_I18N_LOGS)+strlen(add_form)); + sprintf(response, (char *) sc_hp, SC_I18N_HP_ERROR_HEADING, "", add_form, SC_I18N_LOGS, SC_I18N_LOGS_NOT_ENABLED); +#endif } break; -#endif } if (!response) { response = malloc(strlen((char *) sc_hp)+strlen(SC_I18N_HP_HEADING)+strlen(SC_I18N_HP_BODY)+strlen(add_form)); @@ -187,8 +190,8 @@ retry: sc_query_google(query, c, NULL, opt); if (already_retried++) { char * safequery = htmlspecialchars(query); - response = malloc(strlen((char*) sc_hp)+strlen(safequery)*2+strlen(SC_I18N_HP_ERROR_HEADING)+strlen(SC_I18N_HP_ERROR_BODY)); - sprintf(response, (char *) sc_hp, safequery, safequery, SC_I18N_HP_ERROR_HEADING, SC_I18N_HP_ERROR_BODY); + response = malloc(strlen((char*) sc_hp)+strlen(safequery)*2+strlen(SC_I18N_HP_ERROR_HEADING)+strlen(SC_I18N_HP_ERROR_BODY)+strlen(add_form)); + sprintf(response, (char *) sc_hp, safequery, safequery, add_form, SC_I18N_HP_ERROR_HEADING, SC_I18N_HP_ERROR_BODY); free(safequery); } else goto retry; } |