Update QtWebapp to 1.7.11

This commit is contained in:
Felix Kauselmann
2020-07-30 12:28:05 +02:00
parent 3de099491f
commit b9c48cc4b6
31 changed files with 796 additions and 307 deletions

View File

@ -6,7 +6,7 @@
#ifndef HTTPCONNECTIONHANDLER_H
#define HTTPCONNECTIONHANDLER_H
#ifndef QT_NO_OPENSSL
#ifndef QT_NO_SSL
#include <QSslConfiguration>
#endif
#include <QTcpSocket>
@ -17,6 +17,8 @@
#include "httprequest.h"
#include "httprequesthandler.h"
namespace stefanfrings {
/** Alias type definition, for compatibility to different Qt versions */
#if QT_VERSION >= 0x050000
typedef qintptr tSocketDescriptor;
@ -25,7 +27,7 @@
#endif
/** Alias for QSslConfiguration if OpenSSL is not supported */
#ifdef QT_NO_OPENSSL
#ifdef QT_NO_SSL
#define QSslConfiguration QObject
#endif
@ -44,7 +46,7 @@
The readTimeout value defines the maximum time to wait for a complete HTTP request.
@see HttpRequest for description of config settings maxRequestSize and maxMultiPartSize.
*/
class DECLSPEC HttpConnectionHandler : public QThread {
class DECLSPEC HttpConnectionHandler : public QObject {
Q_OBJECT
Q_DISABLE_COPY(HttpConnectionHandler)
@ -56,7 +58,8 @@ public:
@param requestHandler Handler that will process each incoming HTTP request
@param sslConfiguration SSL (HTTPS) will be used if not NULL
*/
HttpConnectionHandler(QSettings* settings, HttpRequestHandler* requestHandler, QSslConfiguration* sslConfiguration=nullptr);
HttpConnectionHandler(const QSettings* settings, HttpRequestHandler* requestHandler,
const QSslConfiguration* sslConfiguration=nullptr);
/** Destructor */
virtual ~HttpConnectionHandler();
@ -70,11 +73,14 @@ public:
private:
/** Configuration settings */
QSettings* settings;
const QSettings* settings;
/** TCP socket of the current connection */
QTcpSocket* socket;
/** The thread that processes events of this connection */
QThread* thread;
/** Time for read timeout detection */
QTimer readTimer;
@ -88,10 +94,7 @@ private:
bool busy;
/** Configuration for SSL */
QSslConfiguration* sslConfiguration;
/** Executes the threads own event loop */
void run() override;
const QSslConfiguration* sslConfiguration;
/** Create SSL or TCP socket */
void createSocket();
@ -102,7 +105,7 @@ public slots:
Received from from the listener, when the handler shall start processing a new connection.
@param socketDescriptor references the accepted connection.
*/
void handleConnection(tSocketDescriptor socketDescriptor);
void handleConnection(const tSocketDescriptor socketDescriptor);
private slots:
@ -115,6 +118,10 @@ private slots:
/** Received from the socket when a connection has been closed */
void disconnected();
/** Cleanup after the thread is closed */
void thread_done();
};
} // end of namespace
#endif // HTTPCONNECTIONHANDLER_H