| 1 | // Copyright (C) 2022 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QHTTPSERVERSTREAM_P_H |
| 5 | #define QHTTPSERVERSTREAM_P_H |
| 6 | |
| 7 | #include <QtCore/qobject.h> |
| 8 | |
| 9 | #include <QtHttpServer/qthttpserverglobal.h> |
| 10 | #include <QtHttpServer/qhttpserverresponder.h> |
| 11 | #include <QtHttpServer/qhttpserverrequest.h> |
| 12 | |
| 13 | // |
| 14 | // W A R N I N G |
| 15 | // ------------- |
| 16 | // |
| 17 | // This file is not part of the Qt API. It exists for the convenience |
| 18 | // of QHttpServer. This header file may change from version to |
| 19 | // version without notice, or even be removed. |
| 20 | // |
| 21 | // We mean it. |
| 22 | |
| 23 | QT_BEGIN_NAMESPACE |
| 24 | |
| 25 | class QTcpSocket; |
| 26 | |
| 27 | class QHttpServerStream : public QObject |
| 28 | { |
| 29 | Q_OBJECT |
| 30 | |
| 31 | friend class QHttpServerResponderPrivate; |
| 32 | |
| 33 | protected: |
| 34 | QHttpServerStream(QObject *parent = nullptr); |
| 35 | |
| 36 | virtual void responderDestroyed() = 0; |
| 37 | virtual void startHandlingRequest() = 0; |
| 38 | virtual void socketDisconnected() = 0; |
| 39 | |
| 40 | virtual void (const QByteArray &body, const QHttpHeaders &, |
| 41 | QHttpServerResponder::StatusCode status, quint32 streamId) = 0; |
| 42 | virtual void write(QHttpServerResponder::StatusCode status, quint32 streamId) = 0; |
| 43 | virtual void (QIODevice *data, const QHttpHeaders &, |
| 44 | QHttpServerResponder::StatusCode status, quint32 streamId) = 0; |
| 45 | |
| 46 | virtual void (const QHttpHeaders &, |
| 47 | QHttpServerResponder::StatusCode status, |
| 48 | quint32 streamId) = 0; |
| 49 | virtual void writeChunk(const QByteArray &body, quint32 streamId) = 0; |
| 50 | virtual void (const QByteArray &data, const |
| 51 | QHttpHeaders &trailers, |
| 52 | quint32 streamId) = 0; |
| 53 | |
| 54 | static QHttpServerRequest initRequestFromSocket(QTcpSocket *socket); |
| 55 | }; |
| 56 | |
| 57 | QT_END_NAMESPACE |
| 58 | |
| 59 | #endif // QHTTPSERVERSTREAM_P_H |
| 60 | |