From 969e9554a31385b2d2c09695dab984d585dc2693 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Mon, 21 Sep 2026 06:42:39 -1000 Subject: Harden the request path, scan and error recovery --- source/cgit.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'source/cgit.h') diff --git a/source/cgit.h b/source/cgit.h index 72c0844..163cd4d 100644 --- a/source/cgit.h +++ b/source/cgit.h @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -58,6 +59,13 @@ // A double, because a twelfth of a year is not a whole number of seconds. #define SECONDS_PER_MONTH (SECONDS_PER_YEAR / 12.0) +// The number of context lines git itself defaults to. +#define DEFAULT_DIFF_CONTEXT 3 + +// A tab in rendered source runs on to the next multiple of this, which is the +// width a browser picks on its own since the stylesheet sets no tab-size. +#define TAB_WIDTH 8 + typedef enum { DIFF_UNIFIED, DIFF_SSDIFF, DIFF_STATONLY } diff_type; @@ -168,7 +176,7 @@ struct cgit_query { char *path; char *url; char *period; - int ofs; + int ofs; int nohead; char *sort; int showmsg; @@ -203,7 +211,8 @@ struct cgit_config { char *script_name; char *section; char *repository_sort; - char *virtual_root; // Always ends with a slash. + // Always ends with a slash. + char *virtual_root; char *strict_export; struct date_mode date_mode; int cache_size; @@ -216,7 +225,7 @@ struct cgit_config { int cache_snapshot_ttl; int case_sensitive_sort; int embedded; - int trust_scan_filters; + int trust_scan_config; int enable_follow_links; int enable_gitmodules_links; int enable_header; @@ -281,6 +290,8 @@ struct cgit_page { int status; const char *statusmsg; int untrusted; + // Set once the status line is out, when an error can only join the body. + int headers_sent; }; struct cgit_environment { -- cgit v2.8.0