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=-0.0 required=5.0 tests=T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 21229 invoked from network); 21 Jun 2022 18:42:12 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 21 Jun 2022 18:42:12 -0000 Received: from sirjofri.de ([5.45.105.127]) by 9front; Tue Jun 21 14:40:49 -0400 2022 Received: from sirjofri.de ([31.16.251.234]) by sirjofri.de; Tue Jun 21 20:40:45 +0200 2022 Date: Tue, 21 Jun 2022 18:40:45 +0000 (UTC) From: sirjofri To: 9front@9front.org Message-ID: <5087802c-a135-49b3-9a29-13f1a3db1e10@sirjofri.de> In-Reply-To: References: <4a8d0815-0bd5-91e1-0a7a-048088dbd2c2@posixcafe.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Correlation-ID: <5087802c-a135-49b3-9a29-13f1a3db1e10@sirjofri.de> List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: progressive agile GPU-based DOM control Subject: Re: [9front] httpd minimal configuration Reply-To: 9front@9front.org Precedence: bulk 21.06.2022 16:06:53 planless.user9 : > There are no serious reasons for my preference and the rc-httpd > approach is also definitely an option for me. (Especially with your > instructions, which seem to be straightforward to realize.) > > I'm just trying to understand the system and that's why I read "Notes > on the Plan 9tm 3rd edition Kernel Source" and "The C Programming > Language". An implementation in C would therefore play into my hands a > bit (even more so, since I have almost no experience with scripts). httpd is really a quite complex application, and if you want a pure C solution (without cgi) I suggest also looking into tcp80. There are a few sources for it, and I don't know if there is any canonical one. Tcp80 is a simple binary you can copy to your service directory for the simplest setup. It uses /lib/namespace.httpd as the namespace file. Since you are quite new to 9 I give you a few hints: There is a program called aux/listen. This program listens to specific ports, starts associated processes and connects stdin/stdout with that process. Aux/listen is started by default on all cpu servers (see cpurc), and it listens to files in /rc/bin/service (or /cfg/$sysname/service if it exists). To associate a port with a process you just have any kind of executable file in this directory called (protocol)(port), eg tcp443 would make aux/listen to port 443, and if someone calls, execute that exact file. The program tcp80 can be placed in the service directory as is, or you build a wrapper rc script around it. Most server processes like tcp80/httpd first set up their namespace according to the namespace.X file. Since web servers canonically are only interested in the /usr/web directory, the process binds this directory to /, which results in some nice sandboxing (eg it prevents %2f attacks). Note that tcp80 only does GET and stuff like that, you can't POST with it. httpd can do a little more things, at least in its special handlers, like the wiki handler. I hope this helps. sirjofri