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
QNetworkAccessManager Class Reference

The QNetworkAccessManager class allows the application to send network requests and receive replies. More...

#include <qnetworkaccessmanager.h>

+ Inheritance diagram for QNetworkAccessManager:
+ Collaboration diagram for QNetworkAccessManager:

Public Types

enum  Operation {
  HeadOperation = 1 , GetOperation , PutOperation , PostOperation ,
  DeleteOperation , CustomOperation , UnknownOperation = 0
}
 Indicates the operation this reply is processing. More...
 

Signals

void proxyAuthenticationRequired (const QNetworkProxy &proxy, QAuthenticator *authenticator)
 This signal is emitted whenever a proxy requests authentication and QNetworkAccessManager cannot find a valid, cached credential.
 
void authenticationRequired (QNetworkReply *reply, QAuthenticator *authenticator)
 This signal is emitted whenever a final server requests authentication before it delivers the requested contents.
 
void finished (QNetworkReply *reply)
 This signal is emitted whenever a pending network reply is finished.
 
void encrypted (QNetworkReply *reply)
 
void sslErrors (QNetworkReply *reply, const QList< QSslError > &errors)
 This signal is emitted if the SSL/TLS session encountered errors during the set up, including certificate verification errors.
 
void preSharedKeyAuthenticationRequired (QNetworkReply *reply, QSslPreSharedKeyAuthenticator *authenticator)
 
- 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.
 

Public Member Functions

 QNetworkAccessManager (QObject *parent=nullptr)
 Constructs a QNetworkAccessManager object that is the center of the Network Access API and sets parent as the parent object.
 
 ~QNetworkAccessManager ()
 Destroys the QNetworkAccessManager object and frees up any resources.
 
virtual QStringList supportedSchemes () const
 
void clearAccessCache ()
 
void clearConnectionCache ()
 
QNetworkProxy proxy () const
 Returns the QNetworkProxy that the requests sent using this QNetworkAccessManager object will use.
 
void setProxy (const QNetworkProxy &proxy)
 Sets the proxy to be used in future requests to be proxy.
 
QNetworkProxyFactoryproxyFactory () const
 
void setProxyFactory (QNetworkProxyFactory *factory)
 
QAbstractNetworkCachecache () const
 
void setCache (QAbstractNetworkCache *cache)
 
QNetworkCookieJarcookieJar () const
 Returns the QNetworkCookieJar that is used to store cookies obtained from the network as well as cookies that are about to be sent.
 
void setCookieJar (QNetworkCookieJar *cookieJar)
 Sets the manager's cookie jar to be the cookieJar specified.
 
void setStrictTransportSecurityEnabled (bool enabled)
 
bool isStrictTransportSecurityEnabled () const
 
void enableStrictTransportSecurityStore (bool enabled, const QString &storeDir=QString())
 
bool isStrictTransportSecurityStoreEnabled () const
 
void addStrictTransportSecurityHosts (const QList< QHstsPolicy > &knownHosts)
 
QList< QHstsPolicystrictTransportSecurityHosts () const
 
QNetworkReplyhead (const QNetworkRequest &request)
 Posts a request to obtain the network headers for request and returns a new QNetworkReply object which will contain such headers.
 
QNetworkReplyget (const QNetworkRequest &request)
 Posts a request to obtain the contents of the target request and returns a new QNetworkReply object opened for reading which emits the \l{QIODevice::readyRead()}{readyRead()} signal whenever new data arrives.
 
QNetworkReplyget (const QNetworkRequest &request, QIODevice *data)
 
QNetworkReplyget (const QNetworkRequest &request, const QByteArray &data)
 
QNetworkReplypost (const QNetworkRequest &request, QIODevice *data)
 Sends an HTTP POST request to the destination specified by request and returns a new QNetworkReply object opened for reading that will contain the reply sent by the server.
 
QNetworkReplypost (const QNetworkRequest &request, const QByteArray &data)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sends the contents of the data byte array to the destination specified by request.
 
QNetworkReplypost (const QNetworkRequest &request, std::nullptr_t nptr)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QNetworkReplyput (const QNetworkRequest &request, QIODevice *data)
 Uploads the contents of data to the destination request and returns a new QNetworkReply object that will be open for reply.
 
QNetworkReplyput (const QNetworkRequest &request, const QByteArray &data)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sends the contents of the data byte array to the destination specified by request.
 
QNetworkReplyput (const QNetworkRequest &request, std::nullptr_t nptr)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QNetworkReplydeleteResource (const QNetworkRequest &request)
 
QNetworkReplysendCustomRequest (const QNetworkRequest &request, const QByteArray &verb, QIODevice *data=nullptr)
 
QNetworkReplysendCustomRequest (const QNetworkRequest &request, const QByteArray &verb, const QByteArray &data)
 
void connectToHostEncrypted (const QString &hostName, quint16 port=443, const QSslConfiguration &sslConfiguration=QSslConfiguration::defaultConfiguration())
 
void connectToHostEncrypted (const QString &hostName, quint16 port, const QSslConfiguration &sslConfiguration, const QString &peerName)
 
void connectToHost (const QString &hostName, quint16 port=80)
 
void setRedirectPolicy (QNetworkRequest::RedirectPolicy policy)
 
QNetworkRequest::RedirectPolicy redirectPolicy () const
 
bool autoDeleteReplies () const
 
void setAutoDeleteReplies (bool autoDelete)
 
int transferTimeout () const
 
void setTransferTimeout (int timeout)
 
std::chrono::milliseconds transferTimeoutAsDuration () const
 
void setTransferTimeout (std::chrono::milliseconds duration=QNetworkRequest::DefaultTransferTimeout)
 
