1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 13:47:01 -04:00

HttpServer: use settings structure as an object not a pointer

This commit is contained in:
f4exb
2017-11-13 13:46:02 +01:00
parent 583712a3d5
commit cf9c7eb8bb
12 changed files with 151 additions and 82 deletions
+26 -5
View File
@@ -16,11 +16,10 @@
#include "httpglobal.h"
#include "httprequest.h"
#include "httprequesthandler.h"
#include "httplistenersettings.h"
namespace qtwebapp {
class HttpListenerSettings;
/** Alias type definition, for compatibility to different Qt versions */
#if QT_VERSION >= 0x050000
typedef qintptr tSocketDescriptor;
@@ -56,12 +55,19 @@ public:
/**
Constructor.
@param settings Configuration settings of the HTTP webserver
@param settings Configuration settings of the HTTP webserver as Qt settings
@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=NULL);
HttpConnectionHandler(HttpListenerSettings* settings, HttpRequestHandler* requestHandler, QSslConfiguration* sslConfiguration=NULL);
/**
Constructor.
@param settings Configuration settings of the HTTP webserver as a structure
@param requestHandler Handler that will process each incoming HTTP request
@param sslConfiguration SSL (HTTPS) will be used if not NULL
*/
HttpConnectionHandler(const HttpListenerSettings& settings, HttpRequestHandler* requestHandler, QSslConfiguration* sslConfiguration=NULL);
/** Destructor */
virtual ~HttpConnectionHandler();
@@ -72,11 +78,26 @@ public:
/** Mark this handler as busy */
void setBusy();
/**
* Get a listener settings copy
* @return The current listener settings
*/
HttpListenerSettings getListenerSettings() const { return listenerSettings; }
/**
* Set new listener settings data
* @param Listener settings to replace current data
*/
void setListenerSettings(const HttpListenerSettings& settings) { listenerSettings = settings; }
private:
/** Configuration settings */
QSettings* settings;
HttpListenerSettings* listenerSettings;
/** Configuration settings */
HttpListenerSettings listenerSettings;
/** TCP socket of the current connection */
QTcpSocket* socket;