mirror of
https://github.com/YACReader/yacreader
synced 2025-09-06 13:25:03 -04:00
Update httpserver to 1.6.5
This commit is contained in:
@ -5,29 +5,45 @@
|
||||
#include <QTimer>
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include "httpglobal.h"
|
||||
#include "httpconnectionhandler.h"
|
||||
|
||||
/**
|
||||
Pool of http connection handlers. Connection handlers are created on demand and idle handlers are
|
||||
cleaned up in regular time intervals.
|
||||
Pool of http connection handlers. The size of the pool grows and
|
||||
shrinks on demand.
|
||||
<p>
|
||||
Example for the required configuration settings:
|
||||
<code><pre>
|
||||
minThreads=1
|
||||
minThreads=4
|
||||
maxThreads=100
|
||||
cleanupInterval=1000
|
||||
cleanupInterval=60000
|
||||
readTimeout=60000
|
||||
;sslKeyFile=ssl/my.key
|
||||
;sslCertFile=ssl/my.cert
|
||||
maxRequestSize=16000
|
||||
maxMultiPartSize=1000000
|
||||
</pre></code>
|
||||
The pool is empty initially and grows with the number of concurrent
|
||||
connections. A timer removes one idle connection handler at each
|
||||
interval, but it leaves some spare handlers in memory to improve
|
||||
performance.
|
||||
@see HttpConnectionHandler for description of config settings readTimeout
|
||||
After server start, the size of the thread pool is always 0. Threads
|
||||
are started on demand when requests come in. The cleanup timer reduces
|
||||
the number of idle threads slowly by closing one thread in each interval.
|
||||
But the configured minimum number of threads are kept running.
|
||||
<p>
|
||||
For SSL support, you need an OpenSSL certificate file and a key file.
|
||||
Both can be created with the command
|
||||
<code><pre>
|
||||
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout my.key -out my.cert
|
||||
</pre></code>
|
||||
<p>
|
||||
Visit http://slproweb.com/products/Win32OpenSSL.html to download the Light version of OpenSSL for Windows.
|
||||
<p>
|
||||
Please note that a listener with SSL settings can only handle HTTPS protocol. To
|
||||
support both HTTP and HTTPS simultaneously, you need to start two listeners on different ports -
|
||||
one with SLL and one without SSL.
|
||||
@see HttpConnectionHandler for description of the readTimeout
|
||||
@see HttpRequest for description of config settings maxRequestSize and maxMultiPartSize
|
||||
*/
|
||||
|
||||
class HttpConnectionHandlerPool : public QObject {
|
||||
class DECLSPEC HttpConnectionHandlerPool : public QObject {
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(HttpConnectionHandlerPool)
|
||||
public:
|
||||
@ -63,6 +79,12 @@ private:
|
||||
/** Used to synchronize threads */
|
||||
QMutex mutex;
|
||||
|
||||
/** The SSL configuration (certificate, key and other settings) */
|
||||
QSslConfiguration* sslConfiguration;
|
||||
|
||||
/** Load SSL configuration */
|
||||
void loadSslConfig();
|
||||
|
||||
private slots:
|
||||
|
||||
/** Received from the clean-up timer. */
|
||||
|
Reference in New Issue
Block a user