- 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

QStringList supportedSchemesImplementation () const
 

Protected Member Functions

virtual QNetworkReplycreateRequest (Operation op, const QNetworkRequest &request, QIODevice *outgoingData=nullptr)
 Returns a new QNetworkReply object to handle the operation op and request originalReq.
 
- 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)
 

Friends

class QNetworkReplyImplPrivate
 
class QNetworkReplyHttpImpl
 
class QNetworkReplyHttpImplPrivate
 
class QNetworkReplyFileImpl
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 \threadsafe
 
- 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 Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Properties inherited from QObject
QString objectName
 the name of this object
 

Detailed Description

The QNetworkAccessManager class allows the application to send network requests and receive replies.

Since
4.4

\inmodule QtNetwork \reentrant

The Network Access API is constructed around one QNetworkAccessManager object, which holds the common configuration and settings for the requests it sends. It contains the proxy and cache configuration, as well as the signals related to such issues, and reply signals that can be used to monitor the progress of a network operation. One QNetworkAccessManager instance should be enough for the whole Qt application. Since QNetworkAccessManager is based on QObject, it can only be used from the thread it belongs to.

Once a QNetworkAccessManager object has been created, the application can use it to send requests over the network. A group of standard functions are supplied that take a request and optional data, and each return a QNetworkReply object. The returned object is used to obtain any data returned in response to the corresponding request.

A simple download off the network could be accomplished with:

this, &MyClass::replyFinished);
manager->get(QNetworkRequest(QUrl("http://qt-project.org")));

QNetworkAccessManager has an asynchronous API. When the \tt replyFinished slot above is called, the parameter it takes is the QNetworkReply object containing the downloaded data as well as meta-data (headers, etc.).

Note
After the request has finished, it is the responsibility of the user to delete the QNetworkReply object at an appropriate time. Do not directly delete it inside the slot connected to finished(). You can use the deleteLater() function.
QNetworkAccessManager queues the requests it receives. The number of requests executed in parallel is dependent on the protocol. Currently, for the HTTP protocol on desktop platforms, 6 requests are executed in parallel for one host/port combination.

A more involved example, assuming the manager is already existent, can be:

request.setUrl(QUrl("http://qt-project.org"));
request.setRawHeader("User-Agent", "MyOwnBrowser 1.0");
connect(reply, &QIODevice::readyRead, this, &MyClass::slotReadyRead);
this, &MyClass::slotError);
connect(reply, &QNetworkReply::sslErrors,
this, &MyClass::slotSslErrors);
void finished(QNetworkReply *reply)
This signal is emitted whenever a pending network reply is finished.
QNetworkReply * get(const QNetworkRequest &request)
Posts a request to obtain the contents of the target request and returns a new QNetworkReply object o...
void errorOccurred(QNetworkReply::NetworkError)
void setRawHeader(const QByteArray &headerName, const QByteArray &value)
Sets the header headerName to be of value headerValue.
void setUrl(const QUrl &url)
Sets the URL this network request is referring to be url.
QNetworkAccessManager * manager
[0]
connect(manager, &QNetworkAccessManager::finished, this, &MyClass::replyFinished)
QNetworkRequest request
[0]
See also
QNetworkRequest, QNetworkReply, QNetworkProxy

Definition at line 35 of file qnetworkaccessmanager.h.

Member Enumeration Documentation

◆ Operation

Indicates the operation this reply is processing.

\value HeadOperation retrieve headers operation (created with head())

\value GetOperation retrieve headers and download contents (created with get())

\value PutOperation upload contents operation (created with put())

\value PostOperation send the contents of an HTML form for processing via HTTP POST (created with post())

\value DeleteOperation delete contents operation (created with deleteResource())

\value CustomOperation custom operation (created with sendCustomRequest())

Since
4.7

\omitvalue UnknownOperation

See also
QNetworkReply::operation()
Enumerator
HeadOperation 
GetOperation 
PutOperation 
PostOperation 
DeleteOperation 
CustomOperation 
UnknownOperation 

Definition at line 41 of file qnetworkaccessmanager.h.

Constructor & Destructor Documentation

◆ QNetworkAccessManager()

QNetworkAccessManager::QNetworkAccessManager ( QObject * parent = nullptr)
explicit

Constructs a QNetworkAccessManager object that is the center of the Network Access API and sets parent as the parent object.

Definition at line 396 of file qnetworkaccessmanager.cpp.

References ensureInitialized().

+ Here is the call graph for this function:

◆ ~QNetworkAccessManager()

QNetworkAccessManager::~QNetworkAccessManager ( )

Destroys the QNetworkAccessManager object and frees up any resources.

Note that QNetworkReply objects that are returned from this class have this object set as their parents, which means that they will be deleted along with it if you don't call QObject::setParent() on them.

Definition at line 426 of file qnetworkaccessmanager.cpp.

References qDeleteAll().

+ Here is the call graph for this function:

Member Function Documentation

◆ addStrictTransportSecurityHosts()

void QNetworkAccessManager::addStrictTransportSecurityHosts ( const QList< QHstsPolicy > & knownHosts)
Since
5.9

Adds HTTP Strict Transport Security policies into HSTS cache. knownHosts contains the known hosts that have QHstsPolicy information.

Note
An expired policy will remove a known host from the cache, if previously present.
While processing HTTP responses, QNetworkAccessManager can also update the HSTS cache, removing or updating exitsting policies or introducing new knownHosts. The current implementation thus is server-driven, client code can provide QNetworkAccessManager with previously known or discovered policies, but this information can be overridden by "Strict-Transport-Security" response headers.
See also
addStrictTransportSecurityHosts(), enableStrictTransportSecurityStore(), QHstsPolicy

