Hobrasoft httpd server
Embedded HTTP server for Qt and C++
httptcpserver.h
Go to the documentation of this file.
1 
6 #ifndef _HttpTcpServer_H_
7 #define _HttpTcpServer_H_
8 
9 #include <QTcpServer>
10 #include <QList>
11 #include <QHash>
12 #include <QSslError>
13 #include <QSslCertificate>
14 
15 namespace HobrasoftHttpd {
16 
17 class HttpServer;
18 class HttpSettings;
19 
20 #if QT_VERSION > 0x050000
21 #define QINTPTR qintptr
22 #else
23 #define QINTPTR int
24 #endif
25 
32 class HttpTcpServer : public QTcpServer {
33  Q_OBJECT
34  public:
36 
37  bool verified(QTcpSocket *) const;
38 
39  QSslCertificate peerCertificate(QTcpSocket *) const;
40 
41  signals:
42 
43  private slots:
44  void slotEncrypted();
45  void slotSslErrors(const QList<QSslError>&);
46  void slotPeerVerifyError(const QSslError&);
47  void slotDisconnected();
48 
49  private:
50  void incomingConnection(QINTPTR socketDescriptor);
51 
52  const HttpSettings *m_settings;
53 
57  QHash<QTcpSocket *, bool> m_verified;
58 
62  QHash<QTcpSocket *, QSslCertificate> m_peerCert;
63 
64 };
65 
66 }
67 
68 #endif
69 
void slotEncrypted()
Slot is invoked when the SSL hanshake is complete and connection is established.
Listens for incoming TCP connections, supports plain and ssl connections.
Definition: httptcpserver.h:32
General single-threaded, event-driven HTTP server.
Definition: httpserver.h:88
void slotSslErrors(const QList< QSslError > &)
Slot is called when an SSL error occured.
HttpTcpServer(HttpServer *)
Constructor creates the class instance.
QHash< QTcpSocket *, bool > m_verified
Verified status of each socket.
Definition: httptcpserver.h:57
void slotDisconnected()
Slot is invoked when the socket disconnets.
QHash< QTcpSocket *, QSslCertificate > m_peerCert
Peer&#39;s certificate of each socket.
Definition: httptcpserver.h:62
QSslCertificate peerCertificate(QTcpSocket *) const
Returns peer&#39;s certificate.
Configuration of the http server instance.
Definition: httpsettings.h:39
bool verified(QTcpSocket *) const
Returns true if the peer&#39;s certificate is valid and signed with server&#39;s CA certificate.
void incomingConnection(QINTPTR socketDescriptor)
Method is invoked when incoming connection arrived.
Namespace of HTTP server.
void slotPeerVerifyError(const QSslError &)
Slot is called when the peer&#39;s certificate is not verified.