Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QNetworkAccessBackend Class Referenceabstract

QNetworkAccessBackend is the base class for implementing support for schemes used by QNetworkAccessManager. More...

#include <qnetworkaccessbackend_p.h>

+ Inheritance diagram for QNetworkAccessBackend:
+ Collaboration diagram for QNetworkAccessBackend:

Public Types

enum class  TargetType { Networked = 0x1 , Local = 0x2 }
 Use the values in this enum to specify what type of target the plugin supports. More...
 
enum class  SecurityFeature { None = 0x0 , TLS = 0x1 }
 Use the values in this enum to specify what type of security features the plugin may utilize. More...
 
enum class  IOFeature { None = 0x0 , ZeroCopy = 0x1 , NeedResetableUpload = 0x2 , SupportsSynchronousMode = 0x4 }
 Use the values in this enum to specify what type of IO features the plugin may utilize. More...
 

Public Slots

void readyRead ()
 Call this slot when you have more data available to notify the backend that we can attempt to read again.
 
- Public Slots inherited from QObject
void deleteLater ()
 \threadsafe
 

Public Member Functions

 QNetworkAccessBackend (TargetTypes targetTypes, SecurityFeatures securityFeatures, IOFeatures ioFeatures)
 Constructs the QNetworkAccessBackend.
 
 QNetworkAccessBackend (TargetTypes targetTypes)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
 QNetworkAccessBackend (TargetTypes targetTypes, SecurityFeatures securityFeatures)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
 QNetworkAccessBackend (TargetTypes targetTypes, IOFeatures ioFeatures)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
virtual ~QNetworkAccessBackend ()
 Destructs the QNetworkAccessBackend base class.
 
SecurityFeatures securityFeatures () const noexcept
 Returns the security related features that the backend claims to support.
 
TargetTypes targetTypes () const noexcept
 Returns the TargetTypes that the backend claims to target.
 
IOFeatures ioFeatures () const noexcept
 Returns the I/O features that the backend claims to support.
 
bool needsResetableUploadData () const noexcept
 
virtual bool start ()
 Prepares the backend and calls open().
 
virtual void open ()=0
 You must implement this in your derived class.
 
virtual void close ()=0
 You must implement this function in your derived class.
 
virtual void ignoreSslErrors ()
 This function will be called when the user wants to ignore all TLS handshake errors.
 
virtual void ignoreSslErrors (const QList< QSslError > &errors)
 This function will be called when the user wants to ignore specific errors.
 
virtual qint64 bytesAvailable () const =0
 You must implement this function in your derived class.
 
virtual QByteArrayView readPointer ()
 The data which the returned value views must stay valid until at least the next call to a non-const function.
 
virtual void advanceReadPointer (qint64 distance)
 This function is to notify your class that distance bytes have been read using readPointer and next time readPointer() is called those bytes should not be included.
 
virtual qint64 read (char *data, qint64 maxlen)
 Implement this function to support reading from the resource made available by your plugin.
 
virtual bool wantToRead ()
 This is called before we read if there are no bytes available and we are ready to read more.
 
QUrl url () const
 Returns the current URL of the reply.
 
void setUrl (const QUrl &url)
 Sets the URL of the reply.
 
QVariant header (QNetworkRequest::KnownHeaders header) const
 Returns the value of the header.
 
void setHeader (QNetworkRequest::KnownHeaders header, const QVariant &value)
 Sets the value of the header to value.
 
QByteArray rawHeader (const QByteArray &header) const
 Returns the value of the header.
 
void setRawHeader (const QByteArray &header, const QByteArray &value)
 Sets the value of the header to value.
 
QNetworkAccessManager::Operation operation () const
 Returns the operation which was requested when calling QNetworkAccessManager.
 
bool isCachingEnabled () const
 Returns true if setCachingEnabled was previously called with true.
 
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.
 
