Git Product home page Git Product logo

tufao's Introduction

!!! I can no longer maintain this project. If you're interessed, please contact me and I can move the projetct to you !!!

Tufão - an asynchronous web framework for C++ built on top of Qt

Join the chat at https://gitter.im/vinipsmaker/tufao

Tufão is a web framework for C++ that makes use of Qt's object communication system (signals & slots). It features:

  • High performance standalone server
  • Cross-plataform support
  • Good documentation
  • Support modern HTTP features
    • Persistent streams
    • Chunked entities
    • 100-continue status
    • WebSocket
  • HTTPS support
  • Flexible request router
  • Static file server with support for conditional requests, partial download and automatic mime detection
  • Plugin-based server to allow change the running code without restart the application
  • Flexible and secure session support
  • QtCreator's plugin to allow create new applications rapidly
  • Lots of tests
  • Timeout support
  • C++11

You can generate documentation from the source code using Doxygen. The documentation will be put on the doc folder in the html and tex formats. There is also experimental support for Qt compressed help files.

LICENSE

The library is under the LGPLv2 and public header files, documentation and examples are under MIT license.

The Tufão logo is licensed under [Creative Commons Attribution 3.0 Unported] (http://creativecommons.org/licenses/by/3.0/).

The library is dynamic linked against Qt and include code from Boost.Http parser. Qt library is licensed under LGPL and Boost.Http is licensed under the Boost Software License.

So, you can create commercial applications (the only restriction is that if you do any modifications to Tufão, these modifications must be redistributed).

Getting dependencies

$ git submodule update --init

BUILD

Make sure you have Qt and CMake installed and with the PATH to its executables set, then create a folder for the build and, from there, run:

$ cmake OPTIONS path_to_source_dir
$ make MAKEOPTIONS

OPTIONS can be null or have a combination of the following values:

  • -DCMAKE_INSTALL_PREFIX=${INSTALLDIR} sets the directory where to install Tufão.
  • -DCMAKE_BUILD_TYPE=Debug
  • -DCMAKE_BUILD_TYPE=Release
  • -DCMAKE_BUILD_TYPE=RelWithDebInfo
  • -DCMAKE_BUILD_TYPE=MinSizeRel
  • -DLIB_SUFFIX=${LIB_SUFFIX} set the suffix for the install destination. If you are compiling Tufão under a 64 bit system using a 32 bit "environment", maybe you want to set this variable to 32, then Tufão libs will be installed under "${INSTALLDIR}/lib32". This setting is highly dependent on your operating system conventions and I do not try to put any auto magic detection.
  • -DGENERATE_DOC=YES generate documentation using Doxygen
  • -DENABLE_TESTS=YES generate and run tests

OPTIONS available on Windows:

  • -G"MinGW Makefiles" to generate Makefiles for use with MinGW environment
  • -G"Visual Studio 10" to generate project files for Visual Studio 10

MAKEOPTIONS can be null or have a combination of the following values:

  • install installs Tufão
  • DESTDIR=${PKGDIR} sets the directory where to install Tufão. This options should be used if you intend to package Tufão to set the package directory. To choose another installation directory, see options in OPTIONS, above.

Example:

$ cmake -DCMAKE_INSTALL_PREFIX=/usr
$ make DESTDIR=pkg install

NOTE: Qt 5.0 or later is required for 1.x series. Qt 4.7 or later is required to 0.x series.

NOTE: If you intend to create a CPack-based installer, just run:

# To create a binary distribution:
cpack -C CPackConfig.cmake

# To create a source distribution:
cpack -C CPackSourceConfig.cmake

# To create a Windows NSIS-based installer:
cpack -GNSIS

Documentation

To generate the documentation, just run doxygen using Doxyfile as configuration file and the documentation will be generated in the folder doc. The documentation is available in the following formats:

  • HTML: Always generated. It should be in the doc/html folder.
  • latex: You can use this format to generate a pdf. Just run make inside the doc/latex folder.
  • Qt Compressed Help file: If you have qhelpgenerator binary tool in the system PATH, then the file is generated when you run doxygen and should be in doc/qch/tufao.qch. If you have qhelpgenerator tool installed, but not configured in the system PATH, but still want to generate the documentation in this format, just run the tool using doc/html/index.qhp as input file.

Tests

Tufão also have a lot of code to test its correctness. These codes are based on QTestLib and generate self-contained executables. There is also some CTest rules and integration with the CMake build. To run the tests, just execute:

make tests

Or, if you don't want to use Makefiles:

ctest

In Visual Studio, the target RUN_TESTS is created.

CTest integrates with CDash to allow developers to centralize the tests result. You can send the results to CDash running the Experimental target:

make Experimental

You can see the Tufão testing log at Tufao CDash project's page.

INSTALL

The default install prefix is /usr/local, if you don't intend to change it, just run, after build:

# make install

To install to a different prefix, run:

$ cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}
$ make install

