Hobrasoft httpd server
Embedded HTTP server for Qt and C++
httpserver.h
Go to the documentation of this file.
1 
8 #ifndef _HttpServer_H_
9 #define _HttpServer_H_
10 
11 #include <QObject>
12 #include <QTcpServer>
13 #include <QHostAddress>
14 #include <QString>
15 #include <QSslError>
16 #include <QSet>
17 #include <QPointer>
18 #include "testsettings.h"
19 
20 namespace HobrasoftHttpd {
21 
22 class HttpRequestHandler;
23 class HttpConnection;
24 class HttpSettings;
25 class HttpTcpServer;
26 
88 class HttpServer : public QObject {
89  FRIEND_CLASS_TEST;
90  Q_OBJECT
91  public:
92 
96  HttpServer(QObject *parent);
97 
103  HttpServer(const HttpSettings* settings, QObject *parent);
104 
108  void start();
109 
116 
120  const HttpSettings *settings() const { return m_settings; }
121 
122  QVariant webStatus() const;
123 
124  QList<QPointer<HobrasoftHttpd::HttpConnection> > connections() const { return m_connections; }
125 
126  protected:
127 
131  void close();
132 
133  private slots:
134 
140  void slotNewConnection();
141 
142 
143  void slotConnectionClosed(QObject *);
144 
145  private:
146  #ifndef DOXYGEN_SHOULD_SKIP_THIS
147  HttpTcpServer *m_server;
148  const HttpSettings *m_settings;
149  QList<QPointer<HobrasoftHttpd::HttpConnection> > m_connections;
150  #endif
151 
152 };
153 
154 }
155 
156 #endif
const HttpSettings * settings() const
Returs pointer to HttpSettings used in the HttpServer.
Definition: httpserver.h:120
void slotNewConnection()
Slot is invoked when QTcpServer::newConnection() signal arrived.
Definition: httpserver.cpp:76
General single-threaded, event-driven HTTP server.
Definition: httpserver.h:88
HttpServer(QObject *parent)
Constructor using default HttpSettings object.
Definition: httpserver.cpp:19
Configuration of the http server instance.
Definition: httpsettings.h:39
void close()
Closes the QTcpServer bind with your HttpServer.
Definition: httpserver.cpp:33
Processes incoming requests.
virtual HttpRequestHandler * requestHandler(HttpConnection *)
Creates new request handler and returs pointer to it.
Definition: httpserver.cpp:71
void start()
Starts of restart HttpServer with new parameters.
Definition: httpserver.cpp:40
Namespace of HTTP server.
One single connection to http server.