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)
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);
576 return d_func()->m_reply->operation;
587 return d_func()->m_canCache;
598 d_func()->m_canCache = canCache;
632 if (
d->m_reply->outgoingDataBuffer)
633 d->uploadByteDevice =
635 else if (
d->m_reply->outgoingData) {
636 d->uploadByteDevice =
643 if (!isSynchronous()) {
646 Q_D(QNetworkAccessBackend);
647 if (!d->m_reply->isFinished)
648 d->m_reply->emitUploadProgress(a, b);
653 return d->wrappedUploadByteDevice;
664 return d_func()->wrappedUploadByteDevice;
672bool QNetworkAccessBackend::isSynchronous()
const
674 return d_func()->m_isSynchronous;
682void QNetworkAccessBackend::setSynchronous(
bool synchronous)
686 d_func()->m_isSynchronous = synchronous;
705 d_func()->m_reply->finished();
717 Q_ASSERT(!d_func()->m_reply->isFinished);
718 d_func()->m_reply->error(code, errorString);
721#ifndef QT_NO_NETWORKPROXY
738 d->m_manager->proxyAuthenticationRequired(
QUrl(),
proxy, isSynchronous(), authenticator,
739 &
d->m_reply->lastProxyAuthentication);
756 d->m_manager->authenticationRequired(authenticator,
d->m_reply->q_func(), isSynchronous(),
757 d->m_reply->url, &
d->m_reply->urlForLastAuthentication);
766 d_func()->m_reply->metaDataChanged();
775 d_func()->m_reply->redirectionRequested(
destination);
783 d_func()->m_reply =
reply;
800 return d_func()->m_manager->networkCache;
810 factoryData->append(
this);
818 if (factoryData.exists())
819 factoryData->removeAll(
this);
824#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.
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 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)
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]
GLsizei GLsizei GLfloat distance
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
const char className[16]
[1]
QUrl url("example.com")
[constructor-url-reference]
obj metaObject() -> className()
QNetworkAccessManager manager
QNetworkRequest request(url)