Qt 4.8
Public Types | Public Functions | Properties | Friends | List of all members
QNetworkRequest Class Reference

The QNetworkRequest class holds a request to be sent with QNetworkAccessManager. More...

#include <qnetworkrequest.h>

Public Types

enum  Attribute {
  HttpStatusCodeAttribute, HttpReasonPhraseAttribute, RedirectionTargetAttribute, ConnectionEncryptedAttribute,
  CacheLoadControlAttribute, CacheSaveControlAttribute, SourceIsFromCacheAttribute, DoNotBufferUploadDataAttribute,
  HttpPipeliningAllowedAttribute, HttpPipeliningWasUsedAttribute, CustomVerbAttribute, CookieLoadControlAttribute,
  AuthenticationReuseAttribute, CookieSaveControlAttribute, MaximumDownloadBufferSizeAttribute, DownloadBufferAttribute,
  SynchronousRequestAttribute, User = 1000, UserMax = 32767
}
 Attribute codes for the QNetworkRequest and QNetworkReply. More...
 
enum  CacheLoadControl { AlwaysNetwork, PreferNetwork, PreferCache, AlwaysCache }
 Controls the caching mechanism of QNetworkAccessManager. More...
 
enum  KnownHeaders {
  ContentTypeHeader, ContentLengthHeader, LocationHeader, LastModifiedHeader,
  CookieHeader, SetCookieHeader, ContentDispositionHeader
}
 List of known header types that QNetworkRequest parses. More...
 
enum  LoadControl { Automatic = 0, Manual }
 Indicates if an aspect of the request's loading mechanism has been manually overridden, e. More...
 
enum  Priority { HighPriority = 1, NormalPriority = 3, LowPriority = 5 }
 This enum lists the possible network request priorities. More...
 

Public Functions

QVariant attribute (Attribute code, const QVariant &defaultValue=QVariant()) const
 Returns the attribute associated with the code code. More...
 
bool hasRawHeader (const QByteArray &headerName) const
 Returns true if the raw header headerName is present in this network request. More...
 
QVariant header (KnownHeaders header) const
 Returns the value of the known network header header if it is present in this request. More...
 
bool operator!= (const QNetworkRequest &other) const
 Returns false if this object is not the same as other. More...
 
QNetworkRequestoperator= (const QNetworkRequest &other)
 Creates a copy of other. More...
 
bool operator== (const QNetworkRequest &other) const
 Returns true if this object is the same as other (i.e., if they have the same URL, same headers and same meta-data settings). More...
 
QObjectoriginatingObject () const
 Returns a reference to the object that initiated this network request; returns 0 if not set or the object has been destroyed. More...
 
Priority priority () const
 Return the priority of this request. More...
 
 QNetworkRequest (const QUrl &url=QUrl())
 Constructs a QNetworkRequest object with url as the URL to be requested. More...
 
 QNetworkRequest (const QNetworkRequest &other)
 Creates a copy of other. More...
 
QByteArray rawHeader (const QByteArray &headerName) const
 Returns the raw form of header headerName. More...
 
QList< QByteArrayrawHeaderList () const
 Returns a list of all raw headers that are set in this network request. More...
 
void setAttribute (Attribute code, const QVariant &value)
 Sets the attribute associated with code code to be value value. More...
 
void setHeader (KnownHeaders header, const QVariant &value)
 Sets the value of the known header header to be value, overriding any previously set headers. More...
 
void setOriginatingObject (QObject *object)
 Allows setting a reference to the object initiating the request. More...
 
void setPriority (Priority priority)
 Set the priority of this request to priority. More...
 
void setRawHeader (const QByteArray &headerName, const QByteArray &value)
 Sets the header headerName to be of value headerValue. More...
 
void setSslConfiguration (const QSslConfiguration &configuration)
 Sets this network request's SSL configuration to be config. More...
 
void setUrl (const QUrl &url)
 Sets the URL this network request is referring to to be url. More...
 
QSslConfiguration sslConfiguration () const
 Returns this network request's SSL configuration. More...
 
QUrl url () const
 Returns the URL this network request is referring to. More...
 
 ~QNetworkRequest ()
 Disposes of the QNetworkRequest object. More...
 

Properties

QSharedDataPointer< QNetworkRequestPrivated
 

Friends

class QNetworkRequestPrivate
 

Detailed Description

The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.

Since
4.4
Attention
Module: QtNetwork

