src/network/access/qnetworkrequest.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
child 33 3e2da88830cd
--- a/src/network/access/qnetworkrequest.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/src/network/access/qnetworkrequest.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -184,6 +184,52 @@
         Indicates whether the HTTP pipelining was used for receiving
         this reply.
 
+    \value CustomVerbAttribute
+       Requests only, type: QVariant::ByteArray
+        Holds the value for the custom HTTP verb to send (destined for usage
+        of other verbs than GET, POST, PUT and DELETE). This verb is set
+        when calling QNetworkAccessManager::sendCustomRequest().
+
+    \value 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 http://www.w3.org/TR/XMLHttpRequest2/#credentials-flag for more information.
+
+        \since 4.7
+
+     \value 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 http://www.w3.org/TR/XMLHttpRequest2/#credentials-flag for more information.
+
+        \since 4.7
+
+     \value AuthenticationReuseControlAttribute
+        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 http://www.w3.org/TR/XMLHttpRequest2/#credentials-flag for more information.
+
+        \since 4.7
+
     \value User
         Special type. Additional information can be passed in
         QVariants with types ranging from User to UserMax. The default
@@ -216,12 +262,25 @@
     if the item was not cached (i.e., off-line mode)
 */
 
+/*!
+    \enum QNetworkRequest::LoadControl
+    \since 4.7
+
+    Indicates if an aspect of the request's loading mechanism has been
+    manually overridden, e.g. by QtWebKit.
+
+    \value Automatic            default value: indicates default behaviour.
+
+    \value Manual               indicates behaviour has been manually overridden.
+*/
+
 class QNetworkRequestPrivate: public QSharedData, public QNetworkHeadersPrivate
 {
 public:
     inline QNetworkRequestPrivate()
+        : priority(QNetworkRequest::NormalPriority)
 #ifndef QT_NO_OPENSSL
-        : sslConfiguration(0)
+        , sslConfiguration(0)
 #endif
     { qRegisterMetaType<QNetworkRequest>(); }
     ~QNetworkRequestPrivate()
@@ -236,6 +295,7 @@
         : QSharedData(other), QNetworkHeadersPrivate(other)
     {
         url = other.url;
+        priority = other.priority;
 
 #ifndef QT_NO_OPENSSL
         sslConfiguration = 0;
@@ -247,12 +307,14 @@
     inline bool operator==(const QNetworkRequestPrivate &other) const
     {
         return url == other.url &&
+            priority == other.priority &&
             rawHeaders == other.rawHeaders &&
             attributes == other.attributes;
         // don't compare cookedHeaders
     }
 
     QUrl url;
+    QNetworkRequest::Priority priority;
 #ifndef QT_NO_OPENSSL
     mutable QSslConfiguration *sslConfiguration;
 #endif
@@ -518,6 +580,45 @@
     return d->originatingObject.data();
 }
 
+/*!
+    \since 4.7
+
+    Return the priority of this request.
+
+    \sa setPriority()
+*/
+QNetworkRequest::Priority QNetworkRequest::priority() const
+{
+    return d->priority;
+}
+
+/*! \enum QNetworkRequest::Priority
+
+  \since 4.7
+  
+  This enum lists the possible network request priorities.
+
+  \value HighPriority   High priority
+  \value NormalPriority Normal priority
+  \value LowPriority    Low priority
+ */
+
+/*!
+    \since 4.7
+
+    Set the priority of this request to \a priority.
+
+    \note The \a 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.
+
+    \sa priority()
+*/
+void QNetworkRequest::setPriority(Priority priority)
+{
+    d->priority = priority;
+}
+
 static QByteArray headerName(QNetworkRequest::KnownHeaders header)
 {
     switch (header) {