NOTE: You may need to run ldconfig after installation depending on your system.

USAGE

To use Tufão in your Qt projects, just edit your .pro file and add the line:

CONFIG += C++11 TUFAO1

You can find some examples in the examples folder.

If you're planning to use OS X, then the following line is also required, as reported by some users:

QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7

Tufão has PKG-CONFIG support also. Its module name is 'tufao1'.

If you want use Tufão in other build system, just add the compiler option -ltufao1.

You can also see Tufão documentation integrated in QtAssistant.

NEWS

Version 1.4

  • Replaces Ryan Dahl's HTTP parser. Now Boost.Http parser is used.
  • Fixes HTTP pipelining support.

Version 1.3

  • Added canHandleRequest to HttpFileServer

Version 1.2

  • New class to handle REST api introduced (thanks to Timothy Reaves)
    • The class has its own plugin system, partly incompatible with Tufão's default
  • Tufão's plugin system improved to better track files deletion.
    • It requires no code changes, but you still need to do a one-line change to the config file, because I was worried about backwards compatibility.
    • See HttpPluginServer::setConfig for details

Version 1.1

  • Add ability to ignore a set of SSL errors in WebSocket
  • Documentation updates
  • Bugfix in AbstractHttpServerRequestHandler (thanks to Benjamin Zeller)
  • Updated Ryan Dahl's HTTP parser to version 2.2.1

Version 1.0

  • The project finally have a logo (made by me in Inkscape)
  • Deprecated API was removed
  • Url and QueryString removed in favor of QUrl
  • Headers refactored to inherit from QMultiHash instead of QMultiMap
  • HttpServerResponse
    • Constructor's options argument is optional now
    • setOptions method added
    • Constructor takes a reference to a QIODevice instead a pointer
  • HttpServerRequest
    • Constructor takes a reference to a QAbstractSocket instead a pointer
    • socket method returns a reference instead a pointer
    • url returns a QUrl
    • data signal was changed and you must use readBody method to access body's content.
    • the upgrade's head data is accessed from the request body from now on
    • now the object auto-disconnects slots from data and end signals right before emit ready
    • setCustomData and customData methods added
      • Now HttpServerRequestRouter use these methods to pass the list of captured texts
  • HttpServer uses reference instead of pointers in several places
  • AbstractHttpServerRequestRouter refactored to explore lambdas features.
  • Tufão's plugin system fully refactored
    • It's using JSON files as configuration
  • AbstractHttpServerRequestHandler::handleRequest
    • It uses references instead pointers
    • It receives 2 arguments instead of 3
  • One more abstraction to sessions created to explore lambdas
  • WebSocket
    • startServerHandshake is taking references instead pointers
  • LESS POINTERS and MORE REFERENCES
    • This change exposes a model more predictive and natural
    • I'm caring less about Qt style and more about C++ style
      • But don't worry, I'll maintain a balance
  • Using scoped enums
  • HttpFileServer uses/sends mime info
  • Interfaces don't inherit from QObject anymore, so you can use multiple inheritance to make the same class implement many interfaces
  • HttpUpgradeRouter introduced
    • HttpServer::setUpgradeHandler also
  • Updated QtCreator plugin to work with QtCreator 2.7.0 and Qt 5

