aboutsummaryrefslogtreecommitdiff
path: root/httpd.c
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2026-06-29 17:43:03 +0000
committerRuben Beltran del Rio <git@r.bdr.sh>2026-06-29 17:43:03 +0000
commit25ccc2599aa722b0552193961d4cda15928112d8 (patch)
treed562abe7d1539665aaa9861d0615f039d3ff7bfa /httpd.c
parent6fc748933ad263ba0e8c78eb9ae1e085a2b0dfb2 (diff)
parent795355acb496a8a8f015a80edf48f38786894f86 (diff)
Merge branch 'master' of https://codeberg.org/grunfink/snac2
Diffstat (limited to 'httpd.c')
-rw-r--r--httpd.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/httpd.c b/httpd.c
index b79aa87..99d0f1c 100644
--- a/httpd.c
+++ b/httpd.c
@@ -612,17 +612,19 @@ void httpd_connection(FILE *f)
status = HTTP_STATUS_NOT_FOUND;
}
- if (status == HTTP_STATUS_FORBIDDEN)
- body = xs_str_new("<h1>403 Forbidden (" USER_AGENT ")</h1>");
+ if (body == NULL) {
+ if (status == HTTP_STATUS_FORBIDDEN)
+ body = xs_str_new("<h1>403 Forbidden (" USER_AGENT ")</h1>");
- if (status == HTTP_STATUS_NOT_FOUND)
- body = xs_str_new("<h1>404 Not Found (" USER_AGENT ")</h1>");
+ if (status == HTTP_STATUS_NOT_FOUND)
+ body = xs_str_new("<h1>404 Not Found (" USER_AGENT ")</h1>");
- if (status == HTTP_STATUS_GONE)
- body = xs_str_new("<h1>410 Gone (" USER_AGENT ")</h1>");
+ if (status == HTTP_STATUS_GONE)
+ body = xs_str_new("<h1>410 Gone (" USER_AGENT ")</h1>");
- if (status == HTTP_STATUS_BAD_REQUEST && body != NULL)
- body = xs_str_new("<h1>400 Bad Request (" USER_AGENT ")</h1>");
+ if (status == HTTP_STATUS_BAD_REQUEST)
+ body = xs_str_new("<h1>400 Bad Request (" USER_AGENT ")</h1>");
+ }
if (status == HTTP_STATUS_SEE_OTHER)
headers = xs_dict_append(headers, "location", body);
@@ -1077,8 +1079,8 @@ void httpd(void)
signal(SIGTERM, term_handler);
signal(SIGINT, term_handler);
- srv_log(xs_fmt("httpd%s start %s %s", p_state->use_fcgi ? " (FastCGI)" : "",
- full_address, USER_AGENT));
+ srv_log(xs_fmt(USER_AGENT " httpd%s start %s", p_state->use_fcgi ? " (FastCGI)" : "",
+ full_address));
/* show the number of usable file descriptors */
struct rlimit r;