Definition at line 736 of file qnetworkaccessmanager.cpp.

References d.

◆ authenticationRequired

void QNetworkAccessManager::authenticationRequired ( QNetworkReply * reply,
QAuthenticator * authenticator )
signal

This signal is emitted whenever a final server requests authentication before it delivers the requested contents.

The slot connected to this signal should fill the credentials for the contents (which can be determined by inspecting the reply object) in the authenticator object.

QNetworkAccessManager will cache the credentials internally and will send the same values if the server requires authentication again, without emitting the authenticationRequired() signal. If it rejects the credentials, this signal will be emitted again.

Note
To have the request not send credentials you must not call setUser() or setPassword() on the authenticator object. This will result in the \l finished() signal being emitted with a \l QNetworkReply with error \l {QNetworkReply::} {AuthenticationRequiredError}.
It is not possible to use a QueuedConnection to connect to this signal, as the connection will fail if the authenticator has not been filled in with new information when the signal returns.
See also
proxyAuthenticationRequired(), QAuthenticator::setUser(), QAuthenticator::setPassword()

◆ autoDeleteReplies()

bool QNetworkAccessManager::autoDeleteReplies ( ) const
Since
5.14

Returns the true if QNetworkAccessManager is currently configured to automatically delete QNetworkReplies, false otherwise.

See also
setAutoDeleteReplies, QNetworkRequest::AutoDeleteReplyOnFinishAttribute

Definition at line 1438 of file qnetworkaccessmanager.cpp.

Referenced by createRequest().

+ Here is the caller graph for this function:

◆ cache()

QAbstractNetworkCache * QNetworkAccessManager::cache ( ) const
Since
4.5

Returns the cache that is used to store data obtained from the network.

See also
setCache()

Definition at line 539 of file qnetworkaccessmanager.cpp.

References d.

Referenced by QHostInfo::fromName(), QHostInfoRunnable::run(), and setCache().

+ Here is the caller graph for this function:

◆ clearAccessCache()

void QNetworkAccessManager::clearAccessCache ( )
Since
5.0

Flushes the internal cache of authentication data and network connections.

This function is useful for doing auto tests.

See also
clearConnectionCache()

Definition at line 1408 of file qnetworkaccessmanager.cpp.

References QNetworkAccessManagerPrivate::clearAuthenticationCache(), and QNetworkAccessManagerPrivate::clearConnectionCache().

+ Here is the call graph for this function:

◆ clearConnectionCache()

void QNetworkAccessManager::clearConnectionCache ( )
Since
5.9

Flushes the internal cache of network connections. In contrast to clearAccessCache() the authentication data is preserved.

See also
clearAccessCache()

Definition at line 1423 of file qnetworkaccessmanager.cpp.

References QNetworkAccessManagerPrivate::clearConnectionCache().

+ Here is the call graph for this function:

◆ connectToHost()

void QNetworkAccessManager::connectToHost ( const QString & hostName,
quint16 port = 80 )
Since
5.2

Initiates a connection to the host given by hostName at port port. This function is useful to complete the TCP handshake to a host before the HTTP request is made, resulting in a lower network latency.

Note
This function has no possibility to report errors.
See also
connectToHostEncrypted(), get(), post(), put(), deleteResource()

Definition at line 1070 of file qnetworkaccessmanager.cpp.

References get(), request, QUrl::setHost(), QUrl::setPort(), QUrl::setScheme(), and url.

+ Here is the call graph for this function:

◆ connectToHostEncrypted() [1/2]

void QNetworkAccessManager::connectToHostEncrypted ( const QString & hostName,
quint16 port,
const QSslConfiguration & sslConfiguration,
const QString & peerName )
Since
5.13 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Initiates a connection to the host given by hostName at port port, using sslConfiguration with peerName set to be the hostName used for certificate validation. This function is useful to complete the TCP and SSL handshake to a host before the HTTPS request is made, resulting in a lower network latency.

Note
Preconnecting a HTTP/2 connection can be done by calling setAllowedNextProtocols() on sslConfiguration with QSslConfiguration::ALPNProtocolHTTP2 contained in the list of allowed protocols. When using HTTP/2, one single connection per host is enough, i.e. calling this method multiple times per host will not result in faster network transactions.
This function has no possibility to report errors.
See also
connectToHost(), get(), post(), put(), deleteResource()

Definition at line 1037 of file qnetworkaccessmanager.cpp.

References QSslConfiguration::allowedNextProtocols(), QSslConfiguration::ALPNProtocolHTTP2, QListSpecialMethodsBase< T >::contains(), QSslConfiguration::defaultConfiguration(), get(), QNetworkRequest::Http2AllowedAttribute, request, QNetworkRequest::setAttribute(), QUrl::setHost(), QNetworkRequest::setPeerVerifyName(), QUrl::setPort(), QUrl::setScheme(), QNetworkRequest::setSslConfiguration(), and url.

+ Here is the call graph for this function:

◆ connectToHostEncrypted() [2/2]

void QNetworkAccessManager::connectToHostEncrypted ( const QString & hostName,
quint16 port = 443,
const QSslConfiguration & sslConfiguration = QSslConfiguration::defaultConfiguration() )
Since
5.2

Initiates a connection to the host given by hostName at port port, using sslConfiguration. This function is useful to complete the TCP and SSL handshake to a host before the HTTPS request is made, resulting in a lower network latency.

