Last changes

1.7.4 24.05.2018
Fixed two possible null-pointer references in case of broken HTTP requests.

1.7.3 25.04.2017
Wait until all data are sent before closing connections.

1.7.2 17.01.2017
Fixed compile error with MSVC.

1.7.1 10.11.2016
Fixed a possible memory leak in case of broken Multipart HTTP Requests.

1.7.0 08.11.2016
Introduced namespace "stefanfrings".
Improved performance a little.

1.6.7 10.10.2016
Fix type of socketDescriptor in qtservice library.
Add support for INFO log messages (new since QT 5.5).
Improve indentation of log messages.

1.6.6 25.07.2016
Removed useless mutex from TemplateLoader.
Add mutex to TemplateCache (which is now needed).

1.6.5 10.06.2016
Incoming HTTP request headers are now processed case-insensitive.
Add support for the HttpOnly flag of cookies.

1.6.4 27.03.2016
Fixed constructor of Template class did not load the source file properly.
Template loader and cache were not affected.

1.6.3 11.03.2016
Fixed a compilation error.
Added missing implementation of HttpRequest::getPeerAddress().

1.6.2 06.03.2016
Added mime types for some file extensions.

1.6.1 25.01.2016
Fixed parser of boundary value in multi-part request, which caused that QHttpMultipart did not work on client side.

1.6.0 29.12.2015
Much better output buffering, reduces the number of small IP packages.

Start page   Deutsche Version dieser Seite

QtWebApp HTTP Webserver in C++

QtWepApp is a HTTP server library in C++, inspired by Java Servlets. For Linux, Windows, Mac OS and many other operating systems that the Qt Framework supports.

QtWebApp contains the following components

These components can be used independently of each other.

The HTTP server processes incoming requests in parallel threads. It supports IPv4 and IPv6, persistent connections, HTTPS, session cookies, and file-uploads.

The template engine is helpful to generate websites which are based on template files by filling placeholders with data. It supports many languages and may be used for any text based file format (e.g. HTML, XML, CSV, ...). Other larger template engines, such as ClearSilver, may be used as well.

The logger plugs into Qt and writes log messages into files, while they are enriched with additional attributes like timestamp, thread ID, session ID and some more. Changes to the configuration file of the logger become active automatically without program restart.

The QtService component enables you to set up your application as a Windows Service.

The small memory requirement of about 2MB qualifies the web server to be used in embedded systems. For example the Beer brewing machine of Sebastian Düll. But it's also powerful enough for larger web services.

A very small example:

// The request handler receives and responds HTTP requests
void MyRequestHandler::service(HttpRequest& request, HttpResponse& response)
    // Get a request parameters
    QByteArray username=request.getParameter("username");

    // Set a response header
    response.setHeader("Content-Type", "text/html; charset=ISO-8859-1");

    // Generate the HTML document
    response.write("Hello ");

// The main program starts the HTTP server
int main(int argc, char *argv[])
    QCoreApplication* app=new QCoreApplication(argc,argv);
    QSettings* settings=new QSettings("configfile.ini",QSettings::IniFormat,app);
    MyRequestHandler* handler=new MyRequestHandler(app);
    HttpListener* listener=new HttpListener(settings,handler,app);

    return app->exec();

You may download QtWebApp.zip for free and use the software under the conditions of the LGPL License. The Tutorial explains how to use the library. And here is the API documentation .


The current high quality of the library is not only the result of my own work. Some people tested QtWebApp in production environments and suggested improvements. I'm thankful for their help.