I am looking for the smallest possible **working** C++ code for an http server. My requirements:
1. Source code must have no external dependencies dependencies that do not come pre-installed on ubuntu
2. Must work on Ubuntu.
3. As small and simple as possible. I will be modifying it heavily. No need for security, encryption, no fancy stuff.
What would you recommend? Also, I know next to nothing of how http servers work, would you recommend a quick tutorial (hopefully less-than-an-hour-one)?
At the moment I am using an apache webserver, calling my application using CGI. However, I need a more detailed communication with the web browser: I am doing a large computation, and need to display various counters and progress reports. The computation may take upwards of a day, with multiple phases and a number of progress reports. I need to make those run smoothly (without any of the built-in timeouts and safeguards of the apache server).
Last but not least, maintaining the apache configuration has been a royal pain in the butt: every Ubuntu update and every new machine breaks my configuration. Getting my own http server will save me from all that trouble.
I have to agree with Cubbi. What you're asking sounds like the job for a script to me.
However, if you are going to use C++, I would look into libmicrohttpd [ https://www.gnu.org/software/libmicrohttpd/ ]. I'm not sure if it's pre-installed in Ubuntu now, but I know there are a lot of commonly-installed applications that use it as a dependency. It's a lot faster and lighter than non-C implementations I've used before. I'd give it a good look.
I don't _think_ libwebkitgtk is what your looking for, but I'd definitely give libmicrohttpd a good look.
Civetweb (based on Mongoose) is a C (with C++ bindings), cross-platform, embeddable or standalone webserver implementation. It supports HTTPS, WebSockets, CGI, WebDAV, etc. It can also function as an HTTP client. The interface is pretty comprehensive and easy to use (adding request handlers, rewriting URLs, etc). Comes complete with a Makefile for building standalone, static library, shared library, docs, etc. It's MIT licensed, so you can use it in commercial projects.