From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 305 invoked from network); 6 Mar 2023 14:42:46 -0000 Received: from lists.zx2c4.com (165.227.139.114) by inbox.vuxu.org with ESMTPUTF8; 6 Mar 2023 14:42:46 -0000 Received: by lists.zx2c4.com (ZX2C4 Mail Server) with ESMTP id cd3a6acd; Mon, 6 Mar 2023 14:42:35 +0000 (UTC) Return-Path: Received: from mta02.prd.rdg.aluminati.org (mta02.prd.rdg.aluminati.org [94.76.243.215]) by lists.zx2c4.com (ZX2C4 Mail Server) with ESMTPS id 1cb6860d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Mon, 6 Mar 2023 14:42:34 +0000 (UTC) Received: from mta02.prd.rdg.aluminati.org (localhost [127.0.0.1]) by mta.aluminati.local (Postfix) with ESMTP id 8E13B22276; Mon, 6 Mar 2023 14:42:33 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by mta02.prd.rdg.aluminati.org (Postfix) with ESMTP id 85DDC409; Mon, 6 Mar 2023 14:42:33 +0000 (GMT) X-Quarantine-ID: X-Virus-Scanned: Debian amavisd-new at mta02.prd.rdg.aluminati.org Received: from mta.aluminati.local ([127.0.0.1]) by localhost (mta02.prd.rdg.aluminati.org [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ZHZ6x_IENMcT; Mon, 6 Mar 2023 14:42:32 +0000 (GMT) Received: from keeping.me.uk (unknown [81.174.171.191]) by svc01-2.prd.rdg.aluminati.org (Postfix) with ESMTPSA id 7AD55780004; Mon, 6 Mar 2023 14:42:31 +0000 (GMT) Date: Mon, 6 Mar 2023 14:42:30 +0000 From: John Keeping To: Andreas Mahling Cc: cgit@lists.zx2c4.com Subject: Re: cgit with busybox httpd Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable X-BeenThere: cgit@lists.zx2c4.com X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: List for cgit developers and users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: cgit-bounces@lists.zx2c4.com Sender: "CGit" [Cc: add the mailing list back in] On Mon, Mar 06, 2023 at 01:01:50PM +0100, Andreas Mahling wrote: > It seems the 404 is generated by httpd, I think because the url ends wi= th a > slash httpd treats the part after cgit.cgi not as PATH_INFO (as it shou= ld) > but as a directory. So this seems more a fault of httpd to me. >=20 > Sorry, but I don't understand how to put into QUERY_STRING what now goe= s > 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. To disable that feature you would have the patch the CGit source and build your own cgit binary. There is code in cmd_main() which automatically calculates the virtual root from other environment variables if they are provided (and it seems that httpd does provide this detail to CGI scripts). > Am Mo., 6. M=E4rz 2023 um 12:41 Uhr schrieb John Keeping : >=20 > > 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 netw= ork > > 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 lo= w > > > 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 generat= ed > > > by cgit: they seem always containing a trailing slash. This leads t= o a > > > 404 error thrown by httpd. If I manually remove the slash, everytin= g > > > 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 runn= ing > > > 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 i= n > > 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? > >