From: sirjofri <sirjofri+ml-9front@sirjofri.de>
To: 9front@9front.org
Subject: Re: [9front] httpd minimal configuration
Date: Tue, 21 Jun 2022 18:40:45 +0000 (UTC) [thread overview]
Message-ID: <5087802c-a135-49b3-9a29-13f1a3db1e10@sirjofri.de> (raw)
In-Reply-To: <Kx9BZ52Ckwv-9bstyn5mpZ29iJBJayv-jo2JUUAz7_38DgDUrotwAS-GnnOU91bCtqcHi5w3Ji671Sgvs434pqsunsjjF7Yws6Jh4CMNxuI=@proton.me>
21.06.2022 16:06:53 planless.user9 <planless.user9@proton.me>:
> 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
next prev parent reply other threads:[~2022-06-21 18:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-21 11:48 planless.user9
2022-06-21 12:23 ` hiro
2022-06-21 12:31 ` hiro
2022-06-21 12:58 ` planless.user9
2022-06-21 13:15 ` Jacob Moody
2022-06-21 14:06 ` planless.user9
2022-06-21 18:40 ` sirjofri [this message]
2022-06-22 6:25 ` william
2022-06-22 9:09 ` planless.user9
2022-06-22 9:29 ` umbraticus
2022-06-22 10:38 ` hiro
2022-06-21 17:52 ` mkf9
2022-06-21 17:44 ` mkf9
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5087802c-a135-49b3-9a29-13f1a3db1e10@sirjofri.de \
--to=sirjofri+ml-9front@sirjofri.de \
--cc=9front@9front.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).