62 explicit QHttpNetworkReply(
const QUrl &url = QUrl(), QObject *parent =
nullptr);
63 ~QHttpNetworkReply() override;
65 QUrl url()
const override;
66 void setUrl(
const QUrl &url) override;
68 int majorVersion()
const override;
69 int minorVersion()
const override;
70 void setMajorVersion(
int version);
71 void setMinorVersion(
int version);
73 qint64 contentLength()
const override;
74 void setContentLength(qint64 length) override;
76 QHttpHeaders header()
const override;
77 QByteArray headerField(QByteArrayView name,
const QByteArray &defaultValue = QByteArray())
const override;
78 void setHeaderField(
const QByteArray &name,
const QByteArray &data) override;
79 void appendHeaderField(
const QByteArray &name,
const QByteArray &data);
80 void parseHeader(QByteArrayView header);
82 QHttpNetworkRequest request()
const;
83 void setRequest(
const QHttpNetworkRequest &request);
85 int statusCode()
const;
86 void setStatusCode(
int code);
88 QString errorString()
const;
89 void setErrorString(
const QString &error);
91 QNetworkReply::NetworkError errorCode()
const;
93 QString reasonPhrase()
const;
94 void setReasonPhrase(
const QString &reason);
96 qint64 bytesAvailable()
const;
97 qint64 bytesAvailableNextBlock()
const;
98 bool readAnyAvailable()
const;
100 QByteArray readAll();
101 QByteArray read(qint64 amount);
102 qint64 sizeNextBlock();
103 void setDownstreamLimited(
bool t);
104 void setReadBufferSize(qint64 size);
106 bool supportsUserProvidedDownloadBuffer();
107 void setUserProvidedDownloadBuffer(
char*);
108 char* userProvidedDownloadBuffer();
112 bool isAborted()
const;
113 bool isFinished()
const;
115 bool isPipeliningUsed()
const;
116 bool isHttp2Used()
const;
117 void setHttp2WasUsed(
bool h2Used);
118 qint64 removedContentLength()
const;
120 bool isRedirecting()
const;
122 QHttpNetworkConnection* connection();
124 QUrl redirectUrl()
const;
125 void setRedirectUrl(
const QUrl &url);
127 static bool isHttpRedirect(
int statusCode);
129 bool isCompressed()
const;
132 QSslConfiguration sslConfiguration()
const;
133 void setSslConfiguration(
const QSslConfiguration &config);
134 void ignoreSslErrors();
135 void ignoreSslErrors(
const QList<QSslError> &errors);
139 void sslErrors(
const QList<QSslError> &errors);
140 void preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator *authenticator);
144 void socketStartedConnecting();
148 void finishedWithError(QNetworkReply::NetworkError errorCode,
const QString &detail = QString());
149 void headerChanged();
150 void dataReadProgress(qint64 done, qint64 total);
151 void dataSendProgress(qint64 done, qint64 total);
152 void cacheCredentials(
const QHttpNetworkRequest &request, QAuthenticator *authenticator);
153#ifndef QT_NO_NETWORKPROXY
154 void proxyAuthenticationRequired(
const QNetworkProxy &proxy, QAuthenticator *authenticator);
156 void authenticationRequired(
const QHttpNetworkRequest &request, QAuthenticator *authenticator);
157 void redirected(
const QUrl &url,
int httpStatus,
int maxRedirectsRemaining);
159 Q_DECLARE_PRIVATE(QHttpNetworkReply)
160 friend class QHttpSocketEngine;
161 friend class QHttpNetworkConnection;
162 friend class QHttpNetworkConnectionPrivate;
163 friend class QHttpNetworkConnectionChannel;
164 friend class QHttp2ProtocolHandler;
165 friend class QHttpProtocolHandler;
166 friend class QSpdyProtocolHandler;
173 QHttpNetworkReplyPrivate(
const QUrl &newUrl = QUrl());
174 ~QHttpNetworkReplyPrivate();
175 qint64 readStatus(QIODevice *socket);
176 bool parseStatus(QByteArrayView status);
177 qint64 readHeader(QIODevice *socket);
178 void parseHeader(QByteArrayView header);
179 void appendHeaderField(
const QByteArray &name,
const QByteArray &data);
180 qint64 readBody(QIODevice *socket, QByteDataBuffer *out);
181 qint64 readBodyVeryFast(QIODevice *socket,
char *b);
182 qint64 readBodyFast(QIODevice *socket, QByteDataBuffer *rb);
184 void clearHttpLayerInformation();
186 qint64 readReplyBodyRaw(QIODevice *in, QByteDataBuffer *out, qint64 size);
187 qint64 readReplyBodyChunked(QIODevice *in, QByteDataBuffer *out);
188 qint64 getChunkSize(QIODevice *in, qint64 *chunkSize);
190 bool isRedirecting()
const;
191 bool shouldEmitSignals();
192 bool expectContent();
195 qint64 bytesAvailable()
const;
197 bool isConnectionCloseEnabled();
199 bool isCompressed()
const;
200 void removeAutoDecompressHeader();
211 QHttpNetworkRequest request;
216 qint64 totalProgress;
218 bool chunkedTransferEncoding;
219 bool connectionCloseEnabled;
220 bool forceConnectionCloseEnabled;
222 qint64 currentChunkSize;
223 qint64 currentChunkRead;
224 qint64 readBufferMaxSize;
225 qint64 totallyUploadedData;
226 qint64 removedContentLength;
227 QPointer<QHttpNetworkConnection> connection;
228 QPointer<QHttpNetworkConnectionChannel> connectionChannel;
229 QNetworkReply::NetworkError httpErrorCode = QNetworkReply::NoError;
233 QByteDataBuffer responseData;
234 bool requestIsPrepared;
238 bool downstreamLimited;
240 char* userProvidedDownloadBuffer;