36bool QNetworkAccessCacheBackend::sendCacheContents()
53 for (
const auto &
header : rawHeaders) {
54 if (
header.first.toLower() ==
"cache-control") {
56 if (cacheControlValue.
contains(
"must-revalidate")
57 || cacheControlValue.
contains(
"no-cache")) {
66 if (redirectionTarget.
isValid()) {
82#if defined(QNETWORKACCESSCACHEBACKEND_DEBUG)
83 qDebug() <<
"Successfully sent cache:" <<
url();
The QAbstractNetworkCache class provides the interface for cache implementations.
virtual QIODevice * data(const QUrl &url)=0
Returns the data associated with url.
virtual QNetworkCacheMetaData metaData(const QUrl &url)=0
Returns the meta data for the url url.
bool contains(char c) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
T value(const Key &key) const noexcept
virtual qint64 bytesAvailable() const
Returns the number of bytes that are available for reading.
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...
QNetworkAccessManager::Operation operation() const
Returns the operation which was requested when calling QNetworkAccessManager.
void readyRead()
Call this slot when you have more data available to notify the backend that we can attempt to read ag...
void finished()
Call this slot when there will be no more data available, regardless of whether the transfer was succ...
void redirectionRequested(const QUrl &destination)
Call this slot if, when connecting to the resource, a redirect to destination was requested.
void setRawHeader(const QByteArray &header, const QByteArray &value)
Sets the value of the header to value.
QAbstractNetworkCache * networkCache() const
Returns the network cache object that was available when the request was started.
QUrl url() const
Returns the current URL of the reply.
TargetType
Use the values in this enum to specify what type of target the plugin supports.
void metaDataChanged()
Call this slot, if appropriate, after having processed and updated metadata (e.g.
QVariant header(QNetworkRequest::KnownHeaders header) const
Returns the value of the header.
void error(QNetworkReply::NetworkError code, const QString &errorString)
Call this slot if an error occurs.
void setCachingEnabled(bool canCache)
If canCache is true then this hints to us that we can cache the reply that is created.
void setAttribute(QNetworkRequest::Attribute attribute, const QVariant &value)
Set attribute to value.
bool start() override
Prepares the backend and calls open().
void close() override
You must implement this function in your derived class.
QNetworkAccessCacheBackend()
void open() override
You must implement this in your derived class.
~QNetworkAccessCacheBackend()
qint64 bytesAvailable() const override
You must implement this function in your derived class.
qint64 read(char *data, qint64 maxlen) override
Implement this function to support reading from the resource made available by your plugin.
@ SourceIsFromCacheAttribute
@ HttpStatusCodeAttribute
@ RedirectionTargetAttribute
@ HttpReasonPhraseAttribute
void setParent(QObject *parent)
Makes the object a child of parent.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
bool isValid() const
Returns true if the storage type of this variant is not QMetaType::UnknownType; otherwise returns fal...
QUrl toUrl() const
Returns the variant as a QUrl if the variant has userType() \l QMetaType::QUrl; otherwise returns an ...
Combined button and popup list for selecting options.
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
char * toString(const MyType &t)
[31]