Note
Preconnecting a HTTP/2 connection can be done by calling setAllowedNextProtocols() on sslConfiguration with QSslConfiguration::ALPNProtocolHTTP2 contained in the list of allowed protocols. When using HTTP/2, one single connection per host is enough, i.e. calling this method multiple times per host will not result in faster network transactions.
This function has no possibility to report errors.
See also
connectToHost(), get(), post(), put(), deleteResource()

Definition at line 1011 of file qnetworkaccessmanager.cpp.

References connectToHostEncrypted().

Referenced by connectToHostEncrypted().

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

◆ cookieJar()

QNetworkCookieJar * QNetworkAccessManager::cookieJar ( ) const

Returns the QNetworkCookieJar that is used to store cookies obtained from the network as well as cookies that are about to be sent.

See also
setCookieJar()

Definition at line 579 of file qnetworkaccessmanager.cpp.

References d.

Referenced by QNetworkReplyHttpImplPrivate::_q_metaDataChanged(), QNetworkReplyImplPrivate::metaDataChanged(), QNetworkReplyHttpImplPrivate::onRedirected(), and setCookieJar().

+ Here is the caller graph for this function:

◆ createRequest()

QNetworkReply * QNetworkAccessManager::createRequest ( Operation op,
const QNetworkRequest & request,
QIODevice * outgoingData = nullptr )
protectedvirtual

Returns a new QNetworkReply object to handle the operation op and request originalReq.

The device outgoingData is always 0 for Get and Head requests, but is the value passed to post() and put() in those operations (the QByteArray variants will pass a QBuffer object).

The default implementation calls QNetworkCookieJar::cookiesForUrl() on the cookie jar set with setCookieJar() to obtain the cookies to be sent to the remote server.

The returned object must be in an open state.

Definition at line 1198 of file qnetworkaccessmanager.cpp.

References QNetworkRequest::AlwaysCache, QNetworkRequest::attribute(), autoDeleteReplies(), QNetworkRequest::AutoDeleteReplyOnFinishAttribute, QNetworkRequest::Automatic, QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::ContentLengthHeader, QNetworkRequest::CookieHeader, QNetworkRequest::CookieLoadControlAttribute, d, QVariant::fromValue(), GetOperation, QNetworkRequest::header(), HeadOperation, QString::isEmpty(), QUrl::isLocalFile(), QVariant::isNull(), QIODevice::isSequential(), isStrictTransportSecurityEnabled(), QVariant::isValid(), QNetworkRequest::NoLessSafeRedirectPolicy, QNetworkRequest::PreferNetwork, priv(), Q_UNUSED, QNetworkReplyFileImpl, QNetworkReplyHttpImpl, redirectPolicy(), QNetworkRequest::RedirectPolicyAttribute, reply, request, QUrl::scheme(), QNetworkRequest::setAttribute(), QNetworkRequest::setHeader(), QNetworkRequest::setUrl(), QIODevice::size(), QNetworkRequest::sslConfiguration(), QVariant::toInt(), transferTimeoutAsDuration(), and QNetworkRequest::url().

Referenced by deleteResource(), get(), get(), head(), post(), post(), put(), put(), and sendCustomRequest().

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

◆ deleteResource()

QNetworkReply * QNetworkAccessManager::deleteResource ( const QNetworkRequest & request)
Since
4.6

Sends a request to delete the resource identified by the URL of request.

Note
This feature is currently available for HTTP only, performing an HTTP DELETE request.
See also
get(), post(), put(), sendCustomRequest()

Definition at line 987 of file qnetworkaccessmanager.cpp.

References createRequest(), DeleteOperation, and request.

+ Here is the call graph for this function:

◆ enableStrictTransportSecurityStore()

void QNetworkAccessManager::enableStrictTransportSecurityStore ( bool enabled,
const QString & storeDir = QString() )
Since
5.10

If enabled is true, the internal HSTS cache will use a persistent store to read and write HSTS policies. storeDir defines where this store will be located. The default location is defined by QStandardPaths::CacheLocation. If there is no writable QStandartPaths::CacheLocation and storeDir is an empty string, the store will be located in the program's working directory.

Note
If HSTS cache already contains HSTS policies by the time persistent store is enabled, these policies will be preserved in the store. In case both cache and store contain the same known hosts, policies from cache are considered to be more up-to-date (and thus will overwrite the previous values in the store). If this behavior is undesired, enable HSTS store before enabling Strict Transport Security. By default, the persistent store of HSTS policies is disabled.
See also
isStrictTransportSecurityStoreEnabled(), setStrictTransportSecurityEnabled(), QStandardPaths::standardLocations()

Definition at line 684 of file qnetworkaccessmanager.cpp.

References d, Q_UNUSED, and qWarning.

◆ encrypted

void QNetworkAccessManager::encrypted ( QNetworkReply * reply)
signal
Since
5.1

This signal is emitted when an SSL/TLS session has successfully completed the initial handshake. At this point, no user data has been transmitted. The signal can be used to perform additional checks on the certificate chain, for example to notify users when the certificate for a website has changed. The reply parameter specifies which network reply is responsible. If the reply does not match the expected criteria then it should be aborted by calling QNetworkReply::abort() by a slot connected to this signal. The SSL configuration in use can be inspected using the QNetworkReply::sslConfiguration() method.

Internally, QNetworkAccessManager may open multiple connections to a server, in order to allow it process requests in parallel. These connections may be reused, which means that the encrypted() signal would not be emitted. This means that you are only guaranteed to receive this signal for the first connection to a site in the lifespan of the QNetworkAccessManager.

See also
QSslSocket::encrypted()
QNetworkReply::encrypted()

◆ finished

void QNetworkAccessManager::finished ( QNetworkReply * reply)
signal

This signal is emitted whenever a pending network reply is finished.

