Live data from Hacker News

Althttpd: Simple webserver in a single C file

sqlite.org

21–30 of 345 posts

Re: Althttpd: Simple webserver in a single C file

#22
post #10
post #2

Here 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…

HTTP is serious about backward compatibility, so a client that speaks HTTP/1.1 (or HTTP/1.0 + Host header) can still talk to most servers out there. Similarly, if you write a server that only speaks HTTP/1.1 (or HTTP/1.0 + Host header), you can put it behind a reverse proxy or load balancer that handles higher versions, does connection management, and terminates TLS. It will work perfectly fine, only without some of…

That seems like a high risk of http desync attacks, if you're only implementing a subset of http/1.1.

Re: Althttpd: Simple webserver in a single C file

#24

    /*
    ** 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.

Re: Althttpd: Simple webserver in a single C file

#25

Also see: darkhttpd: https://github.com/emikulic/darkhttpd

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/

Re: Althttpd: Simple webserver in a single C file

#26
post #24

/* ** 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.

Computers are insanely fast

Re: Althttpd: Simple webserver in a single C file

#28

Interesting but why? There’s a bazillion web servers out there, surely one of them can do the job? What have I missed?

I don't know of any other well-known web server with the same featureset. For instance, it has no configuration file, it's run from xinetd statelessly/single-threaded, it runs itself in a chroot and it's short enough to be readable without specific effort.

It also isn't brand new: it's been around since 2004. So that probably narrows the range of possible competitors even more.

If you can find a webserver that meets all of those constraints, please let us know.

Re: Althttpd: Simple webserver in a single C file

#30
post #25

Also see: darkhttpd: https://github.com/emikulic/darkhttpd

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.
Post reply on HN