[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

beidson at apple.com beidson at apple.com
Thu Apr 8 01:57:11 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 57db4346a9f5b08a5a5597c8f2393c160a2af5d1
Author: beidson at apple.com <beidson at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Feb 23 17:41:24 2010 +0000

    HTTP 307 after a 303 after a POST re-sends POST data from the original request.
    <rdar://problem/7390251> and https://bugs.webkit.org/show_bug.cgi?id=31410
    
    Reviewed by Alexey Proskuryakov.
    
    WebCore:
    
    Test: http/tests/loading/307-after-303-after-post.html
    
    Remember the last HTTP method send out during a redirect chain for a resource handle:
    * platform/network/ResourceHandle.cpp:
    (WebCore::ResourceHandle::lastHTTPMethod):
    * platform/network/ResourceHandle.h:
    * platform/network/ResourceHandleInternal.h:
    (WebCore::ResourceHandleInternal::ResourceHandleInternal):
    
    Refer to the last HTTP method used instead of the original method:
    * platform/network/cf/ResourceHandleCFNet.cpp:
    (WebCore::willSendRequest):
    (WebCore::ResourceHandle::willSendRequest):
    * platform/network/mac/ResourceHandleMac.mm:
    (WebCore::ResourceHandle::willSendRequest):
    (-[WebCoreResourceHandleAsDelegate connection:willSendRequest:redirectResponse:]):
    
    LayoutTests:
    
    * http/tests/loading/307-after-303-after-post.html: Added.
    * http/tests/loading/resources/303-to-307-target.php: Added.
    * http/tests/loading/resources/307-post-output-target.php: Added.
    * http/tests/loading/resources/post-to-303-target.php: Added.
    * platform/gtk/Skipped:
    * platform/qt/Skipped:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55157 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 3e1eae6..d7e965d 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-02-23  Brady Eidson  <beidson at apple.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        HTTP 307 after a 303 after a POST re-sends POST data from the original request.
+        <rdar://problem/7390251> and https://bugs.webkit.org/show_bug.cgi?id=31410
+
+        * http/tests/loading/307-after-303-after-post.html: Added.
+        * http/tests/loading/resources/303-to-307-target.php: Added.
+        * http/tests/loading/resources/307-post-output-target.php: Added.
+        * http/tests/loading/resources/post-to-303-target.php: Added.
+        * platform/gtk/Skipped:
+        * platform/qt/Skipped:
+
 2010-02-23  Ben Murdoch  <benm at google.com>
 
         Reviewed by Eric Seidel.
diff --git a/LayoutTests/http/tests/loading/307-after-303-after-post-expected.txt b/LayoutTests/http/tests/loading/307-after-303-after-post-expected.txt
new file mode 100644
index 0000000..a0ad674
--- /dev/null
+++ b/LayoutTests/http/tests/loading/307-after-303-after-post-expected.txt
@@ -0,0 +1,18 @@
+main frame - didStartProvisionalLoadForFrame
+main frame - didCommitLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+<unknown> - didFinishLoading
+main frame - didStartProvisionalLoadForFrame
+http://127.0.0.1:8000/loading/resources/post-to-303-target.php - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/loading/resources/post-to-303-target.php, main document URL http://127.0.0.1:8000/loading/resources/post-to-303-target.php, http method POST> redirectResponse (null)
+http://127.0.0.1:8000/loading/resources/post-to-303-target.php - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/loading/resources/303-to-307-target.php, main document URL http://127.0.0.1:8000/loading/resources/303-to-307-target.php, http method GET> redirectResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/post-to-303-target.php, http status code 303>
+main frame - didReceiveServerRedirectForProvisionalLoadForFrame
+http://127.0.0.1:8000/loading/resources/post-to-303-target.php - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/loading/resources/307-post-output-target.php, main document URL http://127.0.0.1:8000/loading/resources/307-post-output-target.php, http method GET> redirectResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/303-to-307-target.php, http status code 307>
+main frame - didReceiveServerRedirectForProvisionalLoadForFrame
+http://127.0.0.1:8000/loading/resources/post-to-303-target.php - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/307-post-output-target.php, http status code 200>
+main frame - didCommitLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+There were no POSTed form values.
diff --git a/LayoutTests/http/tests/loading/307-after-303-after-post.html b/LayoutTests/http/tests/loading/307-after-303-after-post.html
new file mode 100644
index 0000000..4d06dc8
--- /dev/null
+++ b/LayoutTests/http/tests/loading/307-after-303-after-post.html
@@ -0,0 +1,18 @@
+<html>
+<head>
+<script>
+if (window.layoutTestController) {
+   layoutTestController.dumpAsText();
+   layoutTestController.waitUntilDone();
+   layoutTestController.dumpResourceLoadCallbacks();
+}
+</script>
+</head>
+<body onload="document.getElementById('testform').submit();">
+<form id="testform" name="testform" action="resources/post-to-303-target.php" method="post">
+Test value input:
+<input type="text" name="testvalue" value="foobar"></input>
+<input type="submit" value="Submit"></input>
+</form>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/loading/resources/303-to-307-target.php b/LayoutTests/http/tests/loading/resources/303-to-307-target.php
new file mode 100644
index 0000000..be44e79
--- /dev/null
+++ b/LayoutTests/http/tests/loading/resources/303-to-307-target.php
@@ -0,0 +1,4 @@
+<?php
+header('HTTP/1.1 307 Temporary Redirect');
+header('Location: 307-post-output-target.php');
+?>
diff --git a/LayoutTests/http/tests/loading/resources/307-post-output-target.php b/LayoutTests/http/tests/loading/resources/307-post-output-target.php
new file mode 100644
index 0000000..13ce055
--- /dev/null
+++ b/LayoutTests/http/tests/loading/resources/307-post-output-target.php
@@ -0,0 +1,22 @@
+<?php
+$sortedKeys = array_keys($_POST);
+sort($sortedKeys);
+?>
+<html><body>
+<?php
+if ( sizeof($_POST) == 0)
+    echo "There were no POSTed form values.";
+else
+    echo "Form values are:<br>";
+
+foreach ($sortedKeys as $value) {
+    echo "$value : $_POST[$value]";
+    echo "<br>";
+}
+?>
+<script>
+if (window.layoutTestController)
+   layoutTestController.notifyDone();
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/loading/resources/post-to-303-target.php b/LayoutTests/http/tests/loading/resources/post-to-303-target.php
new file mode 100644
index 0000000..90a2db1
--- /dev/null
+++ b/LayoutTests/http/tests/loading/resources/post-to-303-target.php
@@ -0,0 +1,4 @@
+<?php
+header('HTTP/1.1 303 See Other');
+header('Location: 303-to-307-target.php');
+?>
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 3658798..d122c2e 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -5876,3 +5876,8 @@ plugins/set-status.html
 
 # Fails on 32bits Debug bot, see https://bugs.webkit.org/show_bug.cgi?id=35158
 fast/forms/restore-selection-after-layout.html
+
+# Needs to make sure the redirect-chain scenario in https://bugs.webkit.org/show_bug.cgi?id=31410 works
+# See https://bugs.webkit.org/show_bug.cgi?id=35300
+http/tests/loading/307-after-303-after-post.html
+
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index 831f5e9..341b8d3 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -5087,3 +5087,7 @@ fast/loader/api-test-new-window-data-load-base-url.html
 # https://bugs.webkit.org/show_bug.cgi?id=35145
 editing/selection/extend-selection.html
 editing/selection/extend-after-mouse-selection.html
+
+# Needs to make sure the redirect-chain scenario in https://bugs.webkit.org/show_bug.cgi?id=31410 works
+# See https://bugs.webkit.org/show_bug.cgi?id=35301
+http/tests/loading/307-after-303-after-post.html
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 50101dd..a9b3d79 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,27 @@
+2010-02-23  Brady Eidson  <beidson at apple.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        HTTP 307 after a 303 after a POST re-sends POST data from the original request.
+        <rdar://problem/7390251> and https://bugs.webkit.org/show_bug.cgi?id=31410
+
+        Test: http/tests/loading/307-after-303-after-post.html
+
+        Remember the last HTTP method send out during a redirect chain for a resource handle:
+        * platform/network/ResourceHandle.cpp:
+        (WebCore::ResourceHandle::lastHTTPMethod):
+        * platform/network/ResourceHandle.h:
+        * platform/network/ResourceHandleInternal.h:
+        (WebCore::ResourceHandleInternal::ResourceHandleInternal):
+
+        Refer to the last HTTP method used instead of the original method:
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::willSendRequest):
+        (WebCore::ResourceHandle::willSendRequest):
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::willSendRequest):
+        (-[WebCoreResourceHandleAsDelegate connection:willSendRequest:redirectResponse:]):
+
 2010-02-23  Crystal Zhang  <haizhang at rim.com>
 
         Unreviewed build fix.