The reply parameter will contain a pointer to the reply that has just finished. This signal is emitted in tandem with the QNetworkReply::finished() signal.

See QNetworkReply::finished() for information on the status that the object will be in.

Note
Do not delete the reply object in the slot connected to this signal. Use deleteLater().
See also
QNetworkReply::finished(), QNetworkReply::error()

◆ get() [1/3]

QNetworkReply * QNetworkAccessManager::get ( const QNetworkRequest & request)

Posts a request to obtain the contents of the target request and returns a new QNetworkReply object opened for reading which emits the \l{QIODevice::readyRead()}{readyRead()} signal whenever new data arrives.

The contents as well as associated headers will be downloaded.

See also
post(), put(), deleteResource(), sendCustomRequest()

Definition at line 778 of file qnetworkaccessmanager.cpp.

References createRequest(), GetOperation, and request.

Referenced by GeoRoutingManagerEngineEsri::calculateRoute(), QGeoRoutingManagerEngineMapbox::calculateRoute(), QGeoRoutingManagerEngineOsm::calculateRoute(), connectToHost(), connectToHostEncrypted(), GeoCodingManagerEngineEsri::geocode(), QGeoCodingManagerEngineOsm::geocode(), QGeoIntrinsicNetworkAccessManager::get(), get(), GeoTileFetcherEsri::getTileImage(), QGeoTileFetcherMapbox::getTileImage(), QGeoTileFetcherOsm::getTileImage(), TileProvider::resolveProvider(), GeoCodingManagerEngineEsri::reverseGeocode(), QGeoCodingManagerEngineOsm::reverseGeocode(), PlaceManagerEngineEsri::search(), and QPlaceManagerEngineOsm::search().

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

◆ get() [2/3]

QNetworkReply * QNetworkAccessManager::get ( const QNetworkRequest & request,
const QByteArray & data )
Since
6.7

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

Note
A GET request with a message body is not cached.
If the request is redirected, the message body will be kept only if the status code is 307 or 308.

Definition at line 812 of file qnetworkaccessmanager.cpp.

References get(), QIODeviceBase::ReadOnly, reply, request, and QBuffer::setData().

+ Here is the call graph for this function:

◆ get() [3/3]

QNetworkReply * QNetworkAccessManager::get ( const QNetworkRequest & request,
QIODevice * data )
Since
6.7

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

Note
A GET request with a message body is not cached.
If the request is redirected, the message body will be kept only if the status code is 307 or 308.

Definition at line 794 of file qnetworkaccessmanager.cpp.

References createRequest(), GetOperation, and request.

+ Here is the call graph for this function:

◆ head()

QNetworkReply * QNetworkAccessManager::head ( const QNetworkRequest & request)

Posts a request to obtain the network headers for request and returns a new QNetworkReply object which will contain such headers.

The function is named after the HTTP request associated (HEAD).

Definition at line 763 of file qnetworkaccessmanager.cpp.

References createRequest(), HeadOperation, and request.

+ Here is the call graph for this function:

◆ isStrictTransportSecurityEnabled()

bool QNetworkAccessManager::isStrictTransportSecurityEnabled ( ) const
Since
5.9

Returns true if HTTP Strict Transport Security (HSTS) was enabled. By default HSTS is disabled.

See also
setStrictTransportSecurityEnabled()

Definition at line 658 of file qnetworkaccessmanager.cpp.

References d.

Referenced by createRequest().

+ Here is the caller graph for this function:

◆ isStrictTransportSecurityStoreEnabled()

bool QNetworkAccessManager::isStrictTransportSecurityStoreEnabled ( ) const
Since
5.10

Returns true if HSTS cache uses a permanent store to load and store HSTS policies.

See also
enableStrictTransportSecurityStore()

Definition at line 706 of file qnetworkaccessmanager.cpp.

References d.

◆ post() [1/3]

QNetworkReply * QNetworkAccessManager::post ( const QNetworkRequest & request,
const QByteArray & data )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sends the contents of the data byte array to the destination specified by request.

Definition at line 848 of file qnetworkaccessmanager.cpp.

References post(), QIODeviceBase::ReadOnly, reply, request, and QBuffer::setData().

+ Here is the call graph for this function:

◆ post() [2/3]

QNetworkReply * QNetworkAccessManager::post ( const QNetworkRequest & request,
QIODevice * data )

Sends an HTTP POST request to the destination specified by request and returns a new QNetworkReply object opened for reading that will contain the reply sent by the server.

The contents of the data device will be uploaded to the server.

data must be open for reading and must remain valid until the finished() signal is emitted for this reply.

Note
Sending a POST request on protocols other than HTTP and HTTPS is undefined and will probably fail.
See also
get(), put(), deleteResource(), sendCustomRequest()

Definition at line 837 of file qnetworkaccessmanager.cpp.

References createRequest(), PostOperation, and request.

Referenced by post(), and QGeoIntrinsicNetworkAccessManager::post().

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

◆ post() [3/3]

QNetworkReply * QNetworkAccessManager::post ( const QNetworkRequest & request,
std::nullptr_t nptr )

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

Sends the POST request specified by request without a body and returns a new QNetworkReply object.

Definition at line 867 of file qnetworkaccessmanager.cpp.

References createRequest(), PostOperation, Q_UNUSED, and request.

+ Here is the call graph for this function:

◆ preSharedKeyAuthenticationRequired

void QNetworkAccessManager::preSharedKeyAuthenticationRequired ( QNetworkReply * reply,
QSslPreSharedKeyAuthenticator * authenticator )
signal
Since
5.5

This signal is emitted if the SSL/TLS handshake negotiates a PSK ciphersuite, and therefore a PSK authentication is then required. The reply object is the QNetworkReply that is negotiating such ciphersuites.

