Re: [dev] [lnanohttp] nanonimal http server for linux

From: Sylvain BERTRAND <>
Date: Wed, 20 Apr 2016 19:05:09 +1100

On Wed, Apr 20, 2016 at 07:46:38AM +0200, Anselm R Garbe wrote:
> On 20 April 2016 at 05:17, Sylvain BERTRAND <> wrote:
> > For my personnal use, I needed a small http server. All "mini" http servers out
> > there I had a look were, IMHO, bloaty (SDK included).
> Did you also look at ?

Nope. Missed that one.

:( As a member of the suckless collective: shame on me.

> quark is fork() based (and POSIX compliant in that sense) though, not
> epoll_wait() based. So quark will perform accordingly, but it supports
> a bit more HTTP features (incl. cgi execution), but its SLOC is
> considerable equal to lnanohttpd.

lnanohttp is enough for my personal use (static content). cgi is already too
It's easy to add clone(fork/thread)/cgi/(and more). In ulinux/patterns there is
code of a "network server" which does the cloning stuff, even "pre-cloning"
(pre-fork/pre-thread spawning). Just need to adapt the code. But it's way
beyond my needs.

> > lnanohttp is really small (including dependencies and SDK), straight on linux kernel
> > syscalls with a thin layer. Tested only on x86 and with a gcc/binutils
> > toolchain for the moment (planing to buy an armv8 raspberry board).
> >
> > Can be use easily as a base for a beefier http server.
> Some quick remarks: it uses a lot of #define's (all over the place)
> which I consider very weird. Also for type declarations it uses
> #define's of types which seem to be very weird as well. (e.g. #define
> sl ulinux_sl).

The defines are used to manage namespaces. ulinux thin layer has its own
namespace in order to be mixed with other namespages (libc/posix/etc).

> Also is relying on -errno checks all over the place really secure? I
> would rather check for -1 and compare with errno directly. Or is it a
> linux pattern I wasn't aware of?

quark pulls the posix libc. lnanohttp has 0 deps: this is straight linux
syscalls programming, there are no libc syscall wrappers.

Now, I need to find bugs... :)

Received on Wed Apr 20 2016 - 10:05:09 CEST

This archive was generated by hypermail 2.3.0 : Wed Apr 20 2016 - 10:12:11 CEST