diff --git a/WebCore/platform/network/ResourceHandle.cpp b/WebCore/platform/network/ResourceHandle.cpp
index 7c20561..ddee75b 100644
--- a/WebCore/platform/network/ResourceHandle.cpp
+++ b/WebCore/platform/network/ResourceHandle.cpp
@@ -104,6 +104,11 @@ const ResourceRequest& ResourceHandle::request() const
     return d->m_request;
 }
 
+const String& ResourceHandle::lastHTTPMethod() const
+{
+    return d->m_lastHTTPMethod;
+}
+
 void ResourceHandle::clearAuthentication()
 {
 #if PLATFORM(MAC)
diff --git a/WebCore/platform/network/ResourceHandle.h b/WebCore/platform/network/ResourceHandle.h
index b764add..59be78f 100644
--- a/WebCore/platform/network/ResourceHandle.h
+++ b/WebCore/platform/network/ResourceHandle.h
@@ -191,6 +191,7 @@ public:
     void setDefersLoading(bool);
       
     const ResourceRequest& request() const;
+    const String& lastHTTPMethod() const;
 
     void fireFailure(Timer<ResourceHandle>*);
 
diff --git a/WebCore/platform/network/ResourceHandleInternal.h b/WebCore/platform/network/ResourceHandleInternal.h
index 328fc89..799361b 100644
--- a/WebCore/platform/network/ResourceHandleInternal.h
+++ b/WebCore/platform/network/ResourceHandleInternal.h
@@ -84,6 +84,7 @@ namespace WebCore {
         ResourceHandleInternal(ResourceHandle* loader, const ResourceRequest& request, ResourceHandleClient* c, bool defersLoading, bool shouldContentSniff, bool mightDownloadFromHandle)
             : m_client(c)
             , m_request(request)
+            , m_lastHTTPMethod(request.httpMethod())
             , status(0)
             , m_defersLoading(defersLoading)
             , m_shouldContentSniff(shouldContentSniff)
@@ -147,6 +148,7 @@ namespace WebCore {
         ResourceHandleClient* m_client;
         
         ResourceRequest m_request;
+        String m_lastHTTPMethod;
 
         // Suggested credentials for the current redirection step.
         String m_user;
diff --git a/WebCore/platform/network/cf/ResourceHandleCFNet.cpp b/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
index 8cc5022..570d192 100644
--- a/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
+++ b/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
@@ -136,11 +136,11 @@ CFURLRequestRef willSendRequest(CFURLConnectionRef conn, CFURLRequestRef cfReque
     if (cfRedirectResponse) {
         CFHTTPMessageRef httpMessage = CFURLResponseGetHTTPResponse(cfRedirectResponse);
         if (httpMessage && CFHTTPMessageGetResponseStatusCode(httpMessage) == 307) {
-            RetainPtr<CFStringRef> originalMethod(AdoptCF, handle->request().httpMethod().createCFString());
+            RetainPtr<CFStringRef> lastHTTPMethod(AdoptCF, handle->lastHTTPMethod().createCFString());
             RetainPtr<CFStringRef> newMethod(AdoptCF, CFURLRequestCopyHTTPRequestMethod(cfRequest));
-            if (CFStringCompareWithOptions(originalMethod.get(), newMethod.get(), CFRangeMake(0, CFStringGetLength(originalMethod.get())), kCFCompareCaseInsensitive)) {
+            if (CFStringCompareWithOptions(lastHTTPMethod.get(), newMethod.get(), CFRangeMake(0, CFStringGetLength(lastHTTPMethod.get())), kCFCompareCaseInsensitive)) {
                 RetainPtr<CFMutableURLRequestRef> mutableRequest(AdoptCF, CFURLRequestCreateMutableCopy(0, cfRequest));
-                CFURLRequestSetHTTPRequestMethod(mutableRequest.get(), originalMethod.get());
+                CFURLRequestSetHTTPRequestMethod(mutableRequest.get(), lastHTTPMethod.get());
 
                 FormData* body = handle->request().httpBody();
                 if (!equalIgnoringCase(handle->request().httpMethod(), "GET") && body && !body->isEmpty())
@@ -432,6 +432,7 @@ void ResourceHandle::willSendRequest(ResourceRequest& request, const ResourceRes
     const KURL& url = request.url();
     d->m_user = url.user();
     d->m_pass = url.pass();
+    d->m_lastHTTPMethod = request.httpMethod();
     request.removeCredentials();
 
     client()->willSendRequest(this, request, redirectResponse);
diff --git a/WebCore/platform/network/mac/ResourceHandleMac.mm b/WebCore/platform/network/mac/ResourceHandleMac.mm
index 923a631..0c67cfb 100644
--- a/WebCore/platform/network/mac/ResourceHandleMac.mm
+++ b/WebCore/platform/network/mac/ResourceHandleMac.mm
@@ -465,6 +465,7 @@ void ResourceHandle::willSendRequest(ResourceRequest& request, const ResourceRes
     const KURL& url = request.url();
     d->m_user = url.user();
     d->m_pass = url.pass();
+    d->m_lastHTTPMethod = request.httpMethod();
     request.removeCredentials();
 
     client()->willSendRequest(this, request, redirectResponse);
@@ -619,13 +620,13 @@ void ResourceHandle::receivedCancellation(const AuthenticationChallenge& challen
 #endif
 
     if ([redirectResponse isKindOfClass:[NSHTTPURLResponse class]] && [(NSHTTPURLResponse *)redirectResponse statusCode] == 307) {
-        String originalMethod = m_handle->request().httpMethod();
-        if (!equalIgnoringCase(originalMethod, String([newRequest HTTPMethod]))) {
+        String lastHTTPMethod = m_handle->lastHTTPMethod();
+        if (!equalIgnoringCase(lastHTTPMethod, String([newRequest HTTPMethod]))) {
             NSMutableURLRequest *mutableRequest = [newRequest mutableCopy];
-            [mutableRequest setHTTPMethod:originalMethod];
+            [mutableRequest setHTTPMethod:lastHTTPMethod];
     
             FormData* body = m_handle->request().httpBody();
-            if (!equalIgnoringCase(originalMethod, "GET") && body && !body->isEmpty())
+            if (!equalIgnoringCase(lastHTTPMethod, "GET") && body && !body->isEmpty())
                 WebCore::setHTTPBody(mutableRequest, body);
 
             String originalContentType = m_handle->request().httpContentType();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list