QNetworkRequest is part of the Network Access API and is the class holding the information necessary to send a request over the network. It contains a URL and some ancillary information that can be used to modify the request.

See also
QNetworkReply, QNetworkAccessManager

Definition at line 59 of file qnetworkrequest.h.

Enumerations

◆ Attribute

Attribute codes for the QNetworkRequest and QNetworkReply.

Since
4.7

Attributes are extra meta-data that are used to control the behavior of the request and to pass further information from the reply back to the application. Attributes are also extensible, allowing custom implementations to pass custom values.

The following table explains what the default attribute codes are, the QVariant types associated, the default value if said attribute is missing and whether it's used in requests or replies.

  • HttpStatusCodeAttribute Replies only, type: QVariant::Int (no default) Indicates the HTTP status code received from the HTTP server (like 200, 304, 404, 401, etc.). If the connection was not HTTP-based, this attribute will not be present.
  • HttpReasonPhraseAttribute Replies only, type: QVariant::ByteArray (no default) Indicates the HTTP reason phrase as received from the HTTP server (like "Ok", "Found", "Not Found", "Access Denied", etc.) This is the human-readable representation of the status code (see above). If the connection was not HTTP-based, this attribute will not be present.
  • RedirectionTargetAttribute Replies only, type: QVariant::Url (no default) If present, it indicates that the server is redirecting the request to a different URL. The Network Access API does not by default follow redirections: it's up to the application to determine if the requested redirection should be allowed, according to its security policies. The returned URL might be relative. Use QUrl::resolved() to create an absolute URL out of it.
  • ConnectionEncryptedAttribute Replies only, type: QVariant::Bool (default: false) Indicates whether the data was obtained through an encrypted (secure) connection.
  • CacheSaveControlAttribute Requests only, type: QVariant::Bool (default: true) Controls if the data obtained should be saved to cache for future uses. If the value is false, the data obtained will not be automatically cached. If true, data may be cached, provided it is cacheable (what is cacheable depends on the protocol being used).
  • SourceIsFromCacheAttribute Replies only, type: QVariant::Bool (default: false) Indicates whether the data was obtained from cache or not.
  • DoNotBufferUploadDataAttribute Requests only, type: QVariant::Bool (default: false) Indicates whether the QNetworkAccessManager code is allowed to buffer the upload data, e.g. when doing a HTTP POST. When using this flag with sequential upload data, the ContentLengthHeader header must be set.
  • HttpPipeliningAllowedAttribute Requests only, type: QVariant::Bool (default: false) Indicates whether the QNetworkAccessManager code is allowed to use HTTP pipelining with this request.
  • HttpPipeliningWasUsedAttribute Replies only, type: QVariant::Bool Indicates whether the HTTP pipelining was used for receiving this reply.
  • CookieLoadControlAttribute Requests only, type: QVariant::Int (default: QNetworkRequest::Automatic) Indicates whether to send 'Cookie' headers in the request. This attribute is set to false by QtWebKit when creating a cross-origin XMLHttpRequest where withCredentials has not been set explicitly to true by the Javascript that created the request. See here for more information. (This value was introduced in 4.7.)
  • CookieSaveControlAttribute Requests only, type: QVariant::Int (default: QNetworkRequest::Automatic) Indicates whether to save 'Cookie' headers received from the server in reply to the request. This attribute is set to false by QtWebKit when creating a cross-origin XMLHttpRequest where withCredentials has not been set explicitly to true by the Javascript that created the request. See here for more information. (This value was introduced in 4.7.)
  • AuthenticationReuseAttribute Requests only, type: QVariant::Int (default: QNetworkRequest::Automatic) Indicates whether to use cached authorization credentials in the request, if available. If this is set to QNetworkRequest::Manual and the authentication mechanism is 'Basic' or 'Digest', Qt will not send an an 'Authorization' HTTP header with any cached credentials it may have for the request's URL. This attribute is set to QNetworkRequest::Manual by QtWebKit when creating a cross-origin XMLHttpRequest where withCredentials has not been set explicitly to true by the Javascript that created the request. See here for more information. (This value was introduced in 4.7.)
  • MaximumDownloadBufferSizeAttribute
  • DownloadBufferAttribute
  • SynchronousRequestAttribute
  • User Special type. Additional information can be passed in QVariants with types ranging from User to UserMax. The default implementation of Network Access will ignore any request attributes in this range and it will not produce any attributes in this range in replies. The range is reserved for extensions of QNetworkAccessManager.
  • UserMax Special type. See User.