When using PSK, the client must send to the server a valid identity and a valid pre shared key, in order for the SSL handshake to continue. Applications can provide this information in a slot connected to this signal, by filling in the passed authenticator object according to their needs.

Note
Ignoring this signal, or failing to provide the required credentials, will cause the handshake to fail, and therefore the connection to be aborted.
The authenticator object is owned by the reply and must not be deleted by the application.
See also
QSslPreSharedKeyAuthenticator

◆ proxy()

QNetworkProxy QNetworkAccessManager::proxy ( ) const

Returns the QNetworkProxy that the requests sent using this QNetworkAccessManager object will use.

The default value for the proxy is QNetworkProxy::DefaultProxy.

See also
setProxy(), setProxyFactory(), proxyAuthenticationRequired()

Definition at line 450 of file qnetworkaccessmanager.cpp.

Referenced by setProxy().

+ Here is the caller graph for this function:

◆ proxyAuthenticationRequired

void QNetworkAccessManager::proxyAuthenticationRequired ( const QNetworkProxy & proxy,
QAuthenticator * authenticator )
signal

This signal is emitted whenever a proxy requests authentication and QNetworkAccessManager cannot find a valid, cached credential.

The slot connected to this signal should fill in the credentials for the proxy proxy in the authenticator object.

QNetworkAccessManager will cache the credentials internally. The next time the proxy requests authentication, QNetworkAccessManager will automatically send the same credential without emitting the proxyAuthenticationRequired signal again.

If the proxy rejects the credentials, QNetworkAccessManager will emit the signal again.

See also
proxy(), setProxy(), authenticationRequired()

◆ proxyFactory()

QNetworkProxyFactory * QNetworkAccessManager::proxyFactory ( ) const
Since
4.5

Returns the proxy factory that this QNetworkAccessManager object is using to determine the proxies to be used for requests.

Note that the pointer returned by this function is managed by QNetworkAccessManager and could be deleted at any time.

See also
setProxyFactory(), proxy()

Definition at line 489 of file qnetworkaccessmanager.cpp.

◆ put() [1/3]

QNetworkReply * QNetworkAccessManager::put ( const QNetworkRequest & request,
const QByteArray & data )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sends the contents of the data byte array to the destination specified by request.

Definition at line 949 of file qnetworkaccessmanager.cpp.

References put(), QIODeviceBase::ReadOnly, reply, request, and QBuffer::setData().

+ Here is the call graph for this function:

◆ put() [2/3]

QNetworkReply * QNetworkAccessManager::put ( const QNetworkRequest & request,
QIODevice * data )

Uploads the contents of data to the destination request and returns a new QNetworkReply object that will be open for reply.

data must be opened for reading when this function is called and must remain valid until the finished() signal is emitted for this reply.

Whether anything will be available for reading from the returned object is protocol dependent. For HTTP, the server may send a small HTML page indicating the upload was successful (or not). Other protocols will probably have content in their replies.

Note
For HTTP, this request will send a PUT request, which most servers do not allow. Form upload mechanisms, including that of uploading files through HTML forms, use the POST mechanism.
See also
get(), post(), deleteResource(), sendCustomRequest()

Definition at line 938 of file qnetworkaccessmanager.cpp.

References createRequest(), PutOperation, and request.

Referenced by put().

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

◆ put() [3/3]

QNetworkReply * QNetworkAccessManager::put ( const QNetworkRequest & request,
std::nullptr_t nptr )

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

Sends the PUT request specified by request without a body and returns a new QNetworkReply object.

Definition at line 969 of file qnetworkaccessmanager.cpp.

References createRequest(), PutOperation, Q_UNUSED, and request.

+ Here is the call graph for this function:

◆ redirectPolicy()

QNetworkRequest::RedirectPolicy QNetworkAccessManager::redirectPolicy ( ) const
Since
5.9

Returns the redirect policy that is used when creating new requests.

See also
setRedirectPolicy(), QNetworkRequest::RedirectPolicy

Definition at line 1110 of file qnetworkaccessmanager.cpp.

References d.

Referenced by createRequest().

+ Here is the caller graph for this function:

◆ sendCustomRequest() [1/2]

QNetworkReply * QNetworkAccessManager::sendCustomRequest ( const QNetworkRequest & request,
const QByteArray & verb,
const QByteArray & data )
Since
5.8

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

Sends the contents of the data byte array to the destination specified by request.

Definition at line 1150 of file qnetworkaccessmanager.cpp.

References QIODeviceBase::ReadOnly, reply, request, sendCustomRequest(), and QBuffer::setData().

+ Here is the call graph for this function:

◆ sendCustomRequest() [2/2]

QNetworkReply * QNetworkAccessManager::sendCustomRequest ( const QNetworkRequest & request,
const QByteArray & verb,
QIODevice * data = nullptr )
Since
4.7

Sends a custom request to the server identified by the URL of request.

It is the user's responsibility to send a verb to the server that is valid according to the HTTP specification.

This method provides means to send verbs other than the common ones provided via get() or post() etc., for instance sending an HTTP OPTIONS command.

If data is not empty, the contents of the data device will be uploaded to the server; in that case, data must be open for reading and must remain valid until the finished() signal is emitted for this reply.

Note
This feature is currently available for HTTP(S) only.
See also
get(), post(), put(), deleteResource()

Definition at line 1135 of file qnetworkaccessmanager.cpp.

References createRequest(), CustomOperation, QNetworkRequest::CustomVerbAttribute, request, and QNetworkRequest::setAttribute().

Referenced by sendCustomRequest().

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