Version 0.6:

  • HttpServerRequest
    • setUrl added
  • UrlRewriterHandler added
  • HttpUpgradeRouter added
  • headers can be "streamed" to QDebug objects

Version 0.5:

  • WebSocket
    • peerAddress() method added
    • peerSocket() method added

Version 0.4:

  • Using CMake build system
    • Changes to allow parallel Tufão installations (if major versions differs)
    • Added PKGCONFIG support
  • Session support
  • Better documentation

Version 0.3

  • More application templates in QtCreator Tufão's plugin
  • Class to serve static files with support for conditional requests and byte-range requests
  • Robust request router added
  • HTTP plugin server added
  • Using newer version of Ryan Dahl's HTTP parser
  • Changed license from public headers to MIT
  • MSVC support
  • Some minor improvements

Version 0.2:

  • Code is more stable
  • Documentation improved
  • HttpServerResponse is easier to use
  • WebSocket support
  • TUFAO_VERSION_MAJOR and TUFAO_VERSION_MINOR macros added
  • QtCreator plugin
  • New examples

ROADMAP

Here is a small roadmap for Tufão:

1.4:

  • RPC support
  • Service discovery and description support

1.5:

  • Forms and file uploads

tufao's People

Contributors

blochberger avatar bzeller avatar drizt avatar gitter-badger avatar israelins85 avatar kazarmy avatar nagos avatar palavrov avatar pmaseberg avatar saemy avatar shr-project avatar tpatja avatar treaves avatar vinipsmaker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tufao's Issues

Add support for Visual Studio 2012

cmake -G "Visual Studio 11 Win64" .

results in

Performing Test CXX11_FLAG_DETECTED - Failed

Because the test case given in FindCXX11.cmake uses C++11 initializer lists and Visual Studio 2012 does not support this feature, it fails.

Unfortunately, it is not possible to build tufao with MSVC11.

