diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Always send the Status header
Diffstat (limited to 'source')
-rw-r--r--source/ui-shared.c4
1 file changed, 4 insertions, 0 deletions
diff --git a/source/ui-shared.c b/source/ui-shared.c
index 110dd91..db441e0 100644
--- a/source/ui-shared.c
+++ b/source/ui-shared.c
@@ -1089,8 +1089,12 @@ void cgit_print_http_headers(void)
if (ctx.env.no_http && !strcmp(ctx.env.no_http, "1"))
return;
+ // CGI treats a missing Status as 200, but writing it keeps every
+ // response's header block the same shape.
if (ctx.page.status)
htmlf("Status: %d %s\n", ctx.page.status, ctx.page.statusmsg);
+ else
+ html("Status: 200 OK\n");
if (ctx.page.mimetype && ctx.page.charset)
htmlf("Content-Type: %s; charset=%s\n", ctx.page.mimetype,
ctx.page.charset);