Enumerator
HttpStatusCodeAttribute 
HttpReasonPhraseAttribute 
RedirectionTargetAttribute 
ConnectionEncryptedAttribute 
CacheLoadControlAttribute 
CacheSaveControlAttribute 
SourceIsFromCacheAttribute 
DoNotBufferUploadDataAttribute 
HttpPipeliningAllowedAttribute 
HttpPipeliningWasUsedAttribute 
CustomVerbAttribute 
CookieLoadControlAttribute 
AuthenticationReuseAttribute 
CookieSaveControlAttribute 
MaximumDownloadBufferSizeAttribute 
DownloadBufferAttribute 
SynchronousRequestAttribute 
User 
UserMax 

Definition at line 71 of file qnetworkrequest.h.

71  {
87  DownloadBufferAttribute, // internal
88  SynchronousRequestAttribute, // internal
89 
90  User = 1000,
91  UserMax = 32767
92  };

◆ CacheLoadControl

Controls the caching mechanism of QNetworkAccessManager.

  • AlwaysNetwork always load from network and do not check if the cache has a valid entry (similar to the "Reload" feature in browsers)
  • PreferNetwork default value; load from the network if the cached entry is older than the network entry
  • PreferCache load from cache if available, otherwise load from network. Note that this can return possibly stale (but not expired) items from cache.
  • AlwaysCache only load from cache, indicating error if the item was not cached (i.e., off-line mode)
Enumerator
AlwaysNetwork 
PreferNetwork 
PreferCache 
AlwaysCache 

Definition at line 93 of file qnetworkrequest.h.

◆ KnownHeaders

List of known header types that QNetworkRequest parses.

Each known header is also represented in raw form with its full HTTP name.

  • ContentTypeHeader corresponds to the HTTP Content-Type header and contains a string containing the media (MIME) type and any auxiliary data (for instance, charset)
  • ContentLengthHeader corresponds to the HTTP Content-Length header and contains the length in bytes of the data transmitted.
  • LocationHeader corresponds to the HTTP Location header and contains a URL representing the actual location of the data, including the destination URL in case of redirections.
  • LastModifiedHeader corresponds to the HTTP Last-Modified header and contains a QDateTime representing the last modification date of the contents
  • CookieHeader corresponds to the HTTP Cookie header and contains a QList<QNetworkCookie> representing the cookies to be sent back to the server
  • SetCookieHeader corresponds to the HTTP Set-Cookie header and contains a QList<QNetworkCookie> representing the cookies sent by the server to be stored locally
See also
header(), setHeader(), rawHeader(), setRawHeader()
Enumerator
ContentTypeHeader 
ContentLengthHeader 
LocationHeader 
LastModifiedHeader 
CookieHeader 
SetCookieHeader 
ContentDispositionHeader 

Definition at line 62 of file qnetworkrequest.h.

◆ LoadControl

Indicates if an aspect of the request's loading mechanism has been manually overridden, e.

Since
4.7

g. by QtWebKit.

\arg \b Automatic            default value: indicates default behaviour.

\arg \b Manual               indicates behaviour has been manually overridden.
Enumerator
Automatic 
Manual 

Definition at line 99 of file qnetworkrequest.h.

◆ Priority

This enum lists the possible network request priorities.

Since
4.7
  • HighPriority High priority
  • NormalPriority Normal priority
  • LowPriority Low priority
Enumerator
HighPriority 
NormalPriority 
LowPriority 

Definition at line 104 of file qnetworkrequest.h.

Constructors and Destructors

◆ QNetworkRequest() [1/2]

QNetworkRequest::QNetworkRequest ( const QUrl url = QUrl())
explicit

Constructs a QNetworkRequest object with url as the URL to be requested.

See also
url(), setUrl()

Definition at line 342 of file qnetworkrequest.cpp.

344 {
345  d->url = url;
346 }
QSharedDataPointer< QNetworkRequestPrivate > d
QUrl url() const
Returns the URL this network request is referring to.

◆ QNetworkRequest() [2/2]

QNetworkRequest::QNetworkRequest ( const QNetworkRequest other)

Creates a copy of other.

Definition at line 351 of file qnetworkrequest.cpp.

352  : d(other.d)
353 {
354 }
QSharedDataPointer< QNetworkRequestPrivate > d

◆ ~QNetworkRequest()

QNetworkRequest::~QNetworkRequest ( )

Disposes of the QNetworkRequest object.

Definition at line 359 of file qnetworkrequest.cpp.

360 {
361  // QSharedDataPointer auto deletes
362  d = 0;
363 }
QSharedDataPointer< QNetworkRequestPrivate > d

Functions

◆ attribute()

QVariant QNetworkRequest::attribute ( Attribute  code,
const QVariant defaultValue = QVariant() 
) const

Returns the attribute associated with the code code.

If the attribute has not been set, it returns defaultValue.

Note: this function does not apply the defaults listed in QNetworkRequest::Attribute.

See also
setAttribute(), QNetworkRequest::Attribute

Definition at line 514 of file qnetworkrequest.cpp.

Referenced by QNetworkAccessManagerPrivate::authenticationRequired(), QNetworkReplyImplPrivate::createCache(), QNetworkAccessManager::createRequest(), QNetworkReplyImplPrivate::getDownloadBuffer(), QNetworkAccessHttpBackend::loadFromCacheIfAllowed(), QNetworkReplyImplPrivate::metaDataChanged(), QNetworkAccessHttpBackend::postRequest(), and QNetworkReplyImplPrivate::setup().

515 {
516  return d->attributes.value(code, defaultValue);
517 }
QSharedDataPointer< QNetworkRequestPrivate > d
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606

◆ hasRawHeader()

bool QNetworkRequest::hasRawHeader ( const QByteArray headerName) const

Returns true if the raw header headerName is present in this network request.

See also
rawHeader(), setRawHeader()

Definition at line 446 of file qnetworkrequest.cpp.

Referenced by QDeclarativeXMLHttpRequest::addHeader(), and QNetworkAccessManagerPrivate::prepareMultipart().

447 {
448  return d->findRawHeader(headerName) != d->rawHeaders.constEnd();
449 }
QSharedDataPointer< QNetworkRequestPrivate > d
RawHeadersList::ConstIterator findRawHeader(const QByteArray &key) const
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:272

◆ header()

QVariant QNetworkRequest::header ( KnownHeaders  header) const

Returns the value of the known network header header if it is present in this request.

If it is not present, returns QVariant() (i.e., an invalid variant).

See also
KnownHeaders, rawHeader(), setHeader()

Definition at line 423 of file qnetworkrequest.cpp.

Referenced by QNetworkAccessManager::createRequest(), QNetworkAccessManagerPrivate::prepareMultipart(), QDeclarativeXMLHttpRequest::requestFromUrl(), and QNetworkReplyImplPrivate::setup().

424 {
425  return d->cookedHeaders.value(header);
426 }
QSharedDataPointer< QNetworkRequestPrivate > d
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
QVariant header(KnownHeaders header) const
Returns the value of the known network header header if it is present in this request.
CookedHeadersMap cookedHeaders

◆ operator!=()

bool QNetworkRequest::operator!= ( const QNetworkRequest other) const
inline

Returns false if this object is not the same as other.

See also
operator==()

Definition at line 116 of file qnetworkrequest.h.

117  { return !operator==(other); }
bool operator==(const QNetworkRequest &other) const
Returns true if this object is the same as other (i.e., if they have the same URL, same headers and same meta-data settings).

◆ operator=()

QNetworkRequest & QNetworkRequest::operator= ( const QNetworkRequest other)

Creates a copy of other.

Definition at line 390 of file qnetworkrequest.cpp.

391 {
392  d = other.d;
393  return *this;
394 }
QSharedDataPointer< QNetworkRequestPrivate > d

◆ operator==()

bool QNetworkRequest::operator== ( const QNetworkRequest other) const

Returns true if this object is the same as other (i.e., if they have the same URL, same headers and same meta-data settings).

See also
operator!=()

Definition at line 371 of file qnetworkrequest.cpp.

372 {
373  return d == other.d || *d == *other.d;
374 }
QSharedDataPointer< QNetworkRequestPrivate > d

◆ originatingObject()

QObject * QNetworkRequest::originatingObject ( ) const

Returns a reference to the object that initiated this network request; returns 0 if not set or the object has been destroyed.

Since
4.6
See also
setOriginatingObject()

Definition at line 601 of file qnetworkrequest.cpp.

602 {
603  return d->originatingObject.data();
604 }
QSharedDataPointer< QNetworkRequestPrivate > d
T * data() const
QWeakPointer< QObject > originatingObject

◆ priority()

QNetworkRequest::Priority QNetworkRequest::priority ( ) const

Return the priority of this request.

Since
4.7
See also
setPriority()

Definition at line 616 of file qnetworkrequest.cpp.

Referenced by setPriority().

617 {
618  return d->priority;
619 }
QSharedDataPointer< QNetworkRequestPrivate > d
QNetworkRequest::Priority priority

◆ rawHeader()

QByteArray QNetworkRequest::rawHeader ( const QByteArray headerName) const

Returns the raw form of header headerName.

If no such header is present, an empty QByteArray is returned, which may be indistinguishable from a header that is present but has no content (use hasRawHeader() to find out if the header exists or not).

Raw headers can be set with setRawHeader() or with setHeader().

See also
header(), setRawHeader()

Definition at line 461 of file qnetworkrequest.cpp.

Referenced by QDeclarativeXMLHttpRequest::addHeader(), QNetworkAccessHttpBackend::canResume(), and QNetworkAccessHttpBackend::postRequest().

462 {
464  d->findRawHeader(headerName);
465  if (it != d->rawHeaders.constEnd())
466  return it->second;
467  return QByteArray();
468 }
#define it(className, varName)
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
QSharedDataPointer< QNetworkRequestPrivate > d
const_iterator ConstIterator
Qt-style synonym for QList::const_iterator.
Definition: qlist.h:279
RawHeadersList::ConstIterator findRawHeader(const QByteArray &key) const
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:272

◆ rawHeaderList()

QList< QByteArray > QNetworkRequest::rawHeaderList ( ) const

Returns a list of all raw headers that are set in this network request.

The list is in the order that the headers were set.

See also
hasRawHeader(), rawHeader()

Definition at line 476 of file qnetworkrequest.cpp.

Referenced by QNetworkAccessHttpBackend::postRequest().

477 {
478  return d->rawHeadersKeys();
479 }
QSharedDataPointer< QNetworkRequestPrivate > d
QList< QByteArray > rawHeadersKeys() const

◆ setAttribute()

void QNetworkRequest::setAttribute ( Attribute  code,
const QVariant value 
)

Sets the attribute associated with code code to be value value.

If the attribute is already set, the previous value is discarded. In special, if value is an invalid QVariant, the attribute is unset.

See also
attribute(), QNetworkRequest::Attribute

Definition at line 527 of file qnetworkrequest.cpp.

Referenced by QDeclarativeFontObject::download(), QDeclarativeAnimatedImage::load(), QDeclarativePixmapReader::networkRequestDone(), QDeclarativePixmapReader::processJob(), and QNetworkAccessManager::sendCustomRequest().

528 {
529  if (value.isValid())
530  d->attributes.insert(code, value);
531  else
532  d->attributes.remove(code);
533 }
int remove(const Key &key)
Removes all the items that have the key from the hash.
Definition: qhash.h:784
QSharedDataPointer< QNetworkRequestPrivate > d
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
bool isValid() const
Returns true if the storage type of this variant is not QVariant::Invalid; otherwise returns false...
Definition: qvariant.h:485

◆ setHeader()

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

Sets the value of the known header header to be value, overriding any previously set headers.

This operation also sets the equivalent raw HTTP header.

See also
KnownHeaders, setRawHeader(), header()

Definition at line 435 of file qnetworkrequest.cpp.

Referenced by QNetworkAccessManager::createRequest(), QNetworkAccessManagerPrivate::prepareMultipart(), and QDeclarativeXMLHttpRequest::requestFromUrl().

436 {
437  d->setCookedHeader(header, value);
438 }
QSharedDataPointer< QNetworkRequestPrivate > d
QVariant header(KnownHeaders header) const
Returns the value of the known network header header if it is present in this request.
void setCookedHeader(QNetworkRequest::KnownHeaders header, const QVariant &value)

◆ setOriginatingObject()

void QNetworkRequest::setOriginatingObject ( QObject object)

Allows setting a reference to the object initiating the request.

Since
4.6

For example QtWebKit sets the originating object to the QWebFrame that initiated the request.

See also
originatingObject()

Definition at line 584 of file qnetworkrequest.cpp.

585 {
586  d->originatingObject = object;
587 }
QSharedDataPointer< QNetworkRequestPrivate > d
QWeakPointer< QObject > originatingObject

