Bug 11118

Summary: Incorrect HTTP method used after redirect with some HTTP status codes
Product: WebKit Reporter: Mark Rowe (bdash) <mrowe>
Component: Page LoadingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ap, brad.kish, dbates, grahamperrin, mnot
Priority: P2 Keywords: InRadar
Version: 420+   
Hardware: Macintosh   
OS: OS X 10.4   
URL: http://www.mnot.net/javascript/xmlhttprequest/#method_301_POST

Description Mark Rowe (bdash) 2006-10-02 04:48:38 PDT
From the URL in question:

"Are methods preserved correctly?
If an implementation automatically handles a redirect, it must use the appropriate request method. HTTP requires receivers of some redirects to change the request method to GET; others are required to use the original method. Implementations that fail these tests will send redirected requests with the wrong HTTP methods."

Section 10.3 of RFC 2616 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3) provides the specification for this behaviour.

Output from this section in ToT WebKit is as follows:

301 Moved Permanently, POST: fail (Redirected using GET, expected POST)
301 Moved Permanently, GET: success
301 Moved Permanently, PUT: fail (Redirected using GET, expected PUT)
301 Moved Permanently, DELETE: fail (Redirected using GET, expected DELETE)
302 Found, POST: fail (Redirected using GET, expected POST)
302 Found, GET: success
302 Found, PUT: fail (Redirected using GET, expected PUT)
302 Found, DELETE: fail (Redirected using GET, expected DELETE)
303 See Other, POST: success
303 See Other, GET: success
303 See Other, PUT: success
303 See Other, DELETE: success
307 Temporary Redirect, POST: fail (Redirected using GET, expected POST)
307 Temporary Redirect, GET: success
307 Temporary Redirect, PUT: fail (Redirected using GET, expected PUT)
307 Temporary Redirect, DELETE: fail (Redirected using GET, expected DELETE)
Comment 1 Alexey Proskuryakov 2006-10-02 22:16:11 PDT
FWIW, for 301 and 302 responses, our behavior matches Firefox, and it looks more consistent for 307 responses (why change the method for permanent redirect, but not for temporary one?).

Please note that while both Firefox and WebKit pass the case for 303, the behavior is debatable, see the thread at <http://lists.w3.org/Archives/Public/public-webapi/2006Sep/0002.html>.
Comment 2 Mark Rowe (bdash) 2008-02-27 11:50:30 PST
*** Bug 17570 has been marked as a duplicate of this bug. ***
Comment 3 Mark Rowe (bdash) 2008-02-27 11:50:49 PST
<rdar://problem/5768949>