QIODevicecreateUploadByteDevice ()
 Creates a QIODevice for the data provided to upload, if any.
 
QIODeviceuploadByteDevice ()
 Returns the upload byte device associated with the current request.
 
QAbstractNetworkCachenetworkCache () const
 Returns the network cache object that was available when the request was started.
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 Constructs an object with parent object parent.
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects.
 
virtual bool event (QEvent *event)
 This virtual function receives events to an object and should return true if the event e was recognized and processed.
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 Filters events if this object has been installed as an event filter for the watched object.
 
QString objectName () const
 
Q_WEAK_OVERLOAD void setObjectName (const QString &name)
 Sets the object's name to name.
 
void setObjectName (QAnyStringView name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false.
 
bool isWindowType () const
 Returns true if the object is a window; otherwise returns false.
 
bool isQuickItemType () const
 Returns true if the object is a QQuickItem; otherwise returns false.
 
bool signalsBlocked () const noexcept
 Returns true if signals are blocked; otherwise returns false.
 
bool blockSignals (bool b) noexcept
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it).
 
QThreadthread () const
 Returns the thread in which the object lives.
 
bool moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL)
 Changes the thread affinity for this object and its children and returns true on success.
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds.
 
int startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 Kills the timer with timer identifier, id.
 
void killTimer (Qt::TimerId id)
 
template<typename T >
findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object.
 
template<typename T >
QList< T > findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects.
 
template<typename T >
findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T >
QList< T > findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
const QObjectListchildren () const
 Returns a list of child objects.
 
void setParent (QObject *parent)
 Makes the object a child of parent.
 
void installEventFilter (QObject *filterObj)
 Installs an event filter filterObj on this object.
 
void removeEventFilter (QObject *obj)
 Removes an event filter object obj from this object.
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 Dumps a tree of children to the debug output.
 
void dumpObjectInfo () const
 Dumps information about signal connections, etc.
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value.
 
bool setProperty (const char *name, QVariant &&value)
 
QVariant property (const char *name) const
 Returns the value of the object's name property.
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 Returns a pointer to the parent object.
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false.
 

Protected Slots

void finished ()
 Call this slot when there will be no more data available, regardless of whether the transfer was successful or unsuccessful.
 
void error (QNetworkReply::NetworkError code, const QString &errorString)
 Call this slot if an error occurs.
 
void proxyAuthenticationRequired (const QNetworkProxy &proxy, QAuthenticator *auth)
 Call this slot if, when connecting through a proxy, it requests authentication.
 
void authenticationRequired (QAuthenticator *auth)
 Call this slot if the remote resource requests authentication.
 
