1. questor
  2. mongoose-single-threaded

Overview

this are two completly independet libraries modified by myself to be single threaded 
and useable with a c++ compiler.

original sources can be found here:

http://code.google.com/p/mongoose/

https://github.com/breckinloggins/ngtemplate



Small Examples:
   const char *options[] = {
      "listening_ports", "8080",
      "debug_single_threaded", "yes",
      NULL
   };
   context = mg_start(&DebugWebServer::eventHandler, nullptr, options);
   ...
   while(run) {
      mg_poll_single_threaded(mContext);
   }
   ...
   mg_stop(mContext);





   TextFileResource *textResource = (TextFileResource*)rm->getResource(mPageBaseHandle);
   ngt_template *templ = ngt_new();
   ngt_dictionary *dict = ngt_dictionary_new();

   std::string mainContent;
   mainContent = "Blub!";
   ngt_set_string(dict, "MainContent", mainContent.c_str());

   templ->templ = textResource->getData();      //template was renamed to templ because of c++!
   ngt_set_dictionary(templ, dict);
   char *output;
   ngt_expand(templ, &output);

   mg_write(conn, output, strlen(output));      // send output to web server
   free(output);
   ngt_destroy(templ);
   ngt_dictionary_destroy(dict);



Version 0.1(03.05.2011):
This is the initial release which now works in my setup, but last week I had some
trouble with hangig main-threads in which mongoose blocked on a read from a socket
and never returned. I dunno why, but I found that everytime this happens it hangs in
"read_request" which should collect data from the web client, perhaps the server 
never got a request length (in get_request_len).