Moreover, there might be further more C++11 features tufao uses, but VS11 does not support (http://cpprocks.com/a-comparison-of-c11-language-support-in-vs2012-g-4-7-and-clang-3-1/).

Cannot compile on QT 5 MinGW windows XP

Hi, (issue copied from code.google, I saw that git is new repo)

Maybe will be better when you read this stackoverflow topic:
http://stackoverflow.com/questions/15029894/qt-cant-add-external-package

I have also tried precompiled binaries but they need Qt 4. So I don't know what to do.

Notice that on linux 64bit Qt 5.0.1 it is working fine. I just added whole tufao source into my project and everything works fine. On windows this trick doesn't work. I get hounded of errors "undefined reference...".

Regards

Threading Support

It would be nice to have a ThreadedHttpPluginServer, so the server can scale up when lots of requests come in at the same time.

A possible problem with this is the handling of the loaded plugins, each thread might need to load and unload them itself.

Request and Response Object can be deleted at every time

I openend this as a own issue. I came over it while stress testing the threading code
with autobench/httperf.
And i found 2 problems but they come both from the same source:

Httperf opens lots of connections at the same time and runs requests on the server.
Every request has a timeout and if the timeout is reached it just closes the socket.
This may be no problem with the non threaded version ( i didn't check yet) but in the
threaded version you have pending requests if the server load is high.
They are waiting in a queue, the problem is if they reach the connection timeout the
sockets are closed and deleted WHILE they are still waiting. Also we don't have
socket error handling code (a error maybe should emit some signal and close the
request).

This creates two problems:

  1. If you call flush on a closed socket you get a SIGPIPE termination. HttpFileHandler runs into this because it does not enter the eventloop when writing
    multiple times to the socket. This can maybe be fixed with using
    waitForBytesWritten() instead of flush as the docs state. This will return false
    if a error occured.

  2. The requests object are deleted behind the back of the application, i worked
    around this by using QPointer objects , so at least i know when they are gone.

The question is if we should think about a different approach than directly connecting
request objects to their deleteLater slot, so we can handle these things better.

Move some build defines to a separate config.h file

Currently build exposes ALL configure-time defines to the sources appending arguments to the compilder command line.

This choice is suboptimal, because exposes unneeded defines to files not wanting it and, worse, it will recompile every source file if you change the configure-time defines.

Solution: Create a config.h (preferably out-of-tree in shadow builds) build-time generated file to aggregate all these changes. The config.h file could have its own directory, then the -I compiler arg wouldn't expose more files than needed.

Design Model of this server

Hi,
Recently I'm impressed by the design model of NodeJS which uses the async IO event-driven model to gain a great concurrency. Which apache's model seems to be wrong for IO intensive requests.
I'm searching for c++ framework of the same/similar model, I found this, node.native, QtWebApp, Pion, etc.
For pion, I believe (not sure) it is a threaded model just like apache web server.
For node.native, it is the same model of NodeJS as it is a c++ port of NodeJS.
For this server, I still couldn't find any documentation about the design model being used. But I can see the keyword "asynchronous IO framework". Could you please clarify whether it is a similar model as NodeJS and/or its advantanges?
Thanks & Regards,
Simon

Small bug in URL query string unescaping

Currently the 0.x branch code does slightly incorrect unescaping of URL query string parameters.

Tufao::QueryString::parse("foo=bar&param_with_significant_plus=%3B123") leads to a map with items foo="bar" and param_with_significant_plus=" 123".

204 No Content on HTTP/1.1 generates an empty chunk

My code is doing:

response.writeHead(Tufao::HttpResponseStatus::NO_CONTENT);
response.end();

This generates a 204 No Content, with Transfer-Encoding: chunked and includes and empty chunk '0\r\n\r\n'. But this is not valid according to the RFC2616:

10.2.5 204 No Content
...
The 204 response MUST NOT include a message-body, and thus is always terminated by the first empty line after the header fields.

The Microsoft .NET HTTP Client is upset by the extra chunk being sent. The only work-around is to disable keep-alive by adding Connection: close to the request.

Can't compile on Qt 5.1

Hi. I'm moving from Qt 4.8.4 to Qt 5.1 on linux 32 bit (MinGW). Building libtufao.so is working fine, but while compiling qt project I get errors:

expected type-specifier in file abstracthttpserverrequesthandler.h line 65 and 86

Any idea? I have added CONFIG += TUFAO1

threaded with router and map my owner handler run crash when open url.

code below, MainHandler just copy from your other example.

    TcpServer server;
//    MainHandler h;

    server.run(4, 8090, []() {
        QSharedPointer<Tufao::HttpServerRequestRouter> router;

        return [router](Tufao::HttpServerRequest &request,
                Tufao::HttpServerResponse &response) mutable {
            if (!router) {
                MainHandler h;
                router.reset(new Tufao::HttpServerRequestRouter);
                router->map({QRegularExpression{"^/$"},
                             Tufao::UrlRewriterHandler::handler(QUrl("/index.html"))});
                router->map({QRegularExpression{""}, h});
            }

            if (!router->handleRequest(request, response)) {
                response.writeHead(Tufao::HttpResponseStatus::NOT_FOUND);
                response.headers().insert("Content-Type", "text/plain");
                response.end("Not found\n");
            }

            return true;
        };
    });

Some prolem with slow connection. Qt 5.4 Win 7 x64

Greetings.
The following minimum code demonstrates the problem:

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    HttpServer server;
    QObject::connect(&server, &HttpServer::requestReady,
                     [](HttpServerRequest &request, HttpServerResponse &res) {
                        qDebug() << "request body = " << request.readBody();
                        res.writeHead(200, "OK");
                        res.end("Hello World\n");
    });
    server.listen(QHostAddress::Any, 8000);
    return a.exec();
}

When client sends POST request with some time pause between headers and request body, i see empty request body in handler.
Investigation of source has not yet led to a beautiful solution. Please advise how to act in a case where I need to use POST request data in handler?
Thank.

templating?

I find no discussion on templating. I can think of several ways to implement a templating system with tufao, but, would like to hear why it's not there already? I can only assume no one has though it necessary, and everyone is just using strings for HTML. Which is incredibly cumbersome.

NO_ERROR in websocket.h

First of all, thanks for an awesome library.

Here's a small annoyance:
Currently websocket.h uses NO_ERROR as the first item in the Websocket::Error enum. This causes problems when building on windows as winerror.h does a #define NO_ERROR 0L. It fails to build unless the user is very careful not to include any files that end up including any windows headers before including <WebSocket>.
I suggest you rename the enum item.

Thanks.

No response on Win8.x/64

Hi,
First of all, thanks for the awesome library.

Tried the HelloWorld example on windows 8.1 64 bit, but get not any response.
When starting the test, the port is opened (checked with netstat), the browser connects and waiting until the test program is stopped.
Tested with Qt5 3.0/3.1 and mingw482_32 with tufao 1.x current master and tag-1.2.3.
Tests on linux (openSuse 13.1 and debian wheezy) worked as expected.

Any Idea?

Regards

"Method" in routes.json seems to be ignored

Hello,

I've created a simple project with 2 plugins and this routes.json :

{
"version": 1,
"plugins": [
{
"name": "SimplePlugin",
"path": "plugins/libSimplePlugin.so"
},
{
"name": "SimplePlugin2",
"path": "plugins/libSimplePlugin2.so"
}
],
"requests": [
{
"method": "GET",
"path": "^/$",
"plugin": "SimplePlugin"
},
{
"method": "PUT",
"path": "^/$",
"plugin": "SimplePlugin2"
}
]
}

The handler of SimplePlugin is called using PUT verbs, not the one of SimplePlugin2.

I'm developping on ArchLinux with the lastest release from AUR.

Thx.

Library needs to be in /usr/lib64 on Fedora x86_64

Hi,

I'm building Tufao on Fedora and running on a 64-bit Intel CPU. On this OS, the x86_64 libraries need to go to /usr/lib64 and the i686 ones to /usr/lib because you can have x86_64 and i686 libraries installed alongside each other.

Unfortunately, I'm not familiar enough with cmake to know how to solve this, but it shouldn't be too hard. :)

