Re:Show HN: My embeddable C/C++ webserver
by sigil on Friday May 06, 2011 @12:25PM
(#2521411)
In src/webserver/Webserver.Incoming.cc you have an ad-hoc HTTP parser that internally buffers partial request data and does some questionable things like recursing on each request header line.
Consider using a finite state machine parser for HTTP like this one [1] or this one [2], which will reduce your overhead, and help you push the buffering and eof problems back up to the main event loop code.
Consider using a finite state machine parser for HTTP like this one [1] or this one [2], which will reduce your overhead, and help you push the buffering and eof problems back up to the main event loop code.
[1] https://github.com/ry/http-parser
[2] https://github.com/mongrel/mongrel/tree/master/ext/http11