Deutsche Version dieser Seite
Last changes
1.8.3
21.03.2021
The minLevel for logging can now be configured as string.
Info messages are now positioned between DEBUG and WARNING.
I also added an example for HTTP Basic authorization.
1.8.2
08.03.2021
Fix threadId not printed in log file.
1.8.1
07.02.2021
Add Cookie attribute "SameSite".
SessionStore does now emit a signal when a session expires.
1.8.0
06.02.2021
Fix compatibility issues with Qt 4.7 and 6.0.
Removed qtservice, use the Non-Sucking Service Manager instead.
1.7.11
28.12.2019
Fix Http Headers are not properly received if the two characters of
a line-break (\r\n) were not received together in the same ethernet
package.
1.7.10
04.12.2019
Add support for other SSL implementations than OpenSSL (as far Qt supports it).
Fix log bufffer was triggered only by severities above minLevel (should be "at least" minLevel).
1.7.9
20.06.2019
INFO messages do not trigger writing out buffered log messages anymore when
bufferSize>0 and minLevel>0.
QtWebApp HTTP Server 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:HTTP(S) Server
Template Engine
File Logger
These components can be used independently of each other.
The logger improves disk space and performance by retaining debug messages in memory until
an error occurs. No debug messages are written as long everything works fine.
Changes to the configuration of the logger become active automatically without program restart.
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=UTF-8");
// Generate the HTML document
response.write("
");response.write("Hello ");
response.write(username);
response.write("");
}
// The main program starts the HTTP server
int main(int argc, char *argv[])
{
QCoreApplication app(argc,argv);
new HttpListener(
new QSettings("configfile.ini",QSettings::IniFormat,&app),
new MyRequestHandler(&app),
&app);
return app.exec();
}
The small memory requirement of about 2MB qualifies the web server to be used in embedded systems. For example for the Beer brewing machine of Sebastian Düll. But it's also powerful enough for larger web services.
You may use the software under the conditions of the LGPL License.
Thanks
The current high quality of the library is the result of the collaboration of many people. I would like to thank the helpers for
testing QtWebApp extensively in a productive environment and thus contributing to the improvement.