Fix fast/dom/xmlhttprequest-get.xhtml
authorhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Jan 2008 10:54:03 +0000 (10:54 +0000)
committerhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Jan 2008 10:54:03 +0000 (10:54 +0000)
For local file requests remove the content length and the last-modified
headers in the response.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29617 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/network/qt/QNetworkReplyHandler.cpp

index fce568e47588459d2b898c65462721d6ca546b21..29ded2c88bdde6ff9fe3a581b3df0876c633ca49 100644 (file)
@@ -1,3 +1,16 @@
+2008-01-18  Simon Hausmann  <hausmann@webkit.org>
+
+        Reviewed by Holger.
+
+        Fix fast/dom/xmlhttprequest-get.xhtml
+        
+        For local file requests remove the content length and the last-modified
+        headers in the response.
+        
+
+        * platform/network/qt/QNetworkReplyHandler.cpp:
+        (WebCore::QNetworkReplyHandler::sendResponseIfNeeded):
+
 2008-01-18  Simon Hausmann  <hausmann@webkit.org>
 
         Reviewed by Holger.
index 1719b2cf38c817724006f1a5fa387b7aebe35abd..73b5024bfd4e36e3b12f6180ee475cb5dd395295 100644 (file)
@@ -127,16 +127,26 @@ void QNetworkReplyHandler::sendResponseIfNeeded()
                               encoding,
                               filenameFromHTTPContentDisposition(contentDisposition));
 
+    const bool isLocalFileReply = (m_reply->url().scheme() == QLatin1String("file"));
     int statusCode = m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
-    if (m_reply->url().scheme() != QLatin1String("file"))
+    if (!isLocalFileReply)
         response.setHTTPStatusCode(statusCode);
     else if (m_reply->error() == QNetworkReply::ContentNotFoundError)
         response.setHTTPStatusCode(404);
 
 
-    /* Fill in the other fields */
-    foreach (QByteArray headerName, m_reply->rawHeaderList())
+    /* Fill in the other fields
+     * For local file requests remove the content length and the last-modified
+     * headers as required by fast/dom/xmlhttprequest-get.xhtml
+     */
+    foreach (QByteArray headerName, m_reply->rawHeaderList()) {
+
+        if (isLocalFileReply
+            && (headerName == "Content-Length" || headerName == "Last-Modified"))
+            continue;
+
         response.setHTTPHeaderField(QString::fromAscii(headerName), QString::fromAscii(m_reply->rawHeader(headerName)));
+    }
 
     QUrl redirection = m_reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
     if (redirection.isValid()) {