◆ setAutoDeleteReplies()

void QNetworkAccessManager::setAutoDeleteReplies ( bool shouldAutoDelete)
Since
5.14

Enables or disables automatic deletion of \l {QNetworkReply} {QNetworkReplies}.

Setting shouldAutoDelete to true is the same as setting the QNetworkRequest::AutoDeleteReplyOnFinishAttribute attribute to true on all {future} \l {QNetworkRequest} {QNetworkRequests} passed to this instance of QNetworkAccessManager unless the attribute was already explicitly set on the QNetworkRequest.

See also
autoDeleteReplies, QNetworkRequest::AutoDeleteReplyOnFinishAttribute

Definition at line 1457 of file qnetworkaccessmanager.cpp.

◆ setCache()

void QNetworkAccessManager::setCache ( QAbstractNetworkCache * cache)
Since
4.5

Sets the manager's network cache to be the cache specified. The cache is used for all requests dispatched by the manager.

Use this function to set the network cache object to a class that implements additional features, like saving the cookies to permanent storage.

Note
QNetworkAccessManager takes ownership of the cache object.

QNetworkAccessManager by default does not have a set cache. Qt provides a simple disk cache, QNetworkDiskCache, which can be used.

See also
cache(), QNetworkRequest::CacheLoadControl

Definition at line 561 of file qnetworkaccessmanager.cpp.

References cache(), d, and QObject::setParent().

Referenced by CachingNetworkAccessManagerFactory::create().

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

◆ setCookieJar()

void QNetworkAccessManager::setCookieJar ( QNetworkCookieJar * cookieJar)

Sets the manager's cookie jar to be the cookieJar specified.

The cookie jar is used by all requests dispatched by the manager.

Use this function to set the cookie jar object to a class that implements additional features, like saving the cookies to permanent storage.

Note
QNetworkAccessManager takes ownership of the cookieJar object.

If cookieJar is in the same thread as this QNetworkAccessManager, it will set the parent of the cookieJar so that the cookie jar is deleted when this object is deleted as well. If you want to share cookie jars between different QNetworkAccessManager objects, you may want to set the cookie jar's parent to 0 after calling this function.

QNetworkAccessManager by default does not implement any cookie policy of its own: it accepts all cookies sent by the server, as long as they are well formed and meet the minimum security requirements (cookie domain matches the request's and cookie path matches the request's). In order to implement your own security policy, override the QNetworkCookieJar::cookiesForUrl() and QNetworkCookieJar::setCookiesFromUrl() virtual functions. Those functions are called by QNetworkAccessManager when it detects a new cookie.

See also
cookieJar(), QNetworkCookieJar::cookiesForUrl(), QNetworkCookieJar::setCookiesFromUrl()

Definition at line 616 of file qnetworkaccessmanager.cpp.

References cookieJar(), d, QObject::setParent(), and QObject::thread().

+ Here is the call graph for this function:

◆ setProxy()

void QNetworkAccessManager::setProxy ( const QNetworkProxy & proxy)

Sets the proxy to be used in future requests to be proxy.

This does not affect requests that have already been sent. The proxyAuthenticationRequired() signal will be emitted if the proxy requests authentication.

A proxy set with this function will be used for all requests issued by QNetworkAccessManager. In some cases, it might be necessary to select different proxies depending on the type of request being sent or the destination host. If that's the case, you should consider using setProxyFactory().

See also
proxy(), proxyAuthenticationRequired()

Definition at line 469 of file qnetworkaccessmanager.cpp.

References d, and proxy().

+ Here is the call graph for this function:

◆ setProxyFactory()

void QNetworkAccessManager::setProxyFactory ( QNetworkProxyFactory * factory)
Since
4.5

Sets the proxy factory for this class to be factory. A proxy factory is used to determine a more specific list of proxies to be used for a given request, instead of trying to use the same proxy value for all requests.

All queries sent by QNetworkAccessManager will have type QNetworkProxyQuery::UrlRequest.

For example, a proxy factory could apply the following rules: \list

  • if the target address is in the local network (for example, if the hostname contains no dots or if it's an IP address in the organization's range), return QNetworkProxy::NoProxy
  • if the request is FTP, return an FTP proxy
  • if the request is HTTP or HTTPS, then return an HTTP proxy
  • otherwise, return a SOCKSv5 proxy server \endlist

The lifetime of the object factory will be managed by QNetworkAccessManager. It will delete the object when necessary.

Note
If a specific proxy is set with setProxy(), the factory will not be used.
See also
proxyFactory(), setProxy(), QNetworkProxyQuery

Definition at line 523 of file qnetworkaccessmanager.cpp.

References d, and factory.

◆ setRedirectPolicy()

void QNetworkAccessManager::setRedirectPolicy ( QNetworkRequest::RedirectPolicy policy)
Since
5.9

Sets the manager's redirect policy to be the policy specified. This policy will affect all subsequent requests created by the manager.

Use this function to enable or disable HTTP redirects on the manager's level.

Note
When creating a request QNetworkRequest::RedirectAttributePolicy has the highest priority, next by priority the manager's policy.

The default value is QNetworkRequest::NoLessSafeRedirectPolicy. Clients relying on manual redirect handling are encouraged to set this policy explicitly in their code.

See also
redirectPolicy(), QNetworkRequest::RedirectPolicy

Definition at line 1097 of file qnetworkaccessmanager.cpp.

References d, and policy.

◆ setStrictTransportSecurityEnabled()

void QNetworkAccessManager::setStrictTransportSecurityEnabled ( bool enabled)
Since
5.9

