Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qnetworkaccessdebugpipebackend_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QNETWORKACCESSDEBUGPIPEBACKEND_P_H
6#define QNETWORKACCESSDEBUGPIPEBACKEND_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists for the convenience
13// of the Network Access API. This header file may change from
14// version to version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtNetwork/private/qtnetworkglobal_p.h>
22#include "qnetworkreply.h"
23#include "qtcpsocket.h"
24
26
27#ifdef QT_BUILD_INTERNAL
28
29class QNetworkAccessDebugPipeBackend: public QNetworkAccessBackend
30{
31 Q_OBJECT
32public:
33 QNetworkAccessDebugPipeBackend();
34 virtual ~QNetworkAccessDebugPipeBackend();
35
36 void open() override;
37 void close() override;
38
39 qint64 read(char *data, qint64 maxlen) override;
40 qint64 bytesAvailable() const override;
41
42protected:
43 void pushFromUpstreamToSocket();
44 void possiblyFinish();
45
46private slots:
47 void uploadReadyReadSlot();
48 void socketReadyRead();
49 void socketBytesWritten(qint64 bytes);
50 void socketError();
51 void socketDisconnected();
52 void socketConnected();
53
54private:
55 QTcpSocket socket;
56 bool bareProtocol;
57 bool hasUploadFinished;
58 bool hasDownloadFinished;
59 bool hasEverythingFinished;
60
61 qint64 bytesDownloaded;
62 qint64 bytesUploaded;
63};
64
65class QNetworkAccessDebugPipeBackendFactory: public QNetworkAccessBackendFactory
66{
67public:
68 virtual QStringList supportedSchemes() const override;
69 virtual QNetworkAccessBackend *create(QNetworkAccessManager::Operation op,
70 const QNetworkRequest &request) const override;
71};
72
73#endif // QT_BUILD_INTERNAL
74
75QT_END_NAMESPACE
76
77#endif