qt app html,QtWebApp HTTP server in C++

0b33ba0ac5a619e477274784fa5070a3.png

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值