Reviewed by Brady Eidson.
307 redirects should pass along http body and Content-Type header
https://bugs.webkit.org/show_bug.cgi?id=29943
Follow-up fix for:
<rdar://problem/
3802660> SAP: 307 (Temporary Redirect) responses should use POST, not GET
Test: http/tests/loading/resources/redirect-methods-result.php
* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::willSendRequest): Pass along http body and Content-Type header.
* platform/network/mac/ResourceHandleMac.mm:
(-[WebCoreResourceHandleAsDelegate connection:willSendRequest:redirectResponse:]): ditto
2009-09-30 Maciej Stachowiak <mjs@apple.com>
Reviewed by Brady Eidson.
307 redirects should pass along http body and Content-Type header
https://bugs.webkit.org/show_bug.cgi?id=29943
Follow-up fix for:
<rdar://problem/
3802660> SAP: 307 (Temporary Redirect) responses should use POST, not GET
* http/tests/loading/redirect-methods.html: Updated test to show the http body and content-type header.
* http/tests/loading/redirect-methods-expected.txt:
* http/tests/loading/resources/redirect-methods-result.php:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48953
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2009-09-30 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Brady Eidson.
+
+ 307 redirects should pass along http body and Content-Type header
+ https://bugs.webkit.org/show_bug.cgi?id=29943
+
+ Follow-up fix for:
+ <rdar://problem/3802660> SAP: 307 (Temporary Redirect) responses should use POST, not GET
+
+ * http/tests/loading/redirect-methods.html: Updated test to show the http body and content-type header.
+ * http/tests/loading/redirect-methods-expected.txt:
+ * http/tests/loading/resources/redirect-methods-result.php:
+
2009-09-30 Jeremy Orlow <jorlow@chromium.org>
Reviewed by Dimitri Glazkov.
frame "3" - didFinishLoadForFrame
This test checks to see what HTTP method is used to fetch the final resource in the case where the first request results in a redirect.
301, 302, 303, and 307 http redirects are all tested.
+301 redirect
+
+
+302 redirect
+
+
+303 redirect
+
+
+307 redirect
+
function createFrame(index)
{
+ var h4 = document.createElement("h4");
+ h4.innerHTML = testCodes[index] + " redirect";
+ document.body.appendChild(h4);
var iframe = document.createElement("iframe");
iframe.setAttribute("testCode", testCodes[index]);
iframe.setAttribute("id", index);
+ iframe.setAttribute("height", "90px");
document.body.appendChild(iframe);
iframe.src="resources/redirect-methods-form.html";
iframe.setAttribute("onload", "iframeLoaded(" + index + ");");
exit();
}
?>
-This page loaded using the <?php echo $_SERVER['REQUEST_METHOD'] ?> method.
+Request Method: <?php echo $_SERVER['REQUEST_METHOD'] ?><br>
+Request Body: <?php echo @file_get_contents('php://input') ?><br>
+Request Content-Type: <?php echo $_SERVER["CONTENT_TYPE"]; ?>
+2009-09-30 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Brady Eidson.
+
+ 307 redirects should pass along http body and Content-Type header
+ https://bugs.webkit.org/show_bug.cgi?id=29943
+
+ Follow-up fix for:
+ <rdar://problem/3802660> SAP: 307 (Temporary Redirect) responses should use POST, not GET
+
+ Test: http/tests/loading/resources/redirect-methods-result.php
+
+ * platform/network/cf/ResourceHandleCFNet.cpp:
+ (WebCore::willSendRequest): Pass along http body and Content-Type header.
+ * platform/network/mac/ResourceHandleMac.mm:
+ (-[WebCoreResourceHandleAsDelegate connection:willSendRequest:redirectResponse:]): ditto
+
2009-09-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by Mark Rowe.
if (CFStringCompareWithOptions(originalMethod.get(), newMethod.get(), CFRangeMake(0, CFStringGetLength(originalMethod.get())), kCFCompareCaseInsensitive)) {
RetainPtr<CFMutableURLRequestRef> mutableRequest(AdoptCF, CFURLRequestCreateMutableCopy(0, cfRequest));
CFURLRequestSetHTTPRequestMethod(mutableRequest.get(), originalMethod.get());
+
+ FormData* body = handle->request().httpBody();
+ if (!equalIgnoringCase(handle->request().httpMethod(), "GET") && body && !body->isEmpty())
+ WebCore::setHTTPBody(mutableRequest, body);
+
+ String originalContentType = m_handle->request.httpContentType();
+ if (!originalContentType->isEmpty())
+ CFURLRequestSetHTTPHeaderFieldValue(mutableRequest.get(), CFSTR("Content-Type"), originalContentType);
+
request = mutableRequest.get();
}
}
if (!equalIgnoringCase(originalMethod, String([newRequest HTTPMethod]))) {
NSMutableURLRequest *mutableRequest = [newRequest mutableCopy];
[mutableRequest setHTTPMethod:originalMethod];
+
+ FormData* body = m_handle->request().httpBody();
+ if (!equalIgnoringCase(originalMethod, "GET") && body && !body->isEmpty())
+ WebCore::setHTTPBody(mutableRequest, body);
+
+ String originalContentType = m_handle->request().httpContentType();
+ if (!originalContentType.isEmpty())
+ [mutableRequest setValue:originalContentType forHTTPHeaderField:@"Content-Type"];
+
newRequest = [mutableRequest autorelease];
}
}