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

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

source code of qthttpserver/src/httpserver/qhttpserverstream_p.h