If enabled is true, QNetworkAccessManager follows the HTTP Strict Transport Security policy (HSTS, RFC6797). When processing a request, QNetworkAccessManager automatically replaces the "http" scheme with "https" and uses a secure transport for HSTS hosts. If it's set explicitly, port 80 is replaced by port 443.

When HSTS is enabled, for each HTTP response containing HSTS header and received over a secure transport, QNetworkAccessManager will update its HSTS cache, either remembering a host with a valid policy or removing a host with an expired or disabled HSTS policy.

See also
isStrictTransportSecurityEnabled()

Definition at line 644 of file qnetworkaccessmanager.cpp.

References d, and enabled.

◆ setTransferTimeout() [1/2]

void QNetworkAccessManager::setTransferTimeout ( int timeout)
Since
5.15

Sets timeout as the transfer timeout in milliseconds.

See also
setTransferTimeout(std::chrono::milliseconds), transferTimeout(), transferTimeoutAsDuration()

◆ setTransferTimeout() [2/2]

void QNetworkAccessManager::setTransferTimeout ( std::chrono::milliseconds duration = QNetworkRequest::DefaultTransferTimeout)
Since
6.7

Sets the timeout duration to abort the transfer if no data is exchanged.

Transfers are aborted if no bytes are transferred before the timeout expires. Zero means no timer is set. If no argument is provided, the timeout is QNetworkRequest::DefaultTransferTimeout. If this function is not called, the timeout is disabled and has the value zero. The request-specific non-zero timeouts set for the requests that are executed override this value. This means that if QNetworkAccessManager has an enabled timeout, it needs to be disabled to execute a request without a timeout.

See also
transferTimeoutAsDuration()

Definition at line 1513 of file qnetworkaccessmanager.cpp.

◆ sslErrors

void QNetworkAccessManager::sslErrors ( QNetworkReply * reply,
const QList< QSslError > & errors )
signal

This signal is emitted if the SSL/TLS session encountered errors during the set up, including certificate verification errors.

The errors parameter contains the list of errors and reply is the QNetworkReply that is encountering these errors.

To indicate that the errors are not fatal and that the connection should proceed, the QNetworkReply::ignoreSslErrors() function should be called from the slot connected to this signal. If it is not called, the SSL session will be torn down before any data is exchanged (including the URL).

This signal can be used to display an error message to the user indicating that security may be compromised and display the SSL settings (see sslConfiguration() to obtain it). If the user decides to proceed after analyzing the remote certificate, the slot should call ignoreSslErrors().

See also
QSslSocket::sslErrors(), QNetworkReply::sslErrors(), QNetworkReply::sslConfiguration(), QNetworkReply::ignoreSslErrors()

◆ strictTransportSecurityHosts()

QList< QHstsPolicy > QNetworkAccessManager::strictTransportSecurityHosts ( ) const
Since
5.9

Returns the list of HTTP Strict Transport Security policies. This list can differ from what was initially set via addStrictTransportSecurityHosts() if HSTS cache was updated from a "Strict-Transport-Security" response header.

See also
addStrictTransportSecurityHosts(), QHstsPolicy

Definition at line 751 of file qnetworkaccessmanager.cpp.

References d.

◆ supportedSchemes()

QStringList QNetworkAccessManager::supportedSchemes ( ) const
virtual
Since
5.2

Lists all the URL schemes supported by the access manager.

Reimplement this method to provide your own supported schemes in a QNetworkAccessManager subclass. It is for instance necessary when your subclass provides support for new protocols.

Definition at line 1357 of file qnetworkaccessmanager.cpp.

References Qt::DirectConnection, QMetaObject::invokeMethod(), and Q_RETURN_ARG.

+ Here is the call graph for this function:

◆ supportedSchemesImplementation

QStringList QNetworkAccessManager::supportedSchemesImplementation ( ) const
protectedslot
Since
5.2
Deprecated

Lists all the URL schemes supported by the access manager.

You should not call this function directly; use QNetworkAccessManager::supportedSchemes() instead.

Because of binary compatibility constraints, the supportedSchemes() method (introduced in Qt 5.2) was not virtual in Qt 5, but now it is. Override the supportedSchemes method rather than this one.

See also
supportedSchemes()

Definition at line 1382 of file qnetworkaccessmanager.cpp.

References d, QStringLiteral, and QSslSocket::supportsSsl().

+ Here is the call graph for this function:

◆ transferTimeout()

int QNetworkAccessManager::transferTimeout ( ) const
Since
5.15

Returns the timeout used for transfers, in milliseconds.

See also
setTransferTimeout()

◆ transferTimeoutAsDuration()

std::chrono::milliseconds QNetworkAccessManager::transferTimeoutAsDuration ( ) const
Since
6.7

Returns the timeout duration after which the transfer is aborted if no data is exchanged.

The default duration is zero, which means that the timeout is not used.

See also
setTransferTimeout(std::chrono::milliseconds)

Definition at line 1491 of file qnetworkaccessmanager.cpp.

Referenced by createRequest().

+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ QNetworkReplyFileImpl

friend class QNetworkReplyFileImpl
friend

Definition at line 148 of file qnetworkaccessmanager.h.

Referenced by createRequest().

◆ QNetworkReplyHttpImpl

friend class QNetworkReplyHttpImpl
friend

Definition at line 146 of file qnetworkaccessmanager.h.

Referenced by createRequest().

◆ QNetworkReplyHttpImplPrivate

friend class QNetworkReplyHttpImplPrivate
friend

Definition at line 147 of file qnetworkaccessmanager.h.

◆ QNetworkReplyImplPrivate

friend class QNetworkReplyImplPrivate
friend

Definition at line 145 of file qnetworkaccessmanager.h.


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