5#include "QtCore/qdatastream.h"
6#include <QCoreApplication>
9#include "private/qnoncontiguousbytedevice_p.h"
15#ifdef QT_BUILD_INTERNAL
18 ReadBufferSize = 16384,
19 WriteBufferSize = ReadBufferSize
22QStringList QNetworkAccessDebugPipeBackendFactory::supportedSchemes()
const
44 return new QNetworkAccessDebugPipeBackend;
48QNetworkAccessDebugPipeBackend::QNetworkAccessDebugPipeBackend()
51 hasUploadFinished(
false),
52 hasDownloadFinished(
false),
53 hasEverythingFinished(
false),
59QNetworkAccessDebugPipeBackend::~QNetworkAccessDebugPipeBackend()
65void QNetworkAccessDebugPipeBackend::open()
81 createUploadByteDevice();
83 SLOT(uploadReadyReadSlot()));
88void QNetworkAccessDebugPipeBackend::socketReadyRead()
98 hasDownloadFinished =
true;
105 bytesDownloaded += haveRead;
109qint64 QNetworkAccessDebugPipeBackend::bytesAvailable()
const
114void QNetworkAccessDebugPipeBackend::socketBytesWritten(
qint64)
116 pushFromUpstreamToSocket();
119void QNetworkAccessDebugPipeBackend::uploadReadyReadSlot()
121 pushFromUpstreamToSocket();
124void QNetworkAccessDebugPipeBackend::pushFromUpstreamToSocket()
128 if (hasUploadFinished)
136 qint64 haveRead = uploadByteDevice()->peek(
data.data(),
data.size());
137 if (haveRead == -1) {
139 hasUploadFinished =
true;
142 }
else if (haveRead == 0) {
147 data.truncate(haveRead);
150 if (haveWritten < 0) {
158 uploadByteDevice()->skip(haveWritten);
159 bytesUploaded += haveWritten;
168void QNetworkAccessDebugPipeBackend::possiblyFinish()
170 if (hasEverythingFinished)
172 hasEverythingFinished =
true;
185void QNetworkAccessDebugPipeBackend::close()
187 qWarning(
"QNetworkAccessDebugPipeBackend::closeDownstreamChannel() %d",operation());;
193void QNetworkAccessDebugPipeBackend::socketError()
210 error(code, QNetworkAccessDebugPipeBackend::tr(
"Socket error on %1: %2")
217void QNetworkAccessDebugPipeBackend::socketDisconnected()
224 QString msg = QNetworkAccessDebugPipeBackend::tr(
"Remote host closed the connection prematurely on %1")
231void QNetworkAccessDebugPipeBackend::socketConnected()
240#include "moc_qnetworkaccessdebugpipebackend_p.cpp"
virtual void setReadBufferSize(qint64 size)
Sets the size of QAbstractSocket's internal read buffer to be size bytes.
qint64 bytesToWrite() const override
Returns the number of bytes that are waiting to be written.
qint64 bytesAvailable() const override
Returns the number of incoming bytes that are waiting to be read.
void close() override
Closes the I/O device for the socket and calls disconnectFromHost() to close the socket's connection.
SocketError
This enum describes the socket errors that can occur.
virtual void connectToHost(const QString &hostName, quint16 port, OpenMode mode=ReadWrite, NetworkLayerProtocol protocol=AnyIPProtocol)
Attempts to make a connection to hostName on the given port.
SocketError error() const
Returns the type of error that last occurred.
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
QString errorString() const
Returns a human-readable description of the last device error that occurred.
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read.
QNetworkAccessBackend is the base class for implementing support for schemes used by QNetworkAccessMa...
Operation
Indicates the operation this reply is processing.
NetworkError
Indicates all possible error conditions found during the processing of the request.
The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.
QUrl url() const
Returns the URL this network request is referring to.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
QString queryItemValue(const QString &key, QUrl::ComponentFormattingOptions encoding=QUrl::PrettyDecoded) const
Returns the query value associated with key key from the URL, using the options specified in encoding...
QString scheme() const
Returns the scheme of the URL.
Combined button and popup list for selecting options.
constexpr Initialization Uninitialized
DBusConnection const char DBusError * error
GLenum GLsizei GLuint GLint * bytesWritten
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define QStringLiteral(str)
QUrl url("example.com")
[constructor-url-reference]
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
myObject disconnect()
[26]
QNetworkRequest request(url)
textPart setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"text\""))
char * toString(const MyType &t)
[31]