Bug 29943 - 307 redirects should pass along http body and Content-Type header
Summary: 307 redirects should pass along http body and Content-Type header
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Maciej Stachowiak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-30 17:43 PDT by Maciej Stachowiak
Modified: 2009-09-30 21:16 PDT (History)
0 users

See Also:


Attachments
patch v1 (6.25 KB, patch)
2009-09-30 17:55 PDT, Maciej Stachowiak
beidson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Stachowiak 2009-09-30 17:43:36 PDT
307 redirects should pass along the http body and Content-Type header, in addition to the method. These are dropped by CFNetwork when converting the redirect to a GET.
Comment 1 Maciej Stachowiak 2009-09-30 17:55:57 PDT
Created attachment 40413 [details]
patch v1
Comment 2 Brady Eidson 2009-09-30 18:00:09 PDT
Comment on attachment 40413 [details]
patch v1

r=me with style issues to be fixed:

> Index: WebCore/platform/network/mac/ResourceHandleMac.mm
> ===================================================================
> --- WebCore/platform/network/mac/ResourceHandleMac.mm	(revision 48858)
> +++ WebCore/platform/network/mac/ResourceHandleMac.mm	(working copy)
> @@ -596,6 +596,15 @@ void ResourceHandle::receivedCancellatio
>          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];
>          }
>      }

There's tabs here (and therefore, maybe elsewhere in the change?) - please replace with spaces.  Maybe as a result, the indentation here is off.
Comment 3 Maciej Stachowiak 2009-09-30 21:14:10 PDT
Committed, and I fixed the tabs.
Comment 4 Maciej Stachowiak 2009-09-30 21:16:08 PDT
Committed r48953.
http://trac.webkit.org/changeset/48953

Also requires r48956 for Windows.
http://trac.webkit.org/changeset/48956

Also r48957.
http://trac.webkit.org/changeset/48957