* Slash after /about
@ 2019-01-29 9:21
2019-01-29 18:58 `
2019-01-30 18:37 ` john
0 siblings, 2 replies; 4+ messages in thread
From: @ 2019-01-29 9:21 UTC (permalink / raw)
Hello,
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);
Apart of this the alphabetical sort order of the options in cgitrc.5 is violated by case-sensitive-sort, it shall not be
between cache-size and cache-scanrc-ttl .
Regards
?????
^ permalink raw reply [flat|nested] 4+ messages in thread
* Slash after /about
2019-01-29 9:21 Slash after /about
@ 2019-01-29 18:58 `
2019-01-30 17:53 ` Dilyan.Palauzov
2019-01-30 18:37 ` john
1 sibling, 1 reply; 4+ messages in thread
From: @ 2019-01-29 18:58 UTC (permalink / raw)
Hi,
without saying anything about the particular change, I find the
behavior of thttpd in this regard to be slighly irritating: I know more
than one software, where 'bar/foo' and 'bar/foo/' might represent two
different things (mostly the former being 'service bar with argument
foo' and the latter being 'service bar/foo with an empty argument').
- Ren?
On 29.01.19 10:21, ????? ???????? wrote:
> Hello,
>
> 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);
>
>
>
> Apart of this the alphabetical sort order of the options in cgitrc.5 is violated by case-sensitive-sort, it shall not be
> between cache-size and cache-scanrc-ttl .
>
> Regards
> ?????
>
> _______________________________________________
> CGit mailing list
> CGit at lists.zx2c4.com
> https://lists.zx2c4.com/mailman/listinfo/cgit
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Slash after /about
2019-01-29 18:58 `
@ 2019-01-30 17:53 ` Dilyan.Palauzov
0 siblings, 0 replies; 4+ messages in thread
From: Dilyan.Palauzov @ 2019-01-30 17:53 UTC (permalink / raw)
Hello Ren?,
in case of cgit /repo/about/ and /repo/about are the same, except the latter causes a redirect to the former.
I propose removing the redirect and handling them as equal.
Regards
?????
On January 29, 2019 7:58:26 PM GMT+01:00, "Ren? Neumann" <lists at necoro.eu> wrote:
>Hi,
>
>without saying anything about the particular change, I find the
>behavior of thttpd in this regard to be slighly irritating: I know more
>
>than one software, where 'bar/foo' and 'bar/foo/' might represent two
>different things (mostly the former being 'service bar with argument
>foo' and the latter being 'service bar/foo with an empty argument').
>
>- Ren?
>
>On 29.01.19 10:21, ????? ???????? wrote:
>> Hello,
>>
>> 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);
>>
>>
>>
>> Apart of this the alphabetical sort order of the options in cgitrc.5
>is violated by case-sensitive-sort, it shall not be
>> between cache-size and cache-scanrc-ttl .
>>
>> Regards
>> ?????
>>
>> _______________________________________________
>> CGit mailing list
>> CGit at lists.zx2c4.com
>> https://lists.zx2c4.com/mailman/listinfo/cgit
>>
>_______________________________________________
>CGit mailing list
>CGit at lists.zx2c4.com
>https://lists.zx2c4.com/mailman/listinfo/cgit
^ permalink raw reply [flat|nested] 4+ messages in thread
* Slash after /about
2019-01-29 9:21 Slash after /about
2019-01-29 18:58 `
@ 2019-01-30 18:37 ` john
1 sibling, 0 replies; 4+ messages in thread
From: john @ 2019-01-30 18:37 UTC (permalink / raw)
On Tue, Jan 29, 2019 at 09:21:01AM +0000, dilyan.palauzov at 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.)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-01-30 18:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-29 9:21 Slash after /about
2019-01-29 18:58 `
2019-01-30 17:53 ` Dilyan.Palauzov
2019-01-30 18:37 ` john
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).