15#include "QtCore/qdatetime.h"
16#include "QtCore/qelapsedtimer.h"
17#include "QtNetwork/qsslconfiguration.h"
21#include "QtCore/qcoreapplication.h"
23#include <QtCore/private/qthread_p.h>
24#include <QtCore/private/qtools_p.h>
37using namespace std::chrono_literals;
52 QHash<QByteArray, QByteArray>
result;
99 }
else if (
c ==
'\\') {
112 static const char separators[] =
"()<>@,;:\\\"/[]?={}";
113 return isLWS(
c) || strchr(separators,
c) !=
nullptr;
150 d->managerPrivate =
manager->d_func();
154 d->outgoingData = outgoingData;
172 if (synchronousHttpAttribute.isValid()) {
173 d->synchronous = synchronousHttpAttribute.
toBool();
174 if (
d->synchronous && outgoingData) {
177 d->outgoingDataBuffer = std::make_shared<QRingBuffer>();
178 qint64 previousDataSize = 0;
180 previousDataSize =
d->outgoingDataBuffer->size();
181 d->outgoingDataBuffer->append(
d->outgoingData->readAll());
182 }
while (
d->outgoingDataBuffer->size() != previousDataSize);
183 d->_q_startOperation();
192 if (!
d->outgoingData->isSequential()) {
198 bool bufferingDisallowed =
202 if (bufferingDisallowed) {
212 d->state =
d->Buffering;
217 d->state =
d->Buffering;
223 d->_q_startOperation();
277 if (
d->cacheLoadDevice) {
282 if (
d->downloadZerocopyBuffer) {
286 if (
d->decompressHelper.isValid()) {
287 if (
d->decompressHelper.isCountingBytes())
289 if (
d->decompressHelper.hasData())
315 if (
d->cacheLoadDevice) {
323 if (
d->downloadZerocopyBuffer) {
326 qint64 howMuch =
qMin(maxlen, (
d->downloadBufferCurrentSize -
d->downloadBufferReadPosition));
327 memcpy(
data,
d->downloadZerocopyBuffer +
d->downloadBufferReadPosition, howMuch);
328 d->downloadBufferReadPosition += howMuch;
333 if (
d->decompressHelper.isValid() && (
d->decompressHelper.hasData() || !
isFinished())) {
334 if (maxlen == 0 || !
d->decompressHelper.hasData())
336 const qint64 bytesRead =
d->decompressHelper.read(
data, maxlen);
337 if (!
d->decompressHelper.isValid()) {
340 .
arg(
d->decompressHelper.errorString()));
341 d->decompressHelper.clear();
344 if (
d->cacheSaveDevice) {
346 d->cacheSaveDevice->write(
data, bytesRead);
348 if (
isFinished() && !
d->decompressHelper.hasData())
349 d->completeCacheSave();
352 qint64 wasBuffered =
d->bytesBuffered;
353 d->bytesBuffered = 0;
360 if (
d->state ==
d->Finished ||
d->state ==
d->Aborted)
363 qint64 wasBuffered =
d->bytesBuffered;
364 d->bytesBuffered = 0;
384 if (
d->cacheLoadDevice)
385 return d->cacheLoadDevice->canReadLine();
387 if (
d->downloadZerocopyBuffer)
388 return memchr(
d->downloadZerocopyBuffer +
d->downloadBufferReadPosition,
'\n',
d->downloadBufferCurrentSize -
d->downloadBufferReadPosition);
399 if (
d->managerPrivate->stsEnabled &&
d->managerPrivate->stsCache.isKnownHost(
url())) {
404 d->pendingIgnoreAllSslErrors =
true;
412 if (
d->managerPrivate->stsEnabled &&
d->managerPrivate->stsCache.isKnownHost(
url())) {
419 d->pendingIgnoreSslErrorsList = errors;
432 if (
d->sslConfiguration.data())
433 configuration = *
d->sslConfiguration;
446 , uploadByteDevicePosition(
false)
447 , uploadDeviceChoking(
false)
451 , loadingFromCache(
false)
453 , cacheEnabled(
false)
458 , downloadBufferReadPosition(0)
459 , downloadBufferCurrentSize(0)
460 , downloadZerocopyBuffer(
nullptr)
461 , pendingDownloadDataEmissions(
std::make_shared<
QAtomicInt>())
462 , pendingDownloadProgressEmissions(
std::make_shared<
QAtomicInt>())
464 , pendingIgnoreAllSslErrors(
false)
490 const auto noCache =
"no-cache"_ba;
519 if (!
data ||
data->size() < sizeOpt.value())
532 if (!
value.empty()) {
534 if (cacheControl.contains(
"must-revalidate"_ba))
536 if (cacheControl.contains(
"no-cache"_ba))
543 bool response_is_fresh;
544 if (!expirationDate.
isValid()) {
562 const qint64 age_value = ageOpt.value_or(0);
567 if (!
value.empty()) {
569 date_value = dateHeader.toSecsSinceEpoch();
577 qint64 apparent_age = qMax<qint64>(0, response_time - date_value);
578 qint64 corrected_received_age =
qMax(apparent_age, age_value);
579 qint64 response_delay = response_time - request_time;
580 qint64 corrected_initial_age = corrected_received_age + response_delay;
581 qint64 resident_time =
now - response_time;
582 qint64 current_age = corrected_initial_age + resident_time;
584 qint64 freshness_lifetime = 0;
587 if (lastModified.
isValid() && dateHeader.isValid()) {
589 freshness_lifetime = diff / 10;
590 const auto warningHeader =
"Warning"_ba;
593 if (currentDateTime.
daysTo(dt) > 1)
600 response_is_fresh = (freshness_lifetime > current_age);
603 response_is_fresh = currentDateTime.
secsTo(expirationDate) >= 0;
606 if (!response_is_fresh)
609#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)
610 qDebug() <<
"response_is_fresh" << CacheLoadControlAttribute;
650 bool ssl = (scheme ==
"https"_L1 || scheme ==
"preconnect-https"_L1);
654 bool preConnect = (scheme ==
"preconnect-http"_L1 || scheme ==
"preconnect-https"_L1);
657#ifndef QT_NO_NETWORKPROXY
674 if (
p.isTransparentProxy()) {
675 transparentProxy =
p;
687 Q_ARG(
QString, QNetworkReplyHttpImpl::tr(
"No suitable proxy found")));
696 redirectPolicy = qvariant_cast<QNetworkRequest::RedirectPolicy>(
value);
750 QHttpHeaders newRequestHeaders = newHttpRequest.headers();
761 int index = requestRange.indexOf(
'-');
763 quint64 requestStartOffset = requestRange.left(
index).toULongLong();
764 quint64 requestEndOffset = requestRange.mid(
index + 1).toULongLong();
776 for (
int i = 0;
i < newRequestHeaders.size();
i++) {
777 const auto name = newRequestHeaders.nameAt(
i);
778 const auto value = newRequestHeaders.valueAt(
i);
786 allowed.
isValid() && allowed.canConvert<
bool>()) {
791 if (h2cAttribute.toBool()
831 if (
bool(threadFinishedConnection))
837#ifndef QT_NO_NETWORKPROXY
857 if (downloadBufferMaximumSizeAttribute.isValid()) {
903#ifndef QT_NO_NETWORKPROXY
929 forwardUploadDevice->setParent(delegate);
941 forwardUploadDevice,
SIGNAL(readyRead()),
978 emit q->startHttpRequestSynchronously();
985 QSharedPointer<char>(),
1004 emit q->startHttpRequest();
1033 if (redirectionTarget.isValid()) {
1046 qCritical(
"QNetworkReplyImpl: network cache returned a device that is not open -- "
1047 "class %s probably needs to be fixed",
1071 qint64 uncompressedBefore = -1;
1097 if (nextSize >
quint64(std::numeric_limits<QByteArray::size_type>::max())) {
1100 "Data downloaded is too large to store"));
1114 d.resize(bytesRead);
1139 if (pendingSignals > 0) {
1162 emit q->readyRead();
1189 if (httpStatus == 307 || httpStatus == 308)
1192 switch (currentOp) {
1209 int maxRedirectsRemaining)
1231 const bool wasLocalSocket = schemeBefore.startsWith(
"unix"_L1);
1248 const bool changingLocalScheme = wasLocalSocket &&
url.
scheme() != schemeBefore;
1249 const bool isLessSafe = changingLocalScheme
1250 || (schemeBefore ==
"https"_L1 &&
url.
scheme() ==
"http"_L1);
1260 && (httpStatus == 307 || httpStatus == 308);
1287 auto cookies = cookieJar->cookiesForUrl(
url);
1288 if (!cookies.empty()) {
1340 int sc,
const QString &rp,
bool pu,
1341 QSharedPointer<char>
db,
1343 qint64 removedContentLength,
1344 bool h2Used,
bool isCompressed)
1376 const bool shouldDecompress = isCompressed && autoDecompress;
1378 auto h =
q->headers();
1380 const auto key = hm.nameAt(
i);
1381 const auto originValue = hm.valueAt(
i);
1400 request.decompressedSafetyCheckThreshold());
1403 h.append(
key, originValue);
1405 q->setHeaders(std::move(
h));
1409 if (removedContentLength != -1)
1421 bool mustReValidate =
false;
1422 if (!
value.empty()) {
1424 if (cacheControl.contains(
"must-revalidate"_ba))
1425 mustReValidate =
true;
1433#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)
1440 if (oldMetaData != metaData)
1441 nc->updateMetaData(metaData);
1467 if (pendingSignals > 0) {
1497 emit q->readyRead();
1510#ifndef QT_NO_NETWORKPROXY
1521#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)
1533 emit q->encrypted();
1537 const QList<QSslError> &
list,
bool *
ignoreAll, QList<QSslError> *toBeIgnored)
1560 emit q->preSharedKeyAuthenticationRequired(authenticator);
1598 qint64 currentUploadDataLength = 0;
1599 char *
data =
const_cast<char*
>(
uploadByteDevice->readPointer(maxSize, currentUploadDataLength));
1601 if (currentUploadDataLength == 0) {
1644#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)
1645 qDebug() <<
"Cannot send cache, the contents are 0" <<
url;
1666 const auto name = cachedHeaders.nameAt(
i);
1667 const auto value = cachedHeaders.valueAt(
i);
1692#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)
1722 "proxy-authenticate",
1723 "proxy-authorization",
1726 "transfer-encoding",
1738 const auto newHeaders =
q->headers();
1741 const auto value = newHeaders.valueAt(
i);
1760 if (
value.size() == 3
1767 if (cacheHeaders.contains(
name)) {
1770 {
"content-encoding",
"content-range",
"content-type"};
1780#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)
1789 cacheHeaders.replaceOrAppend(
name,
value);
1793 bool checkExpired =
true;
1795 QHash<QByteArray, QByteArray> cacheControl;
1797 if (!
value.empty()) {
1799 QByteArray maxAge = cacheControl.value(
"max-age"_ba);
1801 checkExpired =
false;
1803 dt = dt.addSecs(maxAge.
toInt());
1808 if (
const auto value = cacheHeaders.value(
1815 if (
const auto value = cacheHeaders.value(
1826 canDiskCache =
true;
1828 if (cacheControl.contains(
"no-store"_ba))
1829 canDiskCache =
false;
1834 canDiskCache =
false;
1837 if (cacheControl.contains(
"max-age"_ba))
1838 canDiskCache =
true;
1842 canDiskCache =
false;
1867 const auto h =
q->headers();
1871 if (acceptRanges.empty() || acceptRanges ==
"none")
1876 if (!
range.empty()) {
1908 q_func()->setFinished(
true);
1933 emit q->readyRead();
1956 if (actualCount < 0) {
1960 }
else if (actualCount == 1) {
2011 qint64 bytesToBuffer = 0;
2017 if (bytesToBuffer <= 0)
2018 bytesToBuffer = 2*1024;
2057 if (
request.transferTimeoutAsDuration() > 0ms) {
2087 emit q->uploadProgress(bytesSent, bytesTotal);
2126 const qint64 totalSize = totalSizeOpt.value_or(-1);
2141 q->setFinished(
true);
2143 if (totalSize == -1) {
2150 emit q->uploadProgress(0, 0);
2152 emit q->readChannelFinished();
2169 qWarning(
"QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once.");
2179 emit q->errorOccurred(code);
2193 const auto cookies = cookiesOpt.value_or(QList<QNetworkCookie>());
2194 if (!cookies.empty()
2202 emit q->metaDataChanged();
2230 qCritical(
"QNetworkReplyImpl: backend error: caching was enabled after some bytes had been written");
2238 qDebug(
"QNetworkReplyImpl: setCachingEnabled(true) called after setCachingEnabled(false)");
2263#include "moc_qnetworkreplyhttpimpl_p.cpp"
The QAbstractNetworkCache class provides the interface for cache implementations.
virtual void insert(QIODevice *device)=0
Inserts the data in device and the prepared meta data into the cache.
virtual QIODevice * prepare(const QNetworkCacheMetaData &metaData)=0
Returns the device that should be populated with the data for the cache item metaData.
virtual bool remove(const QUrl &url)=0
Removes the cache entry for url, returning true if success otherwise false.
The QAuthenticator class provides an authentication object.
constexpr QByteArrayView mid(qsizetype pos, qsizetype n=-1) const
int toInt(bool *ok=nullptr, int base=10) const
Returns the byte array converted to an int using base base, which is ten by default.
bool isEmpty() const noexcept
Returns true if the byte array has size 0; otherwise returns false.
static QByteArray number(int, int base=10)
Returns a byte-array representing the whole number n as text.
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
\inmodule QtCore\reentrant
qint64 secsTo(const QDateTime &) const
Returns the number of seconds from this datetime to the other datetime.
QDateTime addSecs(qint64 secs) const
Returns a QDateTime object containing a datetime s seconds later than the datetime of this object (or...
bool isValid() const
Returns true if this datetime represents a definite moment, otherwise false.
static QDateTime currentDateTimeUtc()
qint64 daysTo(const QDateTime &) const
Returns the number of days from this datetime to the other datetime.
qint64 toSecsSinceEpoch() const
void setCountingBytesEnabled(bool shouldCount)
bool setEncoding(QByteArrayView contentEncoding)
void feed(const QByteArray &data)
qint64 uncompressedSize() const
qsizetype read(char *data, qsizetype maxSize)
void setDecompressedSafetyCheckThreshold(qint64 threshold)
bool isCountingBytes() const
QString errorString() const
void invalidate() noexcept
Marks this QElapsedTimer object as invalid.
qint64 elapsed() const noexcept
Returns the number of milliseconds since this QElapsedTimer was last started.
qint64 restart() noexcept
Restarts the timer and returns the number of milliseconds elapsed since the previous start.
void start() noexcept
\typealias QElapsedTimer::Duration Synonym for std::chrono::nanoseconds.
bool isValid() const noexcept
Returns false if the timer has never been started or invalidated by a call to invalidate().
T value(const Key &key) const noexcept
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
bool isKnownHost(const QUrl &url) const
void updateFromHeaders(const QHttpHeaders &headers, const QUrl &url)
static bool isHttpRedirect(int statusCode)
void setPipeliningAllowed(bool b)
void setCustomVerb(const QByteArray &customOperation)
bool isFollowRedirects() const
void setPriority(Priority priority)
void setPreConnect(bool preConnect)
void setRedirectPolicy(QNetworkRequest::RedirectPolicy policy)
void setWithCredentials(bool b)
void setPeerVerifyName(const QString &peerName)
void setHeaderField(const QByteArray &name, const QByteArray &data) override
void setUrl(const QUrl &url) override
void setH2cAllowed(bool b)
QByteArray headerField(QByteArrayView name, const QByteArray &defaultValue=QByteArray()) const override
QUrl url() const override
void setHTTP2Allowed(bool b)
void setHTTP2Direct(bool b)
void setOperation(Operation operation)
Operation operation() const
void setRedirectCount(int count)
int redirectCount() const
QNetworkRequest::RedirectPolicy redirectPolicy() const
void setUploadByteDevice(QNonContiguousByteDevice *bd)
void socketStartedConnecting()
QString incomingErrorDetail
QScopedPointer< QSslConfiguration > incomingSslConfiguration
std::shared_ptr< QAtomicInt > pendingDownloadData
void downloadMetaData(const QHttpHeaders &, int, const QString &, bool, QSharedPointer< char >, qint64, qint64, bool, bool)
QHttpNetworkRequest httpRequest
QHttp1Configuration http1Parameters
QByteArray synchronousDownloadData
qint64 connectionCacheExpiryTimeoutSeconds
QString incomingReasonPhrase
QNetworkProxy transparentProxy
qint64 incomingContentLength
qint64 downloadBufferMaximumSize
QHttp2Configuration http2Parameters
std::shared_ptr< QAtomicInt > pendingDownloadProgress
QNetworkReply::NetworkError incomingErrorCode
QHttpHeaders incomingHeaders
qint64 removedContentLength
std::shared_ptr< QNetworkAccessAuthenticationManager > authenticationManager
\inmodule QtCore \reentrant
virtual bool open(QIODeviceBase::OpenMode mode)
Opens the device and sets its OpenMode to mode.
virtual qint64 size() const
For open random-access devices, this function returns the size of the device.
virtual bool isSequential() const
Returns true if this device is sequential; otherwise returns false.
bool isOpen() const
Returns true if the device is open; otherwise returns false.
QByteArray readAll()
Reads all remaining data from the device, and returns it as a byte array.
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
virtual qint64 bytesAvailable() const
Returns the number of bytes that are available for reading.
virtual bool reset()
Seeks to the start of input for random-access devices.
virtual bool atEnd() const
Returns true if the current read and write position is at the end of the device (i....
void ungetChar(char c)
Puts the character c back into the device, and decrements the current position unless the position is...
virtual bool canReadLine() const
Returns true if a complete line of data can be read from the device; otherwise returns false.
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read.
bool isEmpty() const noexcept
QList< QNetworkProxy > queryProxy(const QNetworkProxyQuery &query)
void proxyAuthenticationRequired(const QUrl &url, const QNetworkProxy &proxy, bool synchronous, QAuthenticator *authenticator, QNetworkProxy *lastProxyAuthentication)
QAbstractNetworkCache * networkCache
void authenticationRequired(QAuthenticator *authenticator, QNetworkReply *reply, bool synchronous, QUrl &url, QUrl *urlForLastAuthentication, bool allowAuthenticationReuse=true)
std::shared_ptr< QNetworkAccessAuthenticationManager > authenticationManager
The QNetworkAccessManager class allows the application to send network requests and receive replies.
Operation
Indicates the operation this reply is processing.
QNetworkCookieJar * cookieJar() const
Returns the QNetworkCookieJar that is used to store cookies obtained from the network as well as cook...
The QNetworkCookieJar class implements a simple jar of QNetworkCookie objects.
virtual bool setCookiesFromUrl(const QList< QNetworkCookie > &cookieList, const QUrl &url)
Adds the cookies in the list cookieList to this cookie jar.
The QNetworkProxyQuery class is used to query the proxy settings for a socket.
The QNetworkProxy class provides a network layer proxy.
QNetworkProxy::ProxyType type() const
Returns the proxy type for this instance.
QHttpHeaders headers() const
void setResumeOffset(quint64 offset)
QNetworkRequest createRedirectRequest(const QNetworkRequest &originalRequests, const QUrl &url, int maxRedirectsRemainig)
void setupTransferTimeout()
QSharedPointer< char > downloadBufferPointer
QNetworkCacheMetaData fetchCacheMetaData(const QNetworkCacheMetaData &metaData) const
void _q_error(QNetworkReply::NetworkError code, const QString &errorString)
void wantUploadDataSlot(qint64)
void _q_bufferOutgoingDataFinished()
qint64 uploadByteDevicePosition
void resetUploadDataSlot(bool *r)
void setCachingEnabled(bool enable)
void httpError(QNetworkReply::NetworkError error, const QString &errorString)
std::shared_ptr< QAtomicInt > pendingDownloadProgressEmissions
void _q_bufferOutgoingData()
QNetworkAccessManagerPrivate * managerPrivate
void replyDownloadMetaData(const QHttpHeaders &, int, const QString &, bool, QSharedPointer< char >, qint64, qint64, bool, bool)
bool pendingIgnoreAllSslErrors
qint64 downloadBufferCurrentSize
QHttpNetworkRequest httpRequest
void _q_cacheSaveDeviceAboutToClose()
static QHttpNetworkRequest::Priority convert(const QNetworkRequest::Priority &prio)
char * downloadZerocopyBuffer
void replySslConfigurationChanged(const QSslConfiguration &newSslConfiguration)
void onRedirected(const QUrl &redirectUrl, int httpStatus, int maxRedirectsRemainig)
void error(QNetworkReply::NetworkError code, const QString &errorString)
qint64 lastReadyReadEmittedSize
QNetworkAccessManager::Operation getRedirectOperation(QNetworkAccessManager::Operation currentOp, int httpStatus)
~QNetworkReplyHttpImplPrivate()
QDecompressHelper decompressHelper
void initCacheSaveDevice()
std::shared_ptr< QNonContiguousByteDevice > uploadByteDevice
QNetworkProxy lastProxyAuthentication
void httpAuthenticationRequired(const QHttpNetworkRequest &request, QAuthenticator *auth)
void replyDownloadProgressSlot(qint64, qint64)
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth)
bool sendCacheContents(const QNetworkCacheMetaData &metaData)
void checkForRedirect(const int statusCode)
QScopedPointer< QSslConfiguration > sslConfiguration
QNetworkReplyHttpImplPrivate()
QIODevice * cacheLoadDevice
QNonContiguousByteDevice * createUploadByteDevice()
std::shared_ptr< QAtomicInt > pendingDownloadDataEmissions
QNetworkAccessManager * manager
void emitReplyUploadProgress(qint64 bytesSent, qint64 bytesTotal)
void _q_metaDataChanged()
void uploadByteDeviceReadyReadSlot()
void replySslErrors(const QList< QSslError > &, bool *, QList< QSslError > *)
QNetworkRequest redirectRequest
bool isCachingEnabled() const
void replyDownloadData(QByteArray)
QUrl urlForLastAuthentication
bool isCachingAllowed() const
bool loadFromCacheIfAllowed(QHttpNetworkRequest &httpRequest)
std::shared_ptr< QRingBuffer > outgoingDataBuffer
void sentUploadDataSlot(qint64, qint64)
void replyPreSharedKeyAuthenticationRequiredSlot(QSslPreSharedKeyAuthenticator *)
void postRequest(const QNetworkRequest &newHttpRequest)
void _q_cacheLoadReadyRead()
void _q_transferTimedOut()
QList< QSslError > pendingIgnoreSslErrorsList
bool isHttpRedirectResponse() const
QIODevice * cacheSaveDevice
qint64 readData(char *, qint64) override
Reads up to maxSize bytes from the device into data, and returns the number of bytes read or -1 if an...
void readBufferFreed(qint64 size)
void setSslConfigurationImplementation(const QSslConfiguration &configuration) override
void readBufferSizeChanged(qint64 size)
void abort() override
Aborts the operation immediately and close down any network connections still open.
void close() override
Closes this device for reading.
qint64 size() const override
For open random-access devices, this function returns the size of the device.
QNetworkReplyHttpImpl(QNetworkAccessManager *const, const QNetworkRequest &, QNetworkAccessManager::Operation &, QIODevice *outgoingData)
virtual ~QNetworkReplyHttpImpl()
void void void void void void void void void void void void void void void void void void void void void void void void void followRedirect()) protected void ignoreSslErrorsImplementation(const QList< QSslError > &errors) override
void sslConfigurationImplementation(QSslConfiguration &configuration) const override
qint64 bytesAvailable() const override
Returns the number of bytes that are available for reading.
bool isSequential() const override
bool canReadLine() const override
Returns true if a complete line of data can be read from the device; otherwise returns false.
void setReadBufferSize(qint64 size) override
Sets the size of the read buffer to be size bytes.
QElapsedTimer downloadProgressSignalChoke
static const int progressSignalInterval
QNetworkAccessManager::Operation operation
QNetworkRequest originalRequest
bool emitAllUploadProgressSignals
QElapsedTimer uploadProgressSignalChoke
QNetworkReply::NetworkError errorCode
The QNetworkReply class contains the data and headers for a request sent with QNetworkAccessManager.
void socketStartedConnecting()
virtual void setReadBufferSize(qint64 size)
Sets the size of the read buffer to be size bytes.
QNetworkAccessManager * manager() const
Returns the QNetworkAccessManager that was used to create this QNetworkReply object.
virtual void close() override
Closes this device for reading.
QNetworkAccessManager::Operation operation() const
Returns the operation that was posted for this reply.
qint64 readBufferSize() const
Returns the size of the read buffer, in bytes.
NetworkError
Indicates all possible error conditions found during the processing of the request.
virtual void ignoreSslErrors()
If this function is called, SSL errors related to network connection will be ignored,...
QNetworkRequest request() const
Returns the request that was posted for this reply.
QUrl url() const
Returns the URL of the content downloaded or uploaded.
The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.
void setHeaders(const QHttpHeaders &newHeaders)
This is an overloaded member function, provided for convenience. It differs from the above function o...
@ SourceIsFromCacheAttribute
@ EmitAllUploadProgressSignalsAttribute
@ OriginalContentLengthAttribute
@ HttpPipeliningWasUsedAttribute
@ CookieSaveControlAttribute
@ HttpStatusCodeAttribute
@ CacheSaveControlAttribute
@ CacheLoadControlAttribute
@ RedirectPolicyAttribute
@ DownloadBufferAttribute
@ DoNotBufferUploadDataAttribute
@ ConnectionCacheExpiryTimeoutSecondsAttribute
@ HttpPipeliningAllowedAttribute
@ RedirectionTargetAttribute
@ AuthenticationReuseAttribute
@ MaximumDownloadBufferSizeAttribute
@ HttpReasonPhraseAttribute
@ SynchronousRequestAttribute
@ ConnectionEncryptedAttribute
@ Http2CleartextAllowedAttribute
QVariant attribute(Attribute code, const QVariant &defaultValue=QVariant()) const
Returns the attribute associated with the code code.
@ UserVerifiedRedirectPolicy
@ NoLessSafeRedirectPolicy
QHttpHeaders headers() const
void setMaximumRedirectsAllowed(int maximumRedirectsAllowed)
void setUrl(const QUrl &url)
Sets the URL this network request is referring to be url.
QUrl url() const
Returns the URL this network request is referring to.
CacheLoadControl
Controls the caching mechanism of QNetworkAccessManager.
QSslConfiguration sslConfiguration() const
Returns this network request's SSL configuration.
static std::shared_ptr< QNonContiguousByteDevice > createShared(QIODevice *device)
Create a QNonContiguousByteDevice out of a QIODevice, return it in a std::shared_ptr.
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
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
bool moveToThread(QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL)
Changes the thread affinity for this object and its children and returns true on success.
Q_WEAK_OVERLOAD void setObjectName(const QString &name)
Sets the object's name to name.
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
void deleteLater()
\threadsafe
T * data() const noexcept
Returns the value of the pointer referenced by this object.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
T * data() const noexcept
Returns the value of the pointer referenced by this object.
The QSslConfiguration class holds the configuration and state of an SSL connection.
The QSslPreSharedKeyAuthenticator class provides authentication data for pre shared keys (PSK) cipher...
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void start(Priority=InheritPriority)
bool wait(QDeadlineTimer deadline=QDeadlineTimer(QDeadlineTimer::Forever))
void setSingleShot(bool singleShot)
void setInterval(int msec)
void stop()
Stops the timer.
QString url(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
Returns a string representation of the URL.
bool isValid() const
Returns true if the URL is non-empty and valid; otherwise returns false.
QString scheme() const
Returns the scheme of the URL.
void setScheme(const QString &scheme)
Sets the scheme of the URL to scheme.
int port(int defaultPort=-1) const
static QUrl fromEncoded(QByteArrayView input, ParsingMode mode=TolerantMode)
Parses input and returns the corresponding QUrl.
void setPort(int port)
Sets the port of the URL to port.
bool isValid() const
Returns true if the storage type of this variant is not QMetaType::UnknownType; otherwise returns fal...
int toInt(bool *ok=nullptr) const
Returns the variant as an int if the variant has userType() \l QMetaType::Int, \l QMetaType::Bool,...
bool toBool() const
Returns the variant as a bool if the variant has userType() Bool.
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Combined button and popup list for selecting options.
constexpr bool isAsciiDigit(char32_t c) noexcept
@ BlockingQueuedConnection
DBusConnection const char DBusError * error
static QString header(const QString &name)
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static bool isSeparator(char c)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
static int nextNonWhitespace(QByteArrayView text, int from)
static QByteArray cacheControlName()
static constexpr QLatin1StringView locationHeader() noexcept
static auto caseInsensitiveCompare(QByteArrayView value)
static QByteArray rangeName()
static bool isHopByHop(QByteArrayView header)
static constexpr QByteArrayView bytesEqualPrefix() noexcept
static QHash< QByteArray, QByteArray > parseHttpOptionHeader(QByteArrayView header)
#define Q_ARG(Type, data)
GLenum GLsizei GLsizei GLint * values
[15]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLbitfield GLuint64 timeout
[4]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLfloat GLfloat GLfloat GLfloat h
GLdouble GLdouble GLdouble GLdouble q
#define QStringLiteral(str)
Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) noexcept
unsigned long long quint64
static QString errorMessage(QUrlPrivate::ErrorCode errorCode, const QString &errorSource, qsizetype errorPosition)
static bool equal(const QChar *a, int l, const char *b)
QUrl url("example.com")
[constructor-url-reference]
QNetworkAccessManager manager
QNetworkRequest request(url)