mirror of
https://git.zx2c4.com/cgit
synced 2025-07-15 12:44:34 +02:00
ui-shared: add cgit_print_error_page() function
This will allow us to generate error responses with the correct HTTP response code without needing all of the layout boilerplate. Signed-off-by: John Keeping <john@keeping.me.uk>
This commit is contained in:
parent
aa12084f98
commit
aec1204a54
2 changed files with 16 additions and 0 deletions
14
ui-shared.c
14
ui-shared.c
|
@ -788,6 +788,20 @@ void cgit_print_docend(void)
|
|||
html("</body>\n</html>\n");
|
||||
}
|
||||
|
||||
void cgit_print_error_page(int code, const char *msg, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
ctx.page.status = code;
|
||||
ctx.page.statusmsg = msg;
|
||||
cgit_print_http_headers();
|
||||
cgit_print_docstart();
|
||||
cgit_print_pageheader();
|
||||
va_start(ap, fmt);
|
||||
cgit_vprint_error(fmt, ap);
|
||||
va_end(ap);
|
||||
cgit_print_docend();
|
||||
}
|
||||
|
||||
static void add_clone_urls(void (*fn)(const char *), char *txt, char *suffix)
|
||||
{
|
||||
struct strbuf **url_list = strbuf_split_str(txt, ' ', 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue