10#include "QtCore/qmutex.h"
11#include "QtCore/qstringlist.h"
17#include "private/qnoncontiguousbytedevice_p.h"
63 end = factoryData()->constEnd();
67 backend->setManagerPrivate(
this);
84 schemes += (*it)->supportedSchemes();
223 SecurityFeatures securityFeatures,
224 IOFeatures ioFeatures)
245 SecurityFeatures securityFeatures)
271 return d_func()->m_securityFeatures;
281 return d_func()->m_targetTypes;
291 return d_func()->m_ioFeatures;
303#ifndef QT_NO_NETWORKPROXY
362void QNetworkAccessBackend::setSslConfiguration(
const QSslConfiguration &configuration)
366 qWarning(
"Backend (%s) claiming to use TLS hasn't overridden setSslConfiguration.",
380 qWarning(
"Backend (%s) claiming to use TLS hasn't overridden sslConfiguration.",
397 qWarning(
"Backend (%s) claiming to use TLS hasn't overridden ignoreSslErrors.",
412 qWarning(
"Backend (%s) claiming to use TLS hasn't overridden ignoreSslErrors.",
430 qWarning(
"Backend (%s) claiming to support ZeroCopy hasn't overridden readPointer.",
450 qWarning(
"Backend (%s) claiming to support ZeroCopy hasn't overridden advanceReadPointer.",
468 qWarning(
"Backend (%s) is not ZeroCopy and has not implemented read(...)!",
487#if QT_CONFIG(networkproxy)
495QList<QNetworkProxy> QNetworkAccessBackend::proxyList()
const
498 return d_func()->m_reply->proxyList;
507 return d_func()->m_reply->
url;
516 d_func()->m_reply->url =
url;
528 return d_func()->m_reply->cookedHeaders.
value(
header);
553 return d_func()->m_reply->q_func()->rawHeader(
header);
579 return d_func()->m_reply->headers();
595 d_func()->m_reply->setHeaders(std::move(newHeaders));
604 d_func()->m_reply->setHeaders(newHeaders);
613 return d_func()->m_reply->operation;
624 return d_func()->m_canCache;
635 d_func()->m_canCache = canCache;
669 if (
d->m_reply->outgoingDataBuffer)
670 d->uploadByteDevice =
672 else if (
d->m_reply->outgoingData) {
673 d->uploadByteDevice =
680 if (!isSynchronous()) {
683 Q_D(QNetworkAccessBackend);
684 if (!d->m_reply->isFinished)
685 d->m_reply->emitUploadProgress(a, b);
690 return d->wrappedUploadByteDevice;
701 return d_func()->wrappedUploadByteDevice;
709bool QNetworkAccessBackend::isSynchronous()
const
711 return d_func()->m_isSynchronous;
719void QNetworkAccessBackend::setSynchronous(
bool synchronous)
723 d_func()->m_isSynchronous = synchronous;
742 d_func()->m_reply->finished();
754 Q_ASSERT(!d_func()->m_reply->isFinished);
755 d_func()->m_reply->error(code, errorString);
758#ifndef QT_NO_NETWORKPROXY
775 d->m_manager->proxyAuthenticationRequired(
QUrl(),
proxy, isSynchronous(), authenticator,
776 &
d->m_reply->lastProxyAuthentication);
793 d->m_manager->authenticationRequired(authenticator,
d->m_reply->q_func(), isSynchronous(),
794 d->m_reply->url, &
d->m_reply->urlForLastAuthentication);
803 d_func()->m_reply->metaDataChanged();
812 d_func()->m_reply->redirectionRequested(
destination);
820 d_func()->m_reply =
reply;
837 return d_func()->m_manager->networkCache;
847 factoryData->append(
this);
855 if (factoryData.exists())
856 factoryData->removeAll(
this);
861#include "moc_qnetworkaccessbackend_p.cpp"
The QAbstractNetworkCache class provides the interface for cache implementations.
The QAuthenticator class provides an authentication object.
\inmodule QtCore \reentrant
const_iterator ConstIterator
static QBasicAtomicInt valid
~QNetworkAccessBackendFactoryData()
QNetworkAccessBackendFactoryData()
QNetworkAccessBackendFactory()
Constructs QNetworkAccessBackendFactory.
virtual ~QNetworkAccessBackendFactory()
Destructs QNetworkAccessBackendFactory.
std::shared_ptr< QNonContiguousByteDevice > uploadByteDevice
QNetworkReplyImplPrivate * m_reply
QNetworkAccessBackend::SecurityFeatures m_securityFeatures
QNetworkAccessManagerPrivate * m_manager
QNetworkAccessBackend::IOFeatures m_ioFeatures
QIODevice * wrappedUploadByteDevice
QNetworkAccessBackend::TargetTypes m_targetTypes
QNetworkAccessBackend is the base class for implementing support for schemes used by QNetworkAccessMa...
virtual ~QNetworkAccessBackend()
Destructs the QNetworkAccessBackend base class.
QIODevice * uploadByteDevice()
Returns the upload byte device associated with the current request.
IOFeature
Use the values in this enum to specify what type of IO features the plugin may utilize.
@ SupportsSynchronousMode
bool isCachingEnabled() const
Returns true if setCachingEnabled was previously called with true.
QHttpHeaders headers() const
void authenticationRequired(QAuthenticator *auth)
Call this slot if the remote resource requests authentication.
QNetworkAccessManager::Operation operation() const
Returns the operation which was requested when calling QNetworkAccessManager.
virtual qint64 read(char *data, qint64 maxlen)
Implement this function to support reading from the resource made available by your plugin.
void readyRead()
Call this slot when you have more data available to notify the backend that we can attempt to read ag...
virtual QByteArrayView readPointer()
The data which the returned value views must stay valid until at least the next call to a non-const f...
virtual bool start()
Prepares the backend and calls open().
QByteArray rawHeader(const QByteArray &header) const
Returns the value of the header.
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 setHeaders(const QHttpHeaders &newHeaders)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setRawHeader(const QByteArray &header, const QByteArray &value)
Sets the value of the header to value.
QNetworkAccessBackend(TargetTypes targetTypes, SecurityFeatures securityFeatures, IOFeatures ioFeatures)
Constructs the QNetworkAccessBackend.
virtual bool wantToRead()
This is called before we read if there are no bytes available and we are ready to read more.
QAbstractNetworkCache * networkCache() const
Returns the network cache object that was available when the request was started.
void setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value)
Sets the value of the header to value.
IOFeatures ioFeatures() const noexcept
Returns the I/O features that the backend claims to support.
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth)
Call this slot if, when connecting through a proxy, it requests authentication.
virtual void open()=0
You must implement this in your derived class.
QUrl url() const
Returns the current URL of the reply.
QIODevice * createUploadByteDevice()
Creates a QIODevice for the data provided to upload, if any.
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.
TargetTypes targetTypes() const noexcept
Returns the TargetTypes that the backend claims to target.
virtual void ignoreSslErrors()
This function will be called when the user wants to ignore all TLS handshake errors.
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 setUrl(const QUrl &url)
Sets the URL of the reply.
virtual void advanceReadPointer(qint64 distance)
This function is to notify your class that distance bytes have been read using readPointer and next t...
SecurityFeature
Use the values in this enum to specify what type of security features the plugin may utilize.
void setAttribute(QNetworkRequest::Attribute attribute, const QVariant &value)
Set attribute to value.
SecurityFeatures securityFeatures() const noexcept
Returns the security related features that the backend claims to support.
QStringList backendSupportedSchemes() const
QNetworkAccessBackend * findBackend(QNetworkAccessManager::Operation op, const QNetworkRequest &request)
Operation
Indicates the operation this reply is processing.
The QNetworkProxyQuery class is used to query the proxy settings for a socket.
The QNetworkProxy class provides a network layer proxy.
@ NotifyDownstreamReadyWrite
NetworkError
Indicates all possible error conditions found during the processing of the request.
The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.
KnownHeaders
List of known header types that QNetworkRequest parses.
static std::shared_ptr< QNonContiguousByteDevice > createShared(QIODevice *device)
Create a QNonContiguousByteDevice out of a QIODevice, return it in a std::shared_ptr.
static QIODevice * wrap(QNonContiguousByteDevice *byteDevice)
Wrap the byteDevice (possibly again) into a QIODevice.
void readProgress(qint64 current, qint64 total)
Emitted when data has been "read" by advancing the read pointer.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
const_iterator constBegin() const noexcept
The QSslConfiguration class holds the configuration and state of an SSL connection.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString url(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
Returns a string representation of the URL.
QSet< QString >::iterator it
Combined button and popup list for selecting options.
#define Q_BASIC_ATOMIC_INITIALIZER(a)
QList< QString > QStringList
Constructs a string list that contains the given string, str.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char * destination
static QString header(const QString &name)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
EGLOutputLayerEXT EGLint attribute
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
[7]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLsizei GLsizei GLfloat distance
const char className[16]
[1]
QUrl url("example.com")
[constructor-url-reference]
obj metaObject() -> className()
QNetworkAccessManager manager
QNetworkRequest request(url)