Synchronize between clients

Hi all,
Is there any ways to synchronize between clients ? That means when a client request, server will response back to all clients, not just the client who makes request. In my cases, the number of clients is fixed, and the server knows information of all clients.
Many tks,

Every handler connect signal data(QByteArray) and end() of every request

Hi everyone,
I have many handlers inherit Tufao::AbstractHttpServerRequestHandler. In each handler, I have slots: onData(QByteArray) connect with signal data(QByteArray) and onEndRequest() connect with signal end() of each request comes to handler.
I also have router to route request to right handler.
But every time new request comes, it emits signal data(QByteArray), signal end() and all of my handlers catch these signal and connect to their slots.
Can you have a try to give an answer? thanks a lot.
Edited: I use Tufao on branch 0.x for Qt 4.7

not possible to use Websocket as a client with a self-signed server certificate

Currently the Websocket class does not provide a means to ignore any SSL errors.

This is usually only a problem when using a QSslSocket as a client with a server that uses a self-signed certificate (need to ignore QSslError::SelfSignedCertificate). Additionally on some builds of QT 4.x on windows, QT may report QSslError::NoError and forces the user to ignore it in order to continue (bug in QT).

I suggest a new method WebSocket::setExpectedSslErrors(QList<QSslError>&) which would store the list in a member variable. In case all the error codes of SSL errors QT reports in WebSocket::onSslErrors are in the expected list, call qobject_cast<QSslSocket*>(sender())->ignoreSslErrors(m_ignoreList), otherwise do what it does now.

To clarify, it is possible to use the current Websocket class with a self-signed certificate as a server, but not as a client.

Tufao 0.8.2 on Qt5.2.1 does not respond in threaded mode

Tested on Ubuntu LTS 12.04 with GCC 4.6.3.
When compiled againt Qt5.2.1 the hello-world example works fine but the threads-example does not respond to any request. With strace we can see a single request being read but no handler is never called.
Tested on Qt4, same platform and compiler and the threaded example works fine.

Add API to HttpServerResponse to force writing the headers

