http/tests/security/cors-post-redirect-308.html doesn't work properly
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Aug 2015 00:45:56 +0000 (00:45 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Aug 2015 00:45:56 +0000 (00:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=147914

Reviewed by Brady Eidson.

* http/tests/resources/redirect.php: Trying to return
code 308 without a reason phrase results in an internal server error with Apache/2.2.
While at it, also corrected the script to always set Cache-Control: no-store.

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

LayoutTests/ChangeLog
LayoutTests/http/tests/resources/redirect.php

index 68c0539..bb12351 100644 (file)
@@ -1,5 +1,16 @@
 2015-08-12  Alexey Proskuryakov  <ap@apple.com>
 
+        http/tests/security/cors-post-redirect-308.html doesn't work properly
+        https://bugs.webkit.org/show_bug.cgi?id=147914
+
+        Reviewed by Brady Eidson.
+
+        * http/tests/resources/redirect.php: Trying to return
+        code 308 without a reason phrase results in an internal server error with Apache/2.2.
+        While at it, also corrected the script to always set Cache-Control: no-store.
+
+2015-08-12  Alexey Proskuryakov  <ap@apple.com>
+
         Removing an expectation for a test that's fixed.
 
         * platform/mac/TestExpectations:
index f536072..b08c8d3 100644 (file)
@@ -1,20 +1,28 @@
 <?php
+    function addCacheControl() {
+        # Workaround for https://bugs.webkit.org/show_bug.cgi?id=77538
+        # Caching redirects results in flakiness in tests that dump loader delegates.
+        header("Cache-Control: no-store");
+    }
+
     $url = $_GET['url'];
     $refresh = $_GET['refresh'];
     
     if (isset($refresh)) {
         header("HTTP/1.1 200");
         header("Refresh: $refresh; url=$url");
+        addCacheControl();
         return;
     }
 
     $code = $_GET['code'];
     if (!isset($code))
-        $code = 302;
-    header("HTTP/1.1 $code");
+        header("HTTP/1.1 302 Found");
+    elseif ($code == 308) {
+        # Apache 2.2 (and possibly some newer versions) cannot generate a reason string for code 308, and sends a 500 error instead.
+        header("HTTP/1.1 308 Permanent Redirect");
+    } else
+        header("HTTP/1.1 $code");
     header("Location: $url");
-
-    # Workaround for https://bugs.webkit.org/show_bug.cgi?id=77538
-    # Caching redirects results in flakiness in tests that dump loader delegates.
-    header("Cache-Control: no-store");
+    addCacheControl();
 ?>