Commit 67d34954 authored by mjs@apple.com's avatar mjs@apple.com

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  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
parent 1f68bf4a
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.
......
......@@ -117,4 +117,15 @@ frame "3" - didHandleOnloadEventsForFrame
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
......@@ -15,9 +15,13 @@ var testCodes = [301, 302, 303, 307];
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 + ");");
......
......@@ -5,4 +5,6 @@ if ($status > 200 && !$_GET['redirected']) {
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.
......@@ -139,6 +139,15 @@ CFURLRequestRef willSendRequest(CFURLConnectionRef conn, CFURLRequestRef cfReque
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();
}
}
......
......@@ -605,6 +605,15 @@ void ResourceHandle::receivedCancellation(const AuthenticationChallenge& challen
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];
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment