[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

kenneth at webkit.org kenneth at webkit.org
Thu Oct 29 20:36:24 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit ffa55b2eb72ec18593d6983c89fc21a08d7ae5c8
Author: kenneth at webkit.org <kenneth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 29 21:07:50 2009 +0000

    Don't rely on QNetworkReply::NetworkError codes, but
    on HTTP error codes instead.
    
    Patch by Kenneth Rohde Christiansen <kenneth at webkit.org> on 2009-09-29
    Reviewed by Simon Hausmann.
    
    * platform/network/qt/QNetworkReplyHandler.cpp:
    (WebCore::ignoreHttpError):
    (WebCore::QNetworkReplyHandler::finish):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48902 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 46b36c0..4827e22 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -269,6 +269,17 @@
 
         Reviewed by Simon Hausmann.
 
+        Don't rely on QNetworkReply::NetworkError codes, but
+        on HTTP error codes instead.
+
+        * platform/network/qt/QNetworkReplyHandler.cpp:
+        (WebCore::ignoreHttpError):
+        (WebCore::QNetworkReplyHandler::finish):
+
+2009-09-29  Kenneth Rohde Christiansen  <kenneth at webkit.org>
+
+        Reviewed by Simon Hausmann.
+
         Use const references when using Qt's foreach.
 
         * platform/network/qt/QNetworkReplyHandler.cpp:
diff --git a/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
index 18898af..7537592 100644
--- a/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
+++ b/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
@@ -205,6 +205,19 @@ QNetworkReply* QNetworkReplyHandler::release()
     return reply;
 }
 
+static bool ignoreHttpError(QNetworkReply* reply, bool receivedData)
+{
+    int httpStatusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
+
+    if (httpStatusCode == 401 || httpStatusCode == 407)
+        return true;
+
+    if (!receivedData && (httpStatusCode >= 400 && httpStatusCode < 600))
+        return true;
+
+    return false;
+}
+
 void QNetworkReplyHandler::finish()
 {
     m_shouldFinish = (m_loadMode != LoadNormal);
@@ -227,20 +240,13 @@ void QNetworkReplyHandler::finish()
     if (m_redirected) {
         resetState();
         start();
-    } else if (m_reply->error() != QNetworkReply::NoError
-               // a web page that returns 401/403/404 can still have content
-               && ((m_reply->error() != QNetworkReply::ContentOperationNotPermittedError
-                 && m_reply->error() != QNetworkReply::ContentAccessDenied  // 401
-                 && m_reply->error() != QNetworkReply::ContentNotFoundError // 404
-                 && m_reply->error() != QNetworkReply::UnknownContentError)
-                 // If the web page sent content, let's give it to the user.
-                 || !m_responseDataSent)
-               && m_reply->error() != QNetworkReply::AuthenticationRequiredError
-               && m_reply->error() != QNetworkReply::ProxyAuthenticationRequiredError) {
-        QUrl url = m_reply->url();
-
+    } else if (!m_reply->error() || ignoreHttpError(m_reply, m_responseDataSent)) {
+        client->didFinishLoading(m_resourceHandle);
+    } else {
         int code = m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
 
+        QUrl url = m_reply->url();
+
         if (code) {
             ResourceError error("HTTP", code, url.toString(), m_reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString());
             client->didFail(m_resourceHandle, error);
@@ -248,9 +254,8 @@ void QNetworkReplyHandler::finish()
             ResourceError error("QtNetwork", m_reply->error(), url.toString(), m_reply->errorString());
             client->didFail(m_resourceHandle, error);
         }
-    } else {
-        client->didFinishLoading(m_resourceHandle);
     }
+
     oldReply->deleteLater();
     if (oldReply == m_reply)
         m_reply = 0;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list