Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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.
 
QHttpHeaders headers () const
 
void setHeaders (const QHttpHeaders &newHeaders)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void setHeaders (QHttpHeaders &&newHeaders)
 
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 36 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 56 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 49 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 42 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.

◆ 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.

◆ 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 789 of file qnetworkaccessbackend.cpp.

◆ bytesAvailable()

virtual 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.

◆ close()

virtual 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 665 of file qnetworkaccessbackend.cpp.

◆ 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 752 of file qnetworkaccessbackend.cpp.

◆ 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 740 of file qnetworkaccessbackend.cpp.

◆ 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.

◆ headers()

QHttpHeaders QNetworkAccessBackend::headers ( ) const
Since
6.8

Returns headers that are set in this QNetworkAccessBackend instance.

See also
setHeaders()

Definition at line 577 of file qnetworkaccessbackend.cpp.

◆ 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.

◆ 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.

◆ 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.

◆ 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 622 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 801 of file qnetworkaccessbackend.cpp.

◆ needsResetableUploadData()

bool QNetworkAccessBackend::needsResetableUploadData ( ) const
inlinenoexcept

Definition at line 76 of file qnetworkaccessbackend_p.h.

◆ 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 835 of file qnetworkaccessbackend.cpp.

◆ open()

virtual 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.

◆ operation()

QNetworkAccessManager::Operation QNetworkAccessBackend::operation ( ) const

Returns the operation which was requested when calling QNetworkAccessManager.

Definition at line 611 of file qnetworkaccessbackend.cpp.

◆ 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 770 of file qnetworkaccessbackend.cpp.

◆ 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.

◆ 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.

◆ 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.

◆ 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 730 of file qnetworkaccessbackend.cpp.

◆ 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 810 of file qnetworkaccessbackend.cpp.

◆ 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.

◆ 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 646 of file qnetworkaccessbackend.cpp.

◆ 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 633 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.

◆ setHeaders() [1/2]

void QNetworkAccessBackend::setHeaders ( const QHttpHeaders & newHeaders)

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

Since
6.8

Definition at line 602 of file qnetworkaccessbackend.cpp.

◆ setHeaders() [2/2]

void QNetworkAccessBackend::setHeaders ( QHttpHeaders && newHeaders)
Since
6.8

Sets newHeaders as headers, overriding any previously set headers.

These headers are accessible on the QNetworkReply instance which was returned when calling one of the appropriate functions on QNetworkAccessManager.

See also
headers()

Definition at line 593 of file qnetworkaccessbackend.cpp.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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 699 of file qnetworkaccessbackend.cpp.

◆ url()

QUrl QNetworkAccessBackend::url ( ) const

Returns the current URL of the reply.

Definition at line 505 of file qnetworkaccessbackend.cpp.

◆ 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.

Friends And Related Symbol Documentation

◆ QNetworkAccessManager

friend class QNetworkAccessManager
friend

Definition at line 138 of file qnetworkaccessbackend_p.h.

◆ QNetworkAccessManagerPrivate

friend class QNetworkAccessManagerPrivate
friend

Definition at line 139 of file qnetworkaccessbackend_p.h.

◆ QNetworkReplyImplPrivate

friend class QNetworkReplyImplPrivate
friend

Definition at line 140 of file qnetworkaccessbackend_p.h.


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