void metaDataChanged ()
 Call this slot, if appropriate, after having processed and updated metadata (e.g.
 
void redirectionRequested (const QUrl &destination)
 Call this slot if, when connecting to the resource, a redirect to destination was requested.
 

Friends

class QNetworkAccessManager
 
class QNetworkAccessManagerPrivate
 
class QNetworkReplyImplPrivate
 

Additional Inherited Members

- Signals inherited from QObject
void destroyed (QObject *=nullptr)
 This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked.
 
void objectNameChanged (const QString &objectName, QPrivateSignal)
 This signal is emitted after the object's name has been changed.
 
- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 \threadsafe
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 \threadsafe
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 Disconnect a connection.
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr.
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal.
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 This event handler can be reimplemented in a subclass to receive timer events for the object.
 
virtual void childEvent (QChildEvent *event)
 This event handler can be reimplemented in a subclass to receive child events.
 
virtual void customEvent (QEvent *event)
 This event handler can be reimplemented in a subclass to receive custom events.
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Properties inherited from QObject
QString objectName
 the name of this object
 

Detailed Description

QNetworkAccessBackend is the base class for implementing support for schemes used by QNetworkAccessManager.

Since
6.0

semi-private-notice

This class can be derived from to add support for further schemes in QNetworkAccessManager.

The design of QNetworkAccessBackend makes it possible to specialize behavior as needed for certain backends. This was done using the (currently) 3 enums TargetType, SecurityFeatures and IOFeatures. For example while only open() and close() are abstract functions you are also required to implement either read() or readPointer() and advanceReadPointer() depending on whether you enable IOFeature::ZeroCopy or not. Read more about it in the documentation for each of the enumerators.

See also
TargetType, SecurityFeatures, IOFeatures

Definition at line 38 of file qnetworkaccessbackend_p.h.

Member Enumeration Documentation

◆ IOFeature

Use the values in this enum to specify what type of IO features the plugin may utilize.

\value None No specific features are claimed to be supported. \value ZeroCopy The plugin will have raw data available in contiguous segments and can return a pointer to the data at request. Claiming to support this requires implementing readPointer() and advanceReadPointer(). \value NeedResetableUpload The plugin may encounter scenarios where data to upload that has already been consumed needs to be restored and re-sent. E.g. some data was consumed and sent before a redirect response was received, and after the redirect the previously-consumed data needs to be re-sent. \omitvalue SupportsSynchronousMode

Enumerator
None 
ZeroCopy 
NeedResetableUpload 
SupportsSynchronousMode 

Definition at line 58 of file qnetworkaccessbackend_p.h.

◆ SecurityFeature

Use the values in this enum to specify what type of security features the plugin may utilize.

Setting the right type(s) can be important, for example: setSslConfiguration() may not be called for any plugin that do not claim to support TLS.

\value None No specific features are claimed to be supported. \value TLS The plugin supports and expects to use TLS.

Enumerator
None 
TLS 

Definition at line 51 of file qnetworkaccessbackend_p.h.

◆ TargetType

Use the values in this enum to specify what type of target the plugin supports.

Setting the right type can be important, for example: proxyList() is only available for a Networked plugin.

\value Networked The plugin supports and expect to connect to networked resources. E.g. over TCP, UDP or similar. \value Local The plugin supports and expects to access local files, generate data and/or locally connected devices.

Enumerator
Networked 
Local 

Definition at line 44 of file qnetworkaccessbackend_p.h.

Constructor & Destructor Documentation

◆ QNetworkAccessBackend() [1/4]

QNetworkAccessBackend::QNetworkAccessBackend ( TargetTypes targetTypes,
SecurityFeatures securityFeatures,
IOFeatures ioFeatures )

Constructs the QNetworkAccessBackend.

You can opt in to specific backend behaviors with targetTypes, securityFeatures and ioFeatures. See their respective enums and values for more information.

See also
TargetType, SecurityFeature, IOFeature

Definition at line 222 of file qnetworkaccessbackend.cpp.

References d, ioFeatures(), securityFeatures(), and targetTypes().

+ Here is the call graph for this function:

◆ QNetworkAccessBackend() [2/4]

QNetworkAccessBackend::QNetworkAccessBackend ( TargetTypes targetTypes)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 236 of file qnetworkaccessbackend.cpp.

◆ QNetworkAccessBackend() [3/4]

QNetworkAccessBackend::QNetworkAccessBackend ( TargetTypes targetTypes,
SecurityFeatures securityFeatures )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 244 of file qnetworkaccessbackend.cpp.

◆ QNetworkAccessBackend() [4/4]

QNetworkAccessBackend::QNetworkAccessBackend ( TargetTypes targetTypes,
IOFeatures ioFeatures )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 253 of file qnetworkaccessbackend.cpp.

◆ ~QNetworkAccessBackend()

QNetworkAccessBackend::~QNetworkAccessBackend ( )
virtual

Destructs the QNetworkAccessBackend base class.

Definition at line 261 of file qnetworkaccessbackend.cpp.

Member Function Documentation

◆ advanceReadPointer()

void QNetworkAccessBackend::advanceReadPointer ( qint64 distance)
virtual

This function is to notify your class that distance bytes have been read using readPointer and next time readPointer() is called those bytes should not be included.

Note: This will only be called if IOFeature::ZeroCopy was specified in the call to the constructor.

See also
readPointer

Definition at line 446 of file qnetworkaccessbackend.cpp.

References className, ioFeatures(), metaObject(), Q_UNUSED, qWarning, and ZeroCopy.

+ Here is the call graph for this function:

◆ authenticationRequired

void QNetworkAccessBackend::authenticationRequired ( QAuthenticator * authenticator)
protectedslot

Call this slot if the remote resource requests authentication.

This may cause the QNetworkAccessManager::authenticationRequired() signal to be emitted if the credentials are not already stored in an internal cache. The credentials will be stored in authenticator. While authenticator is a pointer, passing nullptr is invalid.

Definition at line 752 of file qnetworkaccessbackend.cpp.

References d, and Q_ASSERT.

◆ bytesAvailable()

qint64 QNetworkAccessBackend::bytesAvailable ( ) const
pure virtual

You must implement this function in your derived class.

This function is called at various times. It may be called because the user called QNetworkReply::bytesAvailable(), and it may be called before an attempt to read is made.

While this function doesn't technically need to return an accurate number, it may result in reduced performance if it does not. This function must return zero if there are no bytes available.

Implemented in QNetworkAccessCacheBackend, and QNetworkAccessFileBackend.

Referenced by QNetworkReplyImplPrivate::handleNotifications(), and QNetworkReplyImplPrivate::readFromBackend().

+ Here is the caller graph for this function:

◆ close()

void QNetworkAccessBackend::close ( )
pure virtual

You must implement this function in your derived class.

This function gets called when the QNetworkReply is closed or aborted.

You should not emit an error or call finished() during this call since QtNetwork will set and emit the {QNetworkReply::OperationCanceledError} error by itself after control flow returns from this function.

Implemented in QNetworkAccessCacheBackend, and QNetworkAccessFileBackend.

◆ createUploadByteDevice()

QIODevice * QNetworkAccessBackend::createUploadByteDevice ( )

Creates a QIODevice for the data provided to upload, if any.

Emission of upload progress is handled internally as the device gets read from.

Returns a pointer to a device with data or nullptr if there was no data to upload.

Definition at line 628 of file qnetworkaccessbackend.cpp.

References QObject::connect(), QNonContiguousByteDeviceFactory::createShared(), d, QNonContiguousByteDevice::readProgress(), and QNonContiguousByteDeviceFactory::wrap().

Referenced by QNetworkAccessFileBackend::open().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ error

void QNetworkAccessBackend::error ( QNetworkReply::NetworkError code,
const QString & errorString )
protectedslot

Call this slot if an error occurs.

An error would be something you cannot recover from (e.g. the file requested is missing). The code and errorString is transferred to and stored in the QNetworkReply and the code is emitted through the QNetworkReply::errorOccurred() signal.

Definition at line 715 of file qnetworkaccessbackend.cpp.

References Q_ASSERT.

◆ finished

void QNetworkAccessBackend::finished ( )
protectedslot

Call this slot when there will be no more data available, regardless of whether the transfer was successful or unsuccessful.

For unsuccessful transfers make sure to call error() first!

Definition at line 703 of file qnetworkaccessbackend.cpp.

Referenced by QNetworkAccessCacheBackend::open(), QNetworkAccessFileBackend::open(), QNetworkAccessFileBackend::read(), and QNetworkAccessFileBackend::uploadReadyReadSlot().

+ Here is the caller graph for this function:

◆ header()

QVariant QNetworkAccessBackend::header ( QNetworkRequest::KnownHeaders header) const

Returns the value of the header.

If no such header was known it returns a default-constructed QVariant.

See also
setHeader, rawHeader, setRawHeader

Definition at line 526 of file qnetworkaccessbackend.cpp.

References header(), and QVariant::value().

Referenced by header(), rawHeader(), setHeader(), and setRawHeader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ignoreSslErrors() [1/2]

void QNetworkAccessBackend::ignoreSslErrors ( )
virtual

This function will be called when the user wants to ignore all TLS handshake errors.

Derive this function if TLS is supported.

See also
SecurityFeature, securityFeatures

Definition at line 394 of file qnetworkaccessbackend.cpp.

References className, metaObject(), qWarning, securityFeatures(), and TLS.

+ Here is the call graph for this function:

◆ ignoreSslErrors() [2/2]

void QNetworkAccessBackend::ignoreSslErrors ( const QList< QSslError > & errors)
virtual

This function will be called when the user wants to ignore specific errors.

Derive this function if TLS is supported.

See also
SecurityFeature, securityFeatures

Definition at line 408 of file qnetworkaccessbackend.cpp.

References className, metaObject(), Q_UNUSED, qWarning, securityFeatures(), and TLS.

+ Here is the call graph for this function:

◆ ioFeatures()

QNetworkAccessBackend::IOFeatures QNetworkAccessBackend::ioFeatures ( ) const
noexcept

Returns the I/O features that the backend claims to support.

See also
IOFeature

Definition at line 289 of file qnetworkaccessbackend.cpp.

Referenced by QNetworkAccessBackend(), advanceReadPointer(), read(), QNetworkReplyImplPrivate::readFromBackend(), and readPointer().

+ Here is the caller graph for this function:

◆ isCachingEnabled()

bool QNetworkAccessBackend::isCachingEnabled ( ) const

Returns true if setCachingEnabled was previously called with true.

Returns false otherwise, which is the default value.

See also
setCachingEnabled

Definition at line 585 of file qnetworkaccessbackend.cpp.

◆ metaDataChanged

void QNetworkAccessBackend::metaDataChanged ( )
protectedslot

Call this slot, if appropriate, after having processed and updated metadata (e.g.

headers).

Definition at line 764 of file qnetworkaccessbackend.cpp.

◆ needsResetableUploadData()

bool QNetworkAccessBackend::needsResetableUploadData ( ) const
inlinenoexcept

Definition at line 78 of file qnetworkaccessbackend_p.h.

Referenced by QNetworkReplyImplPrivate::setup().

+ Here is the caller graph for this function:

◆ networkCache()

QAbstractNetworkCache * QNetworkAccessBackend::networkCache ( ) const

Returns the network cache object that was available when the request was started.

Returns nullptr if none was available.

Definition at line 798 of file qnetworkaccessbackend.cpp.

Referenced by QNetworkReplyImplPrivate::networkCache().

+ Here is the caller graph for this function:

◆ open()

void QNetworkAccessBackend::open ( )
pure virtual

You must implement this in your derived class.

During this call you must open the connection and begin the request (see: request()).

As the connection progresses you must call the various public and protected slots on QNetworkAccessBackend. As an example, when you have received some data you must call readyRead(). And when all the data has been received you must call finished(). This could, for example, be done by binding signals inside your own implementation to the slots, or by calling them directly.

See also
close()

Implemented in QNetworkAccessCacheBackend, and QNetworkAccessFileBackend.

Referenced by start().

+ Here is the caller graph for this function:

◆ operation()

QNetworkAccessManager::Operation QNetworkAccessBackend::operation ( ) const

Returns the operation which was requested when calling QNetworkAccessManager.

Definition at line 574 of file qnetworkaccessbackend.cpp.

Referenced by QNetworkAccessFileBackend::bytesAvailable(), QNetworkAccessFileBackend::close(), QNetworkAccessCacheBackend::open(), QNetworkAccessFileBackend::open(), and QNetworkAccessFileBackend::read().

+ Here is the caller graph for this function:

◆ proxyAuthenticationRequired

void QNetworkAccessBackend::proxyAuthenticationRequired ( const QNetworkProxy & proxy,
QAuthenticator * authenticator )
protectedslot

Call this slot if, when connecting through a proxy, it requests authentication.

This may cause the QNetworkAccessManager::proxyAuthenticationRequired() signal to be emitted if the credentials are not already stored in an internal cache. To be able to make the lookup in the cache and potentially the subsequent request the proxy needs to be known. The credentials will be stored in authenticator. While authenticator is a pointer, passing nullptr is invalid.

Definition at line 733 of file qnetworkaccessbackend.cpp.

References d, proxy, and Q_ASSERT.

◆ rawHeader()

QByteArray QNetworkAccessBackend::rawHeader ( const QByteArray & header) const

Returns the value of the header.

If no such header was known it returns a default-constructed QVariant.

See also
setHeader, rawHeader, setRawHeader

Definition at line 551 of file qnetworkaccessbackend.cpp.

References header().

+ Here is the call graph for this function:

◆ read()

qint64 QNetworkAccessBackend::read ( char * data,
qint64 maxlen )
virtual

Implement this function to support reading from the resource made available by your plugin.

Store data in data, up to a maximum of maxlen bytes. Then return the total amount of bytes that was copied.

See also
readPointer, wantToRead

Reimplemented in QNetworkAccessCacheBackend, and QNetworkAccessFileBackend.

Definition at line 463 of file qnetworkaccessbackend.cpp.

References className, ioFeatures(), metaObject(), Q_UNUSED, qWarning, and ZeroCopy.

Referenced by QNetworkReplyImplPrivate::readFromBackend().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readPointer()

QByteArrayView QNetworkAccessBackend::readPointer ( )
virtual

The data which the returned value views must stay valid until at least the next call to a non-const function.

advanceReadPointer will be called if any of the data was used.

Note: This will only be called if IOFeature::ZeroCopy was specified in the call to the constructor.

See also
advanceReadPointer, read

Definition at line 427 of file qnetworkaccessbackend.cpp.

References className, ioFeatures(), metaObject(), qWarning, and ZeroCopy.

+ Here is the call graph for this function:

◆ readyRead

void QNetworkAccessBackend::readyRead ( )
slot

Call this slot when you have more data available to notify the backend that we can attempt to read again.

Definition at line 693 of file qnetworkaccessbackend.cpp.

References QNetworkReplyImplPrivate::NotifyDownstreamReadyWrite.

Referenced by QNetworkAccessFileBackend::open().

+ Here is the caller graph for this function:

◆ redirectionRequested

void QNetworkAccessBackend::redirectionRequested ( const QUrl & destination)
protectedslot

Call this slot if, when connecting to the resource, a redirect to destination was requested.

Definition at line 773 of file qnetworkaccessbackend.cpp.

References destination.

◆ securityFeatures()

QNetworkAccessBackend::SecurityFeatures QNetworkAccessBackend::securityFeatures ( ) const
noexcept

Returns the security related features that the backend claims to support.

See also
SecurityFeature

Definition at line 269 of file qnetworkaccessbackend.cpp.

Referenced by QNetworkAccessBackend(), ignoreSslErrors(), and ignoreSslErrors().

+ Here is the caller graph for this function:

◆ setAttribute()

void QNetworkAccessBackend::setAttribute ( QNetworkRequest::Attribute attribute,
const QVariant & value )

Set attribute to value.

If {value.isValid()} returns false then the attribute is unset.

This value is accessible on the QNetworkReply instance which was returned when calling one of the appropriate functions on QNetworkAccessManager.

Definition at line 609 of file qnetworkaccessbackend.cpp.

References d.

Referenced by QNetworkAccessCacheBackend::open().

+ Here is the caller graph for this function:

◆ setCachingEnabled()

void QNetworkAccessBackend::setCachingEnabled ( bool canCache)

If canCache is true then this hints to us that we can cache the reply that is created.

See also
isCachingEnabled

Definition at line 596 of file qnetworkaccessbackend.cpp.

◆ setHeader()

void QNetworkAccessBackend::setHeader ( QNetworkRequest::KnownHeaders header,
const QVariant & value )

Sets the value of the header to value.

This can be queried on the QNetworkReply instance which was returned when calling one of the appropriate functions on QNetworkAccessManager.

See also
header, rawHeader, setRawHeader

Definition at line 539 of file qnetworkaccessbackend.cpp.

References header().

+ Here is the call graph for this function:

◆ setRawHeader()

void QNetworkAccessBackend::setRawHeader ( const QByteArray & header,
const QByteArray & value )

Sets the value of the header to value.

This value is accessible on the QNetworkReply instance which was returned when calling one of the appropriate functions on QNetworkAccessManager.

See also
header, rawHeader, setRawHeader

Definition at line 565 of file qnetworkaccessbackend.cpp.

References header().

+ Here is the call graph for this function:

◆ setUrl()

void QNetworkAccessBackend::setUrl ( const QUrl & url)

Sets the URL of the reply.

This could e.g. be needed if a redirect or similar was performed.

Definition at line 514 of file qnetworkaccessbackend.cpp.

References url().

Referenced by QNetworkAccessFileBackend::open().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ start()

bool QNetworkAccessBackend::start ( )
virtual

Prepares the backend and calls open().

E.g. for TargetType::Networked it will prepare proxyList().

See also
TargetType, targetTypes

Reimplemented in QNetworkAccessCacheBackend.

Definition at line 300 of file qnetworkaccessbackend.cpp.

References d, Networked, open(), targetTypes(), and url().

Referenced by QNetworkReplyImplPrivate::_q_startOperation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ targetTypes()

QNetworkAccessBackend::TargetTypes QNetworkAccessBackend::targetTypes ( ) const
noexcept

Returns the TargetTypes that the backend claims to target.

See also
TargetType

Definition at line 279 of file qnetworkaccessbackend.cpp.

Referenced by QNetworkAccessBackend(), and start().

+ Here is the caller graph for this function:

◆ uploadByteDevice()

QIODevice * QNetworkAccessBackend::uploadByteDevice ( )

Returns the upload byte device associated with the current request.

This does not create the request but simply returns the pointer stored in this base class so it doesn't need to be stored in the subclass too.

Definition at line 662 of file qnetworkaccessbackend.cpp.

Referenced by QNetworkAccessFileBackend::open(), and QNetworkAccessFileBackend::uploadReadyReadSlot().

+ Here is the caller graph for this function:

◆ url()

QUrl QNetworkAccessBackend::url ( ) const

Returns the current URL of the reply.

Definition at line 505 of file qnetworkaccessbackend.cpp.

References QUrl::url().

Referenced by QNetworkAccessCacheBackend::open(), QNetworkAccessFileBackend::open(), QNetworkAccessFileBackend::read(), setUrl(), start(), and QNetworkAccessFileBackend::uploadReadyReadSlot().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wantToRead()

bool QNetworkAccessBackend::wantToRead ( )
virtual

This is called before we read if there are no bytes available and we are ready to read more.

Return true if new data was made available.

See also
read, readPointer

Definition at line 481 of file qnetworkaccessbackend.cpp.

Referenced by QNetworkReplyImplPrivate::handleNotifications().

+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ QNetworkAccessManager

friend class QNetworkAccessManager
friend

Definition at line 137 of file qnetworkaccessbackend_p.h.

◆ QNetworkAccessManagerPrivate

friend class QNetworkAccessManagerPrivate
friend

Definition at line 138 of file qnetworkaccessbackend_p.h.

◆ QNetworkReplyImplPrivate

friend class QNetworkReplyImplPrivate
friend

Definition at line 139 of file qnetworkaccessbackend_p.h.


The documentation for this class was generated from the following files: