Rather then some documentation I provide you hereby
with a simple class for setting up a webserver...
Just subclass it like:
class MyServer : virtual public WebServer
{
public:
MyServer( ) : WebServer(8080) { }
virtual void received_request( ... );
}
Inside received_request you just do everything you
want... But be sure to do it before you exit the
function. As afterwards no turning back...
This is a simple C++ implementation, and someone
might want to incorporate the following list
of features:
- SSL specific items.
- CGI interfacing.
- Make it multithreaded (difficult because the
polling itself is not multithreaded).
- sending a reply 'gradualy' ie send it piece by piece.
- incorporating error-functions.
For this to completely work I had to change the
shttpd_printf function (added a shttpd_vprintf-
function). Maybe you would be so kind to add it to
v 1.37?
Checkout the rar ;)
Logged In: YES
user_id=569271
Originator: YES
Code nicification for "defs.h". Some extern's are done there which should be nicified if you want to use them inside an embedded program.
Also now I could consider the WebServer class as nearly finished.
You can:
- set a header
- set a http response code
- set a page
And basically you could subclass & instantiate 200 WebServer classes and you would have 200 working webservers in your program (if anyone would ever need that).
I think everything is as far multithreaded safe coded as possible, but I guess I will only find out if I start using it in a heavy environment.
Checkout the corrected release.