Skip to content

Commit

Permalink
Update Qompoter support
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviermaridat committed Aug 18, 2017
1 parent f7fc160 commit fcb0c61
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 3,353 deletions.
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# QHttp

This project is a backport of [azadkuh/qhttp](https://github.com/azadkuh/qhttp) for Qt5.3+ and C++11 (instead of Qt5.5+ and C++14). It fits the last version of azadkuh/qhttp and no issue has been reported at the moment.

Read more about [motivations here](https://github.com/azadkuh/qhttp/issues/35).

### Table of contents
- [About](#about)
Expand All @@ -14,24 +17,21 @@
## About
[TOC](#table-of-contents)

`QHttp` is a lightweight, asynchronous and fast HTTP library in `c++14 / Qt5`,
`QHttp` is a lightweight, asynchronous and fast HTTP library in `C++11 / Qt5.3+`,
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](#disclaimer)
- by using `std::function` and `c++14 generic lambda`, the API is intentionally similar
- by using `std::function` and `C++11 lambda`, the API is intentionally similar
to the [Node.js' http module](http://nodejs.org/api/http.html). Asynchronous
and non-blocking HTTP programming is quite easy with `QHttp`. have a look at
[sample codes](#sample-codes).
- the fantastic [nodejs/http-parser](https://github.com/nodejs/http-parser)
(which is a single pair of `*.h/*.c` files) is the only dependency of the
`QHttp`.

> **attention**: c++14 is the minimum requirement for version 3.0+
> please see [releases](https://github.com/azadkuh/qhttp/releases)
This project was inspired by
[nikhilm/qhttpserver](https://github.com/nikhilm/qhttpserver) effort to
implement a Qt HTTP server. `QHttp` pushes the idea further by implementing
Expand Down Expand Up @@ -110,7 +110,7 @@ int main(int argc, char** argv) {
## Features
[TOC](#table-of-contents)

- the only dependencies are: `Qt5`, `c++14` and the `http-parser`
- the only dependencies are: `Qt5.3 minimum`, `C++11` and the `http-parser`
- both TCP and UNIX (local) sockets are supported as backend.
- separate `namespace`s for server and client classes.
- HTTP server classes: [QHttpServer](./src/qhttpserver.hpp),
Expand Down Expand Up @@ -152,7 +152,9 @@ $> git clone https://github.com/azadkuh/qhttp.git
$> cd qhttp

# prepare dependencies:
$qhttp/> ./update-dependencies.sh
$qhttp/> qompoter install

*Note: to install Qompoter on your machine, use `npm install -g qompoter` or check [Qompoter documentation](https://github.com/Fylhan/qompoter/blob/master/README.md#installation).*

# now build the library and the examples
$qhttp/> qmake -r qhttp.pro
Expand Down Expand Up @@ -183,7 +185,7 @@ in some rare scenarios you may want to use multiple handler threads (although
- **`src/`**: holds the source code of `QHttp`. server classes are prefixed by
`qhttpserver*` and client classes by `qhttpclient*`.
- **`private/`**: Private classes of the library.
- **`3rdparty/`**: will contain `http-parser` source tree as the only
- **`vendor/`**: will contain `http-parser` source tree as the only
dependency. this directory is created by setup. see also: [setup](#setup).
- **`example/`**: contains some sample applications representing the `QHttp`
usage:
Expand Down Expand Up @@ -228,4 +230,5 @@ use `QNetworkAccessManager` which supports proxy, redirections, authentication,
[TOC](#table-of-contents)

Distributed under the MIT license. Copyright (c) 2014, Amir Zamani.
Distributed under the MIT license. Copyright (c) 2017, Olivier Maridat.

8 changes: 0 additions & 8 deletions build.properties.dist

This file was deleted.

133 changes: 0 additions & 133 deletions build.xml

This file was deleted.

8 changes: 5 additions & 3 deletions commondir.pri
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
DEFINES *= QHTTP_DYNAMIC_LIB
# comment following line to trim client classes from build
DEFINES *= QHTTP_HAS_CLIENT
# Qt5.5.1 on OSX needs both c++11 and c++14!! the c++14 is not enough
CONFIG += c++11 c++14
CONFIG += c++11

unix {
TEMPDIR = $$PRJDIR/tmp/unix/$$TARGET
Expand All @@ -24,5 +23,8 @@ RCC_DIR = $$TEMPDIR
UI_DIR = $$TEMPDIR/Ui
LIBS += -L$$OUT_PWD/$$PRJDIR/xbin

INCLUDEPATH += . $$PRJDIR/src $$PRJDIR/3rdparty
INCLUDEPATH += . $$PRJDIR/src

CONFIG += qhttp
include($$PWD/vendor/vendor.pri)

32 changes: 17 additions & 15 deletions qompoter.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
{
"name": "azadkuh/qhttp",
"description": "a light-weight and asynchronous HTTP library (both server & client) in Qt5 and c++14",
"keywords": ["Qt", "C++", "HTTP"],
"authors": [
{
"name": "azadkuh",
"homepage": "https://github.com/azadkuh"
}
],
"require": {
"nodejs/http-parser": "v2.7.0"
},
"repositories": {
"nodejs/http-parser": "https://github.com"
}
"name": "oliviermaridat/qhttp",
"description": "a light-weight and asynchronous HTTP library (both server & client) in Qt5.3+ and C++11",
"keywords": ["Qt", "C++", "HTTP"],
"authors": [
{
"name": "azadkuh",
"homepage": "https://github.com/azadkuh"
},
{
"name": "Olivier Maridat",
"email": "[email protected]",
"company": "Trialog"
}
],
"require": {
"oliviermaridat/http-parser-wrapper": "v2.7.*"
}
}
104 changes: 56 additions & 48 deletions qompoter.pri
Original file line number Diff line number Diff line change
@@ -1,57 +1,65 @@
qhttp-lib {
DEFINES += QOMP_QHTTP
QOMP_NAME_QHTTP=qhttp

LIBNAME = $$QOMP_NAME_QHTTP
IMPORT_INCLUDEPATH = $$PWD/$$QOMP_NAME_QHTTP/include
IMPORT_LIBPATH = $$PWD/$$LIBPATH
INCLUDEPATH += $$IMPORT_INCLUDEPATH
LIBS += -L$$IMPORT_LIBPATH -l$$getLibName($${LIBNAME}, "Qt")
qhttp|qhttp-server{
HEADERS += \
$$PWD/qhttp/src/qhttpserverconnection.hpp \
$$PWD/qhttp/src/qhttpserverrequest.hpp \
$$PWD/qhttp/src/qhttpserverresponse.hpp \
$$PWD/qhttp/src/qhttpserver.hpp \
$$PWD/qhttp/src/private/qhttpserver_private.hpp \
$$PWD/qhttp/src/private/qhttpserverconnection_private.hpp \
$$PWD/qhttp/src/private/qhttpserverrequest_private.hpp \
$$PWD/qhttp/src/private/qhttpserverresponse_private.hpp

SOURCES += \
$$PWD/qhttp/src/qhttpserverconnection.cpp \
$$PWD/qhttp/src/qhttpserverrequest.cpp \
$$PWD/qhttp/src/qhttpserverresponse.cpp \
$$PWD/qhttp/src/qhttpserver.cpp

!qhttp{
CONFIG += qhttp
}
}

qhttp|qhttp-client|contains(DEFINES, QHTTP_HAS_CLIENT){
HEADERS += \
$$PWD/qhttp/src/qhttpclient.hpp \
$$PWD/qhttp/src/qhttpclientresponse.hpp \
$$PWD/qhttp/src/qhttpclientrequest.hpp \
$$PWD/qhttp/src/private/qhttpclient_private.hpp \
$$PWD/qhttp/src/private/qhttpclientrequest_private.hpp \
$$PWD/qhttp/src/private/qhttpclientresponse_private.hpp

SOURCES += \
$$PWD/qhttp/src/qhttpclientrequest.cpp \
$$PWD/qhttp/src/qhttpclientresponse.cpp \
$$PWD/qhttp/src/qhttpclient.cpp

!qhttp{
CONFIG += qhttp
}
}

qhttp {
DEFINES += QOMP_QHTTP
QOMP_NAME_QHTTP=qhttp
qhttp{
DEFINES += QOMP_OLIVIERMARIDAT_QHTTP

HEADERS += \
$$PWD/http-parser/http_parser.h \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpfwd.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpabstracts.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpserverconnection.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpserverrequest.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpserverresponse.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpserver.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/private/qhttpbase.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/private/qhttpserverconnection_private.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/private/qhttpserverrequest_private.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/private/qhttpserverresponse_private.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/private/qhttpserver_private.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/private/qhttpclientrequest_private.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/private/qhttpclientresponse_private.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/private/qhttpclient_private.hpp \
$$PWD/qhttp/src/qhttpfwd.hpp \
$$PWD/qhttp/src/qhttpabstracts.hpp \
$$PWD/qhttp/src/private/httpparser.hxx \
$$PWD/qhttp/src/private/httpreader.hxx \
$$PWD/qhttp/src/private/httpwriter.hxx \
$$PWD/qhttp/src/private/qhttpbase.hpp \
$$PWD/qhttp/src/private/qsocket.hpp

SOURCES += \
$$PWD/http-parser/http_parser.c \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpabstracts.cpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpserverconnection.cpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpserverrequest.cpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpserverresponse.cpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpserver.cpp

contains(DEFINES, QHTTP_HAS_CLIENT) {
HEADERS += \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpclient.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpclientresponse.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpclientrequest.hpp

SOURCES += \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpclientrequest.cpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpclientresponse.cpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpclient.cpp
}
$$PWD/qhttp/src/qhttpabstracts.cpp

INCLUDEPATH += \
$$PWD/$$QOMP_NAME_QHTTP \
$$PWD/$$QOMP_NAME_QHTTP/src \
$$PWD/$$QOMP_NAME_QHTTP/vendor
$$PWD/qhttp \
$$PWD/qhttp/src

QT += network
DEFINES *= QHTTP_MEMORY_LOG=0
CONFIG += c++11
CONFIG += http-parser
}
Loading

0 comments on commit fcb0c61

Please sign in to comment.