* cgit with busybox httpd
@ 2023-03-06 10:13 Andreas Mahling
2023-03-06 11:41 ` John Keeping
0 siblings, 1 reply; 5+ messages in thread
From: Andreas Mahling @ 2023-03-06 10:13 UTC (permalink / raw)
To: cgit
hello,
I'm in the process to configure a cgit instance for my private network at home.
Because my internet router will be the host for git and cgit, I'm
looking for a ligthweight setup.
I would like to use busybox httpd as webserver, which has a very low
footprint and supports cgi, but no other fancy bells and whistles,
especially no url rewrite.
It works in principle, but there is a problem with the URLs generated
by cgit: they seem always containing a trailing slash. This leads to a
404 error thrown by httpd. If I manually remove the slash, everyting
is OK.
Example given:
http://git/cgi-bin/cgit.cgi/linuxadmin.git/ -> 404
http://git/cgi-bin/cgit.cgi/linuxadmin.git -> Page ist shown
Is there a way to tell cgit to give up the trailing slash? I'm running
cgit-1.2.3-r3 on Alpine 3.17.2
Any help greatly appreciated!
BTW: I've also tried lighttp, which had no problem with trailing
slashes, but is more heavyweight than busybox.
Best Regards
Andreas
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: cgit with busybox httpd
2023-03-06 10:13 cgit with busybox httpd Andreas Mahling
@ 2023-03-06 11:41 ` John Keeping
[not found] ` <CAF6j0WAEvS4AeX-pjEOnytt5SQ8vbguOhjX6VmVxEJ8rJ0x9rA@mail.gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: John Keeping @ 2023-03-06 11:41 UTC (permalink / raw)
To: Andreas Mahling; +Cc: cgit
On Mon, Mar 06, 2023 at 11:13:10AM +0100, Andreas Mahling wrote:
> I'm in the process to configure a cgit instance for my private network at home.
> Because my internet router will be the host for git and cgit, I'm
> looking for a ligthweight setup.
> I would like to use busybox httpd as webserver, which has a very low
> footprint and supports cgi, but no other fancy bells and whistles,
> especially no url rewrite.
>
> It works in principle, but there is a problem with the URLs generated
> by cgit: they seem always containing a trailing slash. This leads to a
> 404 error thrown by httpd. If I manually remove the slash, everyting
> is OK.
>
> Example given:
> http://git/cgi-bin/cgit.cgi/linuxadmin.git/ -> 404
> http://git/cgi-bin/cgit.cgi/linuxadmin.git -> Page ist shown
>
> Is there a way to tell cgit to give up the trailing slash? I'm running
> cgit-1.2.3-r3 on Alpine 3.17.2
I don't think it's possible to change that behaviour without patching
CGit. Given how URLs are constructed, it looks a bit complicated to fix
in all cases, but you could remove the setting of "virtual_root" in
cmd_main() to force using query parameters instead of virtual paths in
URLs.
Can you tell where the 404 is generated? Is this a case of httpd
returning an error when it shouldn't, or is it a behaviour difference
that CGit isn't handling correctly - maybe other CGI hosts strip
trailing slashes before passing a path to CGit but httpd doesn't?
^ permalink raw reply [flat|nested] 5+ messages in thread
* cgit with busybox httpd
@ 2023-03-06 14:31 Andreas Mahling
0 siblings, 0 replies; 5+ messages in thread
From: Andreas Mahling @ 2023-03-06 14:31 UTC (permalink / raw)
To: cgit
sorry, I've missed sending to the list address
I wrote a script test.sh which prints the environment.
When called as http://git/cgi-bin/test.sh/xyz PATH_INFO ist set to '/xyz'
When called as http://git/cgi-bin/test.sh/xyz/ 404 is thrown. So the
problem seems to be caused by httpd
hello John,
It seems the 404 is generated by httpd, I think because the url ends
with a slash httpd treats the part after cgit.cgi not as PATH_INFO (as
it should) but as a directory. So this seems more a fault of httpd to
me.
Sorry, but I don't understand how to put into QUERY_STRING what now
goes into PATH_INFO. Do you mean the virtual-root option in cgitrc?
It is already commented out in my setup, but cgit builds the url with
PATH_INFO part anyway.
best regards Andreas
Am Mo., 6. März 2023 um 12:41 Uhr schrieb John Keeping <john@keeping.me.uk>:
>
> On Mon, Mar 06, 2023 at 11:13:10AM +0100, Andreas Mahling wrote:
> > I'm in the process to configure a cgit instance for my private network at home.
> > Because my internet router will be the host for git and cgit, I'm
> > looking for a ligthweight setup.
> > I would like to use busybox httpd as webserver, which has a very low
> > footprint and supports cgi, but no other fancy bells and whistles,
> > especially no url rewrite.
> >
> > It works in principle, but there is a problem with the URLs generated
> > by cgit: they seem always containing a trailing slash. This leads to a
> > 404 error thrown by httpd. If I manually remove the slash, everyting
> > is OK.
> >
> > Example given:
> > http://git/cgi-bin/cgit.cgi/linuxadmin.git/ -> 404
> > http://git/cgi-bin/cgit.cgi/linuxadmin.git -> Page ist shown
> >
> > Is there a way to tell cgit to give up the trailing slash? I'm running
> > cgit-1.2.3-r3 on Alpine 3.17.2
>
> I don't think it's possible to change that behaviour without patching
> CGit. Given how URLs are constructed, it looks a bit complicated to fix
> in all cases, but you could remove the setting of "virtual_root" in
> cmd_main() to force using query parameters instead of virtual paths in
> URLs.
>
> Can you tell where the 404 is generated? Is this a case of httpd
> returning an error when it shouldn't, or is it a behaviour difference
> that CGit isn't handling correctly - maybe other CGI hosts strip
> trailing slashes before passing a path to CGit but httpd doesn't?
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-03-07 19:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-06 10:13 cgit with busybox httpd Andreas Mahling
2023-03-06 11:41 ` John Keeping
[not found] ` <CAF6j0WAEvS4AeX-pjEOnytt5SQ8vbguOhjX6VmVxEJ8rJ0x9rA@mail.gmail.com>
2023-03-06 14:42 ` John Keeping
2023-03-07 19:16 ` Andreas Mahling
2023-03-06 14:31 Andreas Mahling
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).