When a new request is received I am doing something a long:

    resp.writeHead(Tufao::HttpResponseStatus::OK);
    resp.flush();

The application will process some data (when it arrives) and then issue the resp.write with the data that was received. Quite some time can pass between the resp.writehead and the first resp.write. In the client I am using QNAM and the metaDataChanged() signal is only emitted once the first piece of data was written. I would love to force the writing of the Keep-Alive and Transfer encoding.

It would be great to have some API that prevents me from issuing a resp.write(" ") just to force the writing of headers.

Visual Studio 2013 Support

I have tryed to compile Tufao 1.0 using VS 2013 and I run into some problems:

  • CMake looks for the CXX11 flag but, as far as I know, such flag doesn't exists in VS (and it is not required)
  • CMake adds the flag -Wextras that doesn't exists in VS 2013

After fixing both problems the compiler has problems with the definition of a template in this struct (priv/httpserverrequest.h line 99):

struct RawData
{
    template<int N>
    constexpr RawData(const char (&data)[N]) :
        data(data),
        size(N - 1)
    {}

    const char *data;
    int size;
};

Any plan to support VS 2013? I'm doing something wrong at configuration level?

My CMake command is:

cmake .. -DCMAKE_INSTALL_PREFIX=c:/Qt/Qt5.3.0/5.3/msvc2013_64_opengl/ -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles"

Thanks,

David

Question on sessionusage example

In main.cpp, when the router is being created, QRegularExpression{""} is used twice. What would cause the second one to hit? Wouldn't all match the first entry, and use the HttpFileServer, and not the NotFoundHandler?

File caching

It would be nice to cache often used files content to improve response time (in HttpFileServer::serveFile).

Fast requests hanging Tufao

I use tufao for playing video and audio from libtorrent. So, when I make frequently requests, like frequently switching audio files, tufao starts hanging. I added additional logs in sources and here what have I got:

virtual void Tufao::TcpServerWrapper::incomingConnection(qintptr)
void Tufao::HttpServer::onNewConnection(qintptr)
virtual bool Tufao::HttpConnectionHandler::incomingConnection(qintptr)
virtual void Tufao::TcpServerWrapper::incomingConnection(qintptr)
void Tufao::HttpServer::onNewConnection(qintptr)
virtual bool Tufao::HttpConnectionHandler::incomingConnection(qintptr)

As You see, starting from Tufao::TcpServerWrapper::incomingConnection(qintptr) we have recirculation. In 10 seconds I've got more than 10 000 of calls of these methods.

So, can it be fixed and in what may be problem? In tufao or in Qt?

SSL errors while building on Qt 4.8.4

Hi,
I'm using 0.x branch for my Qt 4.8.4. Cmake is going well, but make don't. This is my output:

