QHttp
is a lightweight, asynchronous and fast HTTP library in c++14 / Qt5
,
containing both server and client side classes for managing connections,
parsing and building HTTP requests and responses.
- the objective of
QHttp
is being light weight with a simple API for Qt developers to implement RESTful web services in private (internal) zones. more - by using
std::function
andc++14 generic lambda
, the API is intentionally similar to the Node.js' http module. Asynchronous and non-blocking HTTP programming is quite easy withQHttp
. have a look at sample codes. - the fantastic nodejs/http-parser
(which is a single pair of
*.h/*.c
files) is the only dependency of theQHttp
.
attention: c++14 is the minimum requirement for version 3.0+ please see releases
This project was inspired by
nikhilm/qhttpserver effort to
implement a Qt HTTP server. QHttp
pushes the idea further by implementing
client side classes, better memory management, a lot more Node.js-like API, ...
a HelloWorld HTTP server by QHttp
looks like:
int main(int argc, char** argv) {
QCoreApplication app(argc, argv);
using namespace qhttp::server;
QHttpServer server(&app);
server.listen( // listening on 0.0.0.0:8080
QHostAddress::Any, 8080,
[](QHttpRequest* req, QHttpResponse* res) {
// http status 200
res->setStatusCode(qhttp::ESTATUS_OK);
// the response body data
res->end("Hello World!\n");