snapshot: use cgit_print_error_page() for HTTP status codes

This is a bugfix as well as an improvement to the HTTP status code
handling since previously we would not print HTTP headers on any of
these code paths.

Signed-off-by: John Keeping <john@keeping.me.uk>
这个提交包含在:
John Keeping 2015-08-14 12:47:08 +01:00 提交者 Jason A. Donenfeld
父节点 e3e41e5125
当前提交 58e827cbd9
共有 1 个文件被更改,包括 4 次插入2 次删除

查看文件

@ -112,11 +112,13 @@ static int make_snapshot(const struct cgit_snapshot_format *format,
unsigned char sha1[20];
if (get_sha1(hex, sha1)) {
cgit_print_error("Bad object id: %s", hex);
cgit_print_error_page(404, "Not found",
"Bad object id: %s", hex);
return 1;
}
if (!lookup_commit_reference(sha1)) {
cgit_print_error("Not a commit reference: %s", hex);
cgit_print_error_page(400, "Bad request",
"Not a commit reference: %s", hex);
return 1;
}
ctx.page.etag = sha1_to_hex(sha1);