◆ setPriority()

void QNetworkRequest::setPriority ( Priority  priority)

Set the priority of this request to priority.

Since
4.7
Note
The priority is only a hint to the network access manager. It can use it or not. Currently it is used for HTTP to decide which request should be sent first to a server.
See also
priority()

Definition at line 649 of file qnetworkrequest.cpp.

650 {
651  d->priority = priority;
652 }
QSharedDataPointer< QNetworkRequestPrivate > d
QNetworkRequest::Priority priority
Priority priority() const
Return the priority of this request.

◆ setRawHeader()

void QNetworkRequest::setRawHeader ( const QByteArray headerName,
const QByteArray headerValue 
)

Sets the header headerName to be of value headerValue.

If headerName corresponds to a known header (see QNetworkRequest::KnownHeaders), the raw format will be parsed and the corresponding "cooked" header will be set as well.

For example:

request.setRawHeader("Last-Modified", "Sun, 06 Nov 1994 08:49:37 GMT");

will also set the known header LastModifiedHeader to be the QDateTime object of the parsed date.

Note: setting the same header twice overrides the previous setting. To accomplish the behaviour of multiple HTTP headers of the same name, you should concatenate the two values, separating them with a comma (",") and set one single raw header.

See also
KnownHeaders, setHeader(), hasRawHeader(), rawHeader()

Definition at line 500 of file qnetworkrequest.cpp.

Referenced by QDeclarativeXMLHttpRequest::addHeader(), QNetworkAccessManagerPrivate::prepareMultipart(), and QDeclarativeXmlListModel::reload().

501 {
502  d->setRawHeader(headerName, headerValue);
503 }
void setRawHeader(const QByteArray &key, const QByteArray &value)
QSharedDataPointer< QNetworkRequestPrivate > d

◆ setSslConfiguration()

void QNetworkRequest::setSslConfiguration ( const QSslConfiguration config)

Sets this network request's SSL configuration to be config.

The settings that apply are the private key, the local certificate, the SSL protocol (SSLv2, SSLv3, TLSv1 where applicable), the CA certificates and the ciphers that the SSL backend is allowed to use.

By default, no SSL configuration is set, which allows the backends to choose freely what configuration is best for them.

See also
sslConfiguration(), QSslConfiguration::defaultConfiguration()

Definition at line 561 of file qnetworkrequest.cpp.

562 {
563  if (!d->sslConfiguration)
564  d->sslConfiguration = new QSslConfiguration(config);
565  else
566  *d->sslConfiguration = config;
567 }
QSharedDataPointer< QNetworkRequestPrivate > d
QSslConfiguration * sslConfiguration
The QSslConfiguration class holds the configuration and state of an SSL connection.

◆ setUrl()

void QNetworkRequest::setUrl ( const QUrl url)

Sets the URL this network request is referring to to be url.

See also
url()

Definition at line 411 of file qnetworkrequest.cpp.

Referenced by QDeclarativeInclude::finished(), QDeclarativeInclude::QDeclarativeInclude(), and QDeclarativeXMLHttpRequest::requestFromUrl().

412 {
413  d->url = url;
414 }
QSharedDataPointer< QNetworkRequestPrivate > d
QUrl url() const
Returns the URL this network request is referring to.

◆ sslConfiguration()

QSslConfiguration QNetworkRequest::sslConfiguration ( ) const

Returns this network request's SSL configuration.

By default, no SSL settings are specified.

See also
setSslConfiguration()

Definition at line 542 of file qnetworkrequest.cpp.

Referenced by QNetworkAccessManager::createRequest(), QNetworkAccessHttpBackend::fetchSslConfiguration(), and QNetworkAccessHttpBackend::postRequest().

543 {
544  if (!d->sslConfiguration)
546  return *d->sslConfiguration;
547 }
QSharedDataPointer< QNetworkRequestPrivate > d
QSslConfiguration * sslConfiguration
static QSslConfiguration defaultConfiguration()
Returns the default SSL configuration to be used in new SSL connections.
The QSslConfiguration class holds the configuration and state of an SSL connection.

◆ url()

QUrl QNetworkRequest::url ( ) const

Friends and Related Functions

◆ QNetworkRequestPrivate

Definition at line 149 of file qnetworkrequest.h.

Properties

◆ d

QSharedDataPointer<QNetworkRequestPrivate> QNetworkRequest::d
private

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