Earlier quoted context omitted.
Similar is thttpd. I was not familiar with darkhttpd. Both of these are similar to the sqlite server in security design (chroot capability), but unlike in that a single process serves all requests and does not fork. I have used stunnel in front of thttpd, and chrome has no complaints. https://acme.com/software/thttpd/
althttpd has CGI, sometimes interesting.
Althttpd: Simple webserver in a single C file
41–50 of 345 posts
Re: Althttpd: Simple webserver in a single C file
#42/* ** Test procedure for ParseRfc822Date */ void TestParseRfc822Date(void){ time_t t1, t2; for(t1=0; t1 There's only two billion integers, guess we can test them all. Well, substantially fewer than two billion with that skip. I wonder if that completes in a few seconds.
This loop doesn’t test them all - it tests every 1/127th integer, so it only runs about 16 million times.
Re: Althttpd: Simple webserver in a single C file
#43 static const char *azDisallow[] = {
"skidrowcrack.com",
"hoshiyuugi.tistory.com",
"skidrowgames.net",
};
Anyone know why?Re: Althttpd: Simple webserver in a single C file
#44Re: Althttpd: Simple webserver in a single C file
#45> A separate process is started for each incoming connection, and that process is wholly focused on serving that one connection. It makes you wonder just how "heavy" operating system processes actually are. We may not need to worry about the complexity of trying to multiple run async requests in a single process/thread in all cases.
Isn't it an appealing model to not even have to talk about threads because every process is 1 thread by definition?
Re: Althttpd: Simple webserver in a single C file
#46One file of 2600 lines, guess if you give up common sense and follow this approach you can even create a kernel in one file
Re: Althttpd: Simple webserver in a single C file
#47Blocks some referers by default: static const char *azDisallow[] = { "skidrowcrack.com", "hoshiyuugi.tistory.com", "skidrowgames.net", }; Anyone know why?
Re: Althttpd: Simple webserver in a single C file
#48I'd be putting this in 1000 layers of sandboxing since its a C program with network access.
Re: Althttpd: Simple webserver in a single C file
#49Blocks some referers by default: static const char *azDisallow[] = { "skidrowcrack.com", "hoshiyuugi.tistory.com", "skidrowgames.net", }; Anyone know why?
Not sure why they're blocked
Re: Althttpd: Simple webserver in a single C file
#50Here is the actual single C-code file: https://sqlite.org/althttpd/file?name=althttpd.c Something I absolutely love about text based protocols such as HTTP/1 is how easy you can implement it in any virtually programming language. Sure, the implementation is not top-of-the-notch, but it just damned works, it is portable, it is understandable by humans. That's something what's got lost with HTTP/2 and HTTP/3, respectiv…
Text protocols have difficult problems like escaping or detecting the end of particular field that are frequent source of mistakes.
The issue is that many (especially scripting) languages treat binary data as second class.
The only real issue is that inspecting the binary message visually is little bit more difficult. You can usually easily tell if your data structure is broken if it is in text form. What I do is I usually have some simple converter that converts the binary message to text form and this helps me inspect the message easily.