It would be neat to see how you could possibly hook Lua into this to give you some of the flexibility of a dynamic language with the speed and small footprint of a (mostly) C app. I've been thinking of working on something like that for a while but unfortunately my C skills need a lot more work before I'd be comfortable tackling it.
Came across this the other day: Embed the Power of Lua into NginX https://github.com/chaoslawful/lua-nginx-module
Raphters, a web framework for C
41–50 of 70 posts
Re: Raphters, a web framework for C
#42Earlier quoted context omitted.
Rather: response_set_status(200); response_set_header("Content-Type", "text/html"); response_write(body); response_end(); The awkwardness of which, to me, demonstrates the superiority of C++ in this regard.
That implies some global state somewhere being updated, and now you've given up on threading. This may be OK, but it's still dangerous and leaky even if you give up on threading. There are various solutions that still allow you to pass a set of closures without being particularly more ugly than anything else is in C, for instance, see http://library.gnome.org/devel/gobject/stable/chapter-signal... . C++ still ends up…
Re: Raphters, a web framework for C
#43I'm at work so I can't setup a server to test, however after summoning my inner compiler my changes seem sane. But you should look them over (check the pull on github https://github.com/DanielWaterworth/Raphters/pull/2).
I'll be around if you want to discuss a proper fix for some of the issues. Albeit it will take a pretty major rewrite.
Re: Raphters, a web framework for C
#44Pretty cool, but if I really had to write some kind of C stuff to output web pages I suppose I'd just build it as an apache module rather than go the CGI route, there's lots of useful functions and nifty stuff within apache making it a pretty nice environment for serving stuff. (Or more probably since it's 2011, I'd try an nginx module (or lightty), although I have never looked at any of those projects code yet). Bui…
Re: Raphters, a web framework for C
#45Re: Raphters, a web framework for C
#46Can't we just have a minimal webserver for ZeroMQ, and from there all the languages with ZeroMQ bindings?
Re: Raphters, a web framework for C
#47Can't we just have a minimal webserver for ZeroMQ, and from there all the languages with ZeroMQ bindings?
Re: Raphters, a web framework for C
#48Re: Raphters, a web framework for C
#49Earlier quoted context omitted.
A little off-topic, but you sound familiar with libevent. I've never used either but I'm looking at gevent for a project, and I noticed that they switched to libev: http://software.schmorp.de/pkg/libev.html ... do you know what "limitations and bugs" in libevent they speak of? I poked through the mailing list for libev and couldn't find anything specific.
I've never paid much attention to libev. I've been using libevent since 2002 (it was the standard event loop at Arbor Networks, which was in Ann Arbor, where Niels Provos lived at the time). Before libevent, I used ACE_reactor to accomplish the same tasks. I prefer libevent (strongly) to ACE. I might prefer libev to libevent, but... why bother? Libevent works fine. My guess about "limitations" of libevent is that it'…
Re: Raphters, a web framework for C
#50Earlier quoted context omitted.
Something like evhttp also has the benefit that you can have more than one request "in flight". FastCGI can theoretically do this, but almost no implementation supports it - and it makes e.g. writing a simple chat server much easier (one process, one thread, tons of connections, data in memory.)
The downside to doing evhttp is that he'll have to write his own request parsing (I think he's relying on Apache/CGI to do that for him now). But if you're going to do a C web framework (and... really? you sure about that?), that's probably how you should do it.
Which, these days, isn't a huge deal. Both of these are decent:
https://github.com/ry/http-parser
https://github.com/mongrel/mongrel/blob/master/ext/http11/ht...