tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: libbozohttpd and lua
On Fri, Nov 06, 2009 at 10:41:39AM +0200, Antti Kantee wrote:
> On Fri Nov 06 2009 at 07:12:27 +0000, Alistair Crooks wrote:
> > Just to add some fuel to the fires...
> >
> > I have need of a webserver that can embedded in other things. I've
> > taken bozohttpd, and split it into libbozohttpd and a main.c (a short
> > driver program). The embedded version still has one iffy bit - the
> > current way of interrupting output which is taking too long is to have
> > an alarm(3) raised. This doesn't scale, and won't embed well. At the
> > same time, this raises questions about the whole way of architecting
> > an embedded server, whilst keeping the small, simple nature of
> > bozohttpd intact.
>
> What is a driver program? Like inetd (which bozo used to require)?
A driver program is something that calls the routines in the library
from the command line. Its usage was common in Computing Science in
the 1970s. You kids.
I wasn't aware that bozo required inetd - indeed, I used to run it from
the command line on a number of systems.
> Your problem sounds like a case for threads or non-blocking handles
> which needs to be massaged from the driver until data has been sent.
> But I guess you don't want to do it that way?
I was thinking more of an event driven system, like libevent or libev.
But that kind of usage would mean that the requirements for bozohttpd
just got much, much larger than before.
> > I've also rewritten the driver program as a small lua script (and some
> > supporting C glue). The lua script is < 160 lines and that includes
> > license and comments, and all of the options httpd(8) supports.
> > Feedback on that is solicited and will be gratefully received.
>
> Sounds cool. I'm soliciting comparison data which has been a little
> hard to find on this subject. The obvious ones are:
> * how big is main.c
% grep -e ';$' main.c | wc -l
104
% wc -l main.c
413 main.c
%
> * how big is the C glue
% grep -e ';$' bindings/lua/glue.c | wc -l
96
% wc -l bindings/lua/glue.c
276 bindings/lua/glue.c
%
(For the rationale behind counting the number of semicolons at the end
of line being a non-commented line of code, I refer the honourable
gentleman to some speaker at a Unix conference from the 80s or 90s - I
think they were from Bell Labs. I realise that this doesn't narrow it
down much).
> * how does it perform (apachebench should do the trick?)
Not sure how it performs.
Regards,
Alistair
Home |
Main Index |
Thread Index |
Old Index