[PATCH] ui-repolist: return HTTP 404 if no repositories found

Peter Colberg peter at colberg.org
Mon Dec 7 20:28:08 CET 2015


Dear cgit maintainers,

With the following patch, cgit returns HTTP 404 Not found when querying
a non-existent repository. This is useful to signal to search engines
that a repository no longer exists. Further, webservers such as nginx
permit logging requests to different files depending on the HTTP code.

cgit_print_repolist() does an early return with an error page if no
repository is found. I added a helper function is_visible() to avoid
repeating the repo conditions (and risking them getting out of sync).

Regards,
Peter

Peter Colberg (1):
  ui-repolist: return HTTP 404 if no repositories found

 ui-repolist.c | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)

-- 
2.6.2



More information about the CGit mailing list