On Tue, Jan 29, 2019 at 09:21:01AM +0000, dilyan.palau...@aegee.org wrote: > For CGI I use thttpd and it tends to remove terminating slashes in the > requests. > > cgit wants to have slash after about/ . > > So they do not work together, endless loop happens. Proposed fix: > > diff --git a/cmd.c b/cmd.c > --- a/cmd.c > +++ b/cmd.c > @@ -40,16 +40,7 @@ static void atom_fn(void) > static void about_fn(void) > { > if (ctx.repo) { > - size_t path_info_len = ctx.env.path_info ? > strlen(ctx.env.path_info) : 0; > - if (!ctx.qry.path && > - ctx.qry.url[strlen(ctx.qry.url) - 1] != '/' && > - (!path_info_len || ctx.env.path_info[path_info_len - 1] > != '/')) { > - char *currenturl = cgit_currenturl(); > - char *redirect = fmtalloc("%s/", currenturl); > - cgit_redirect(redirect, true); > - free(currenturl); > - free(redirect); > - } else if (ctx.repo->readme.nr) > + if (ctx.repo->readme.nr) > cgit_print_repo_readme(ctx.qry.path); > else if (ctx.repo->homepage) > cgit_redirect(ctx.repo->homepage, false);
According to commit d703480 ("about: always ensure page has a trailing slash") the trailing slash is required for easy embedding of links to other /about/ pages. I suspect it's possible to append the trailing slash without going round a redirect loop, but I don't think this patch will work. (I'm also inclined to agree that thttpd is broken here and should pass the URL to CGI scripts as it is received.) _______________________________________________ CGit mailing list CGit@lists.zx2c4.com https://lists.zx2c4.com/mailman/listinfo/cgit