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>
94 }
else if (
c ==
'\\') {
107 static const char separators[] =
"()<>@,;:\\\"/[]?={}";
108 return isLWS(
c) || strchr(separators,
c) !=
nullptr;
145 d->managerPrivate =
manager->d_func();
149 d->outgoingData = outgoingData;
167 if (synchronousHttpAttribute.
isValid()) {
168 d->synchronous = synchronousHttpAttribute.
toBool();
169 if (
d->synchronous && outgoingData) {
172 d->outgoingDataBuffer = std::make_shared<QRingBuffer>();
173 qint64 previousDataSize = 0;
175 previousDataSize =
d->outgoingDataBuffer->size();
176 d->outgoingDataBuffer->append(
d->outgoingData->readAll());
177 }
while (
d->outgoingDataBuffer->size() != previousDataSize);
178 d->_q_startOperation();
187 if (!
d->outgoingData->isSequential()) {
193 bool bufferingDisallowed =
197 if (bufferingDisallowed) {
204 d->state =
d->Buffering;
209 d->state =
d->Buffering;
215 d->_q_startOperation();
269 if (
d->cacheLoadDevice) {
274 if (
d->downloadZerocopyBuffer) {
278 if (
d->decompressHelper.isValid()) {
279 if (
d->decompressHelper.isCountingBytes())
281 if (
d->decompressHelper.hasData())
307 if (
d->cacheLoadDevice) {
315 if (
d->downloadZerocopyBuffer) {
318 qint64 howMuch =
qMin(maxlen, (
d->downloadBufferCurrentSize -
d->downloadBufferReadPosition));
319 memcpy(
data,
d->downloadZerocopyBuffer +
d->downloadBufferReadPosition, howMuch);
320 d->downloadBufferReadPosition += howMuch;
325 if (
d->decompressHelper.isValid() && (
d->decompressHelper.hasData() || !
isFinished())) {
326 if (maxlen == 0 || !
d->decompressHelper.hasData())
328 const qint64 bytesRead =
d->decompressHelper.read(
data, maxlen);
329 if (!
d->decompressHelper.isValid()) {
332 .
arg(
d->decompressHelper.errorString()));
333 d->decompressHelper.clear();
336 if (
d->cacheSaveDevice) {
338 d->cacheSaveDevice->write(
data, bytesRead);
340 if (
isFinished() && !
d->decompressHelper.hasData())
341 d->completeCacheSave();
344 qint64 wasBuffered =
d->bytesBuffered;
345 d->bytesBuffered = 0;
352 if (
d->state ==
d->Finished ||
d->state ==
d->Aborted)
355 qint64 wasBuffered =
d->bytesBuffered;
356 d->bytesBuffered = 0;
376 if (
d->cacheLoadDevice)
377 return d->cacheLoadDevice->canReadLine();
379 if (
d->downloadZerocopyBuffer)
380 return memchr(
d->downloadZerocopyBuffer +
d->downloadBufferReadPosition,
'\n',
d->downloadBufferCurrentSize -
d->downloadBufferReadPosition);
391 if (
d->managerPrivate->stsEnabled &&
d->managerPrivate->stsCache.isKnownHost(
url())) {
396 d->pendingIgnoreAllSslErrors =
true;
404 if (
d->managerPrivate->stsEnabled &&
d->managerPrivate->stsCache.isKnownHost(
url())) {
411 d->pendingIgnoreSslErrorsList = errors;
424 if (
d->sslConfiguration.data())
425 configuration = *
d->sslConfiguration;
438 , uploadByteDevicePosition(
false)
439 , uploadDeviceChoking(
false)
443 , loadingFromCache(
false)
445 , cacheEnabled(
false)
450 , downloadBufferReadPosition(0)
451 , downloadBufferCurrentSize(0)
452 , downloadZerocopyBuffer(
nullptr)
453 , pendingDownloadDataEmissions(
std::make_shared<
QAtomicInt>())
454 , pendingDownloadProgressEmissions(
std::make_shared<
QAtomicInt>())
456 , pendingIgnoreAllSslErrors(
false)
523 if (cacheControl.
contains(
"must-revalidate"))
525 if (cacheControl.
contains(
"no-cache"))
532 bool response_is_fresh;
533 if (!expirationDate.
isValid()) {
552 age_value =
it->second.toLongLong();
567 qint64 apparent_age = qMax<qint64>(0, response_time - date_value);
568 qint64 corrected_received_age =
qMax(apparent_age, age_value);
569 qint64 response_delay = response_time - request_time;
570 qint64 corrected_initial_age = corrected_received_age + response_delay;
571 qint64 resident_time =
now - response_time;
572 qint64 current_age = corrected_initial_age + resident_time;
574 qint64 freshness_lifetime = 0;
579 freshness_lifetime = diff / 10;
582 if (currentDateTime.
daysTo(dt) > 1)
589 response_is_fresh = (freshness_lifetime > current_age);
592 response_is_fresh = currentDateTime.
secsTo(expirationDate) >= 0;
595 if (!response_is_fresh)
598#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)
599 qDebug() <<
"response_is_fresh" << CacheLoadControlAttribute;
639 bool ssl = (scheme ==
"https"_L1 || scheme ==
"preconnect-https"_L1);
643 bool preConnect = (scheme ==
"preconnect-http"_L1 || scheme ==
"preconnect-https"_L1);
646#ifndef QT_NO_NETWORKPROXY
663 if (
p.isTransparentProxy()) {
664 transparentProxy =
p;
676 Q_ARG(
QString, QNetworkReplyHttpImpl::tr(
"No suitable proxy found")));
685 redirectPolicy = qvariant_cast<QNetworkRequest::RedirectPolicy>(
value);
767 allowed.
isValid() && allowed.canConvert<
bool>()) {
772 if (h2cAttribute.toBool()
812 if (
bool(threadFinishedConnection))
818#ifndef QT_NO_NETWORKPROXY
838 if (downloadBufferMaximumSizeAttribute.
isValid()) {
884#ifndef QT_NO_NETWORKPROXY
910 forwardUploadDevice->
setParent(delegate);
922 forwardUploadDevice,
SIGNAL(readyRead()),
959 emit q->startHttpRequestSynchronously();
985 emit q->startHttpRequest();
1014 if (redirectionTarget.
isValid()) {
1027 qCritical(
"QNetworkReplyImpl: network cache returned a device that is not open -- "
1028 "class %s probably needs to be fixed",
1052 qint64 uncompressedBefore = -1;
1078 if (nextSize >
quint64(std::numeric_limits<QByteArray::size_type>::max())) {
1081 "Data downloaded is too large to store"));
1095 d.resize(bytesRead);
1120 if (pendingSignals > 0) {
1142 emit q->readyRead();
1170 if (httpStatus == 307 || httpStatus == 308)
1173 switch (currentOp) {
1190 int maxRedirectsRemaining)
1226 const bool isLessSafe = schemeBefore ==
"https"_L1 &&
url.
scheme() ==
"http"_L1;
1258 auto cookies = cookieJar->cookiesForUrl(
url);
1259 if (!cookies.empty()) {
1308 int sc,
const QString &rp,
bool pu,
1311 qint64 removedContentLength,
1312 bool h2Used,
bool isCompressed)
1344 const bool shouldDecompress = isCompressed && autoDecompress;
1355 if (
it->first.toLower() ==
"location")
1371 request.decompressedSafetyCheckThreshold());
1374 if (!
value.isEmpty()) {
1388 if (removedContentLength != -1)
1403 bool mustReValidate =
false;
1406 if (cacheControl.
contains(
"must-revalidate"))
1407 mustReValidate =
true;
1415#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)
1422 if (oldMetaData != metaData)
1449 if (pendingSignals > 0) {
1479 emit q->readyRead();
1492#ifndef QT_NO_NETWORKPROXY
1503#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)
1515 emit q->encrypted();
1542 emit q->preSharedKeyAuthenticationRequired(authenticator);
1580 qint64 currentUploadDataLength = 0;
1581 char *
data =
const_cast<char*
>(
uploadByteDevice->readPointer(maxSize, currentUploadDataLength));
1583 if (currentUploadDataLength == 0) {
1626#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)
1627 qDebug() <<
"Cannot send cache, the contents are 0" <<
url;
1669#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)
1703 ||
header ==
"keep-alive"
1704 ||
header ==
"proxy-authenticate"
1705 ||
header ==
"proxy-authorization"
1708 ||
header ==
"transfer-encoding"
1713 if (
header ==
"set-cookie")
1726 if (
header ==
"warning") {
1738 if (
header ==
"content-encoding"
1739 ||
header ==
"content-range"
1740 ||
header ==
"content-type")
1749#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)
1764 bool checkExpired =
true;
1772 checkExpired =
false;
1795 canDiskCache =
true;
1797 if (cacheControl.
contains(
"no-store"))
1798 canDiskCache =
false;
1803 canDiskCache =
false;
1806 if (cacheControl.
contains(
"max-age"))
1807 canDiskCache =
true;
1811 canDiskCache =
false;
1837 QByteArray acceptRangesheaderName(
"Accept-Ranges");
1838 if (!
q->hasRawHeader(acceptRangesheaderName) ||
q->rawHeader(acceptRangesheaderName) ==
"none")
1844 if (!
range.startsWith(
"bytes="))
1873 q_func()->setFinished(
true);
1898 emit q->readyRead();
1922 if (actualCount < 0) {
1926 }
else if (actualCount == 1) {
1977 qint64 bytesToBuffer = 0;
1983 if (bytesToBuffer <= 0)
1984 bytesToBuffer = 2*1024;
2023 if (
request.transferTimeout()) {
2053 emit q->uploadProgress(bytesSent, bytesTotal);
2105 q->setFinished(
true);
2107 if (totalSize.
isNull() || totalSize == -1) {
2114 emit q->uploadProgress(0, 0);
2116 emit q->readChannelFinished();
2131 qWarning(
"QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once.");
2141 emit q->errorOccurred(code);
2159 qvariant_cast<QList<QNetworkCookie> >(
it.value());
2163 emit q->metaDataChanged();
2191 qCritical(
"QNetworkReplyImpl: backend error: caching was enabled after some bytes had been written");
2199 qDebug(
"QNetworkReplyImpl: setCachingEnabled(true) called after setCachingEnabled(false)");
2224#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 * data(const QUrl &url)=0
Returns the data associated with url.
virtual void updateMetaData(const QNetworkCacheMetaData &metaData)=0
Updates the cache meta date for the metaData's url to metaData.
virtual QNetworkCacheMetaData metaData(const QUrl &url)=0
Returns the meta data for the url url.
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.
QByteArray trimmed() const &
qulonglong toULongLong(bool *ok=nullptr, int base=10) const
Returns the byte array converted to an {unsigned long long} using base base, which is ten by default.
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.
qsizetype indexOf(char c, qsizetype from=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
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.
void clear()
Clears the contents of the byte array and makes it null.
QByteArray toLower() const &
QByteArray left(qsizetype len) const
Returns a byte array that contains the first len bytes of this byte array.
QByteArray mid(qsizetype index, qsizetype len=-1) const
Returns a byte array containing len bytes from this byte array, starting at position pos.
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)
void feed(const QByteArray &data)
qint64 uncompressedSize() const
bool setEncoding(const QByteArray &contentEncoding)
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
Starts this timer.
bool isValid() const noexcept
Returns false if the timer has never been started or invalidated by a call to invalidate().
const_iterator constFind(const Key &key) const noexcept
bool contains(const Key &key) const noexcept
Returns true if the hash contains an item with the key; otherwise returns false.
T value(const Key &key) const noexcept
const_iterator cend() const noexcept
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
Removes all items from the hash and frees up all memory used by it.
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 QList< QPair< QByteArray, QByteArray > > &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)
QUrl url() const override
void setHTTP2Allowed(bool b)
void setHTTP2Direct(bool b)
void setOperation(Operation operation)
Operation operation() const
QByteArray headerField(const QByteArray &name, const QByteArray &defaultValue=QByteArray()) const override
void setRedirectCount(int count)
int redirectCount() const
QNetworkRequest::RedirectPolicy redirectPolicy() const
void setUploadByteDevice(QNonContiguousByteDevice *bd)
QList< QPair< QByteArray, QByteArray > > incomingHeaders
void socketStartedConnecting()
QString incomingErrorDetail
QScopedPointer< QSslConfiguration > incomingSslConfiguration
std::shared_ptr< QAtomicInt > pendingDownloadData
QHttpNetworkRequest httpRequest
void downloadMetaData(const QList< QPair< QByteArray, QByteArray > > &, int, const QString &, bool, QSharedPointer< char >, qint64, qint64, bool, bool)
QHttp1Configuration http1Parameters
QByteArray synchronousDownloadData
qint64 connectionCacheExpiryTimeoutSeconds
QString incomingReasonPhrase
QNetworkProxy transparentProxy
qint64 incomingContentLength
qint64 downloadBufferMaximumSize
QHttp2Configuration http2Parameters
std::shared_ptr< QAtomicInt > pendingDownloadProgress
QNetworkReply::NetworkError incomingErrorCode
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 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
void removeAt(qsizetype i)
const_iterator constBegin() const noexcept
const_iterator constEnd() const noexcept
const_iterator ConstIterator
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.
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
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 replyDownloadMetaData(const QList< QPair< QByteArray, QByteArray > > &, int, const QString &, bool, QSharedPointer< char >, qint64, qint64, bool, bool)
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.
@ SourceIsFromCacheAttribute
@ EmitAllUploadProgressSignalsAttribute
@ OriginalContentLengthAttribute
@ HttpPipeliningWasUsedAttribute
@ CookieSaveControlAttribute
@ HttpStatusCodeAttribute
@ CacheSaveControlAttribute
@ CacheLoadControlAttribute
@ RedirectPolicyAttribute
@ DownloadBufferAttribute
@ DoNotBufferUploadDataAttribute
@ ConnectionCacheExpiryTimeoutSecondsAttribute
@ HttpPipeliningAllowedAttribute
@ RedirectionTargetAttribute
@ AuthenticationReuseAttribute
@ MaximumDownloadBufferSizeAttribute
@ HttpReasonPhraseAttribute
@ SynchronousRequestAttribute
@ ConnectionEncryptedAttribute
@ Http2CleartextAllowedAttribute
void setHeader(KnownHeaders header, const QVariant &value)
Sets the value of the known header header to be value, overriding any previously set headers.
Priority priority() const
QVariant attribute(Attribute code, const QVariant &defaultValue=QVariant()) const
Returns the attribute associated with the code code.
@ UserVerifiedRedirectPolicy
@ NoLessSafeRedirectPolicy
QVariant header(KnownHeaders header) const
Returns the value of the known network header header if it is present in this request.
int maximumRedirectsAllowed() const
QList< QByteArray > rawHeaderList() const
Returns a list of all raw headers that are set in this network request.
bool hasRawHeader(const QByteArray &headerName) const
Returns true if the raw header headerName is present in this network request.
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.
QString peerVerifyName() const
QByteArray rawHeader(const QByteArray &headerName) const
Returns the raw form of header headerName.
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)
void moveToThread(QThread *thread)
Changes the thread affinity for this object and its children.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void setParent(QObject *parent)
Makes the object a child of parent.
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
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
const QChar * constData() const
Returns a pointer to the data stored in the QString.
qsizetype size() const
Returns the number of characters in this string.
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
QString toLower() const &
static QString static QString qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
void start(Priority=InheritPriority)
bool wait(QDeadlineTimer deadline=QDeadlineTimer(QDeadlineTimer::Forever))
void setSingleShot(bool singleShot)
void setInterval(int msec)
void stop()
Stops the timer.
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...
qlonglong toLongLong(bool *ok=nullptr) const
Returns the variant as a long long int if the variant has userType() \l QMetaType::LongLong,...
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.
bool isNull() const
Returns true if this is a null variant, false otherwise.
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 >
QByteArray toByteArray() const
Returns the variant as a QByteArray if the variant has userType() \l QMetaType::QByteArray or \l QMet...
QSet< QString >::iterator it
Combined button and popup list for selecting options.
constexpr bool isAsciiDigit(char32_t c) noexcept
@ BlockingQueuedConnection
std::pair< T1, T2 > QPair
DBusConnection const char DBusError * error
static QString header(const QString &name)
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(const QByteArray &text, int from)
static QHash< QByteArray, QByteArray > parseHttpOptionHeader(const QByteArray &header)
#define Q_ARG(Type, data)
GLsizei const GLfloat * v
[13]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLbitfield GLuint64 timeout
[4]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
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)
qsizetype indexOf(const AT &t, qsizetype from=0) const noexcept
bool contains(const AT &t) const noexcept