| 1 | // Copyright (C) 2019 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QABSTRACTHTTPSERVER_P_H |
| 5 | #define QABSTRACTHTTPSERVER_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists for the convenience |
| 12 | // of QHttpServer. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | |
| 17 | #include <QtHttpServer/qabstracthttpserver.h> |
| 18 | #include <QtHttpServer/qthttpserverglobal.h> |
| 19 | |
| 20 | #include <private/qobject_p.h> |
| 21 | |
| 22 | #include <QtCore/qcoreapplication.h> |
| 23 | |
| 24 | #include <vector> |
| 25 | |
| 26 | #if defined(QT_WEBSOCKETS_LIB) |
| 27 | #include <QtWebSockets/qwebsocketserver.h> |
| 28 | #endif // defined(QT_WEBSOCKETS_LIB) |
| 29 | |
| 30 | #if QT_CONFIG(ssl) |
| 31 | #include <QtNetwork/qhttp2configuration.h> |
| 32 | #endif |
| 33 | |
| 34 | QT_BEGIN_NAMESPACE |
| 35 | |
| 36 | class QHttpServerRequest; |
| 37 | |
| 38 | class QAbstractHttpServerPrivate: public QObjectPrivate |
| 39 | { |
| 40 | public: |
| 41 | Q_DECLARE_PUBLIC(QAbstractHttpServer) |
| 42 | |
| 43 | QAbstractHttpServerPrivate(); |
| 44 | |
| 45 | #if defined(QT_WEBSOCKETS_LIB) |
| 46 | QWebSocketServer websocketServer { |
| 47 | QCoreApplication::applicationName() + QLatin1Char('/') + QCoreApplication::applicationVersion(), |
| 48 | QWebSocketServer::NonSecureMode |
| 49 | }; |
| 50 | #endif // defined(QT_WEBSOCKETS_LIB) |
| 51 | |
| 52 | void handleNewConnections(); |
| 53 | bool verifyThreadAffinity(const QObject *contextObject) const; |
| 54 | |
| 55 | #if QT_CONFIG(localserver) |
| 56 | void handleNewLocalConnections(); |
| 57 | #endif |
| 58 | |
| 59 | #if defined(QT_WEBSOCKETS_LIB) |
| 60 | mutable bool handlingWebSocketUpgrade = false; |
| 61 | struct WebSocketUpgradeVerifier |
| 62 | { |
| 63 | QPointer<const QObject> context; |
| 64 | QtPrivate::SlotObjUniquePtr slotObject; |
| 65 | }; |
| 66 | std::vector<WebSocketUpgradeVerifier> webSocketUpgradeVerifiers; |
| 67 | #endif // defined(QT_WEBSOCKETS_LIB) |
| 68 | #if QT_CONFIG(ssl) |
| 69 | QHttp2Configuration h2Configuration; |
| 70 | #endif |
| 71 | }; |
| 72 | |
| 73 | QT_END_NAMESPACE |
| 74 | |
| 75 | #endif // QABSTRACTHTTPSERVER_P_H |
| 76 | |