From 6a9b662b50927b2dbe3c8d383f04d1d7b649b28f Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 8 Aug 2026 12:49:57 -1000 Subject: Gather page output into one buffer --- source/ui-shared.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/ui-shared.c') diff --git a/source/ui-shared.c b/source/ui-shared.c index 125a235..23da286 100644 --- a/source/ui-shared.c +++ b/source/ui-shared.c @@ -808,6 +808,10 @@ void cgit_print_http_headers(void) if (ctx.page.etag) htmlf("ETag: \"%s\"\n", ctx.page.etag); html("\n"); + // Several pages follow the header block with output produced by git + // rather than by html_raw, the patch, raw diff and snapshot views among + // them. Emptying the buffer here keeps the headers ahead of it. + html_flush(); if (ctx.env.request_method && !strcmp(ctx.env.request_method, "HEAD")) exit(0); } -- cgit v2.8.0