make
[ 1%] Generating moc_httpupgraderouter.cxx
[ 3%] Generating moc_httpserver.cxx
[ 5%] Generating moc_httpserverrequest.cxx
[ 7%] Generating moc_httpserverresponse.cxx
[ 8%] Generating moc_httpsserver.cxx
[ 10%] Generating priv/moc_tcpserverwrapper.cxx
[ 12%] Generating moc_websocket.cxx
[ 14%] Generating moc_abstractmessagesocket.cxx
[ 16%] Generating moc_httpfileserver.cxx
[ 17%] Generating moc_abstracthttpserverrequesthandler.cxx
[ 19%] Generating moc_httpserverrequestrouter.cxx
[ 21%] Generating moc_httppluginserver.cxx
[ 23%] Generating moc_sessionstore.cxx
[ 25%] Generating moc_simplesessionstore.cxx
[ 26%] Generating moc_urlrewriterhandler.cxx
[ 28%] Generating moc_abstracthttpupgradehandler.cxx
Scanning dependencies of target tufao
[ 30%] Building CXX object src/CMakeFiles/tufao.dir/httpserver.cpp.o
[ 32%] Building CXX object src/CMakeFiles/tufao.dir/httpserverrequest.cpp.o
[ 33%] Building CXX object src/CMakeFiles/tufao.dir/httpserverresponse.cpp.o
[ 35%] Building CXX object src/CMakeFiles/tufao.dir/httpsserver.cpp.o
In file included from /home/x/Pobrane/tufao/src/httpsserver.cpp:19:0:
/home/x/Pobrane/tufao/src/priv/httpsserver.h:32:21: error: field ‘localCertificate’ has incomplete type
/home/x/Pobrane/tufao/src/priv/httpsserver.h:33:13: error: field ‘privateKey’ has incomplete type
/home/x/Pobrane/tufao/src/httpsserver.cpp: In member function ‘void Tufao::HttpsServer::setLocalCertificate(const QSslCertificate&)’:
/home/x/Pobrane/tufao/src/httpsserver.cpp:37:11: error: ‘struct Tufao::HttpsServer::Priv’ has no member named ‘localCertificate’
/home/x/Pobrane/tufao/src/httpsserver.cpp: In member function ‘void Tufao::HttpsServer::setPrivateKey(const QSslKey&)’:
/home/x/Pobrane/tufao/src/httpsserver.cpp:42:11: error: ‘struct Tufao::HttpsServer::Priv’ has no member named ‘privateKey’
/home/x/Pobrane/tufao/src/httpsserver.cpp: In member function ‘virtual void Tufao::HttpsServer::incomingConnection(int)’:
/home/x/Pobrane/tufao/src/httpsserver.cpp:51:5: error: ‘QSslSocket’ was not declared in this scope
/home/x/Pobrane/tufao/src/httpsserver.cpp:51:17: error: ‘socket’ was not declared in this scope
/home/x/Pobrane/tufao/src/httpsserver.cpp:51:30: error: expected type-specifier before ‘QSslSocket’
/home/x/Pobrane/tufao/src/httpsserver.cpp:51:30: error: expected ‘;’ before ‘QSslSocket’
/home/x/Pobrane/tufao/src/httpsserver.cpp:57:39: error: ‘struct Tufao::HttpsServer::Priv’ has no member named ‘localCertificate’
/home/x/Pobrane/tufao/src/httpsserver.cpp:58:33: error: ‘struct Tufao::HttpsServer::Priv’ has no member named ‘privateKey’
/home/x/Pobrane/tufao/src/httpsserver.cpp:61:16: error: type ‘’ argument given to ‘delete’, expected pointer
make[2]: *** [src/CMakeFiles/tufao.dir/httpsserver.cpp.o] Błąd 1
make[1]: *** [src/CMakeFiles/tufao.dir/all] Błąd 2
make: *** [all] Błąd 2

Regards

Any example on httpserver with threaded(QThread) or ThreadedHttpServer.

I am new to tufao. and have no idea about the thead use of tufao, So, the following code maybe stupid.
1.

    HttpServer *server;

    WebThread webthread(server);  # 

    server->moveToThread(&webthread);

    webthread.start();

run with the fellowing error and exit.

QML debugging is enabled. Only use this in a safe environment.
Error - RtlWerpReportException failed with status code :-1073741823. Will try to launch the process directly

when using ThreadedHttpServer in the main.cpp, build result show:

E:\...\main.cpp:75: error: undefined reference to `Tufao::ThreadedHttpServer::ThreadedHttpServer(QObject*)'

How?

and if any example about ThreadedHttpServer will be great. and I want to set the Url Route.

Please help,Thanks.

Scgi / Fcgi Support

Hi all,

i'm currently looking into adding SCGI support to Tufao, since i don't want Tufao to
do static file serving in a production environment.

I personally would go for scgi instead of fcgi because its much easier to implement,
basically just a netstring containing the headers, followed by the request body.

I thought maybe we could hijack onReadyRead in a HttpServerRequest subclass, parse
the netstring and assemble a Http compatible request and forward it to the already
implemented http parser.

Otoh, a scgi connector needs to worry about less things, like there will be no
websocket upgrades.

What solutions do you use currently? Is there maybe some request forwarder
for apache that works on request uris?
Like: GET index.html --> served by Apache
vs: GET api/something --> served by Tufao

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.