diff options
author | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-01 02:32:05 +0000 |
---|---|---|
committer | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-01 02:32:05 +0000 |
commit | bbb011f6a1b9b2877ab0de8860535bb50b39e6d8 (patch) | |
tree | 53d41f8b58c19c6ef6945598219116b802b6cc05 /net/url_request/url_request.cc | |
parent | b61f62a7db35181bb858c4d2a433714fb1aadf37 (diff) | |
download | chromium_src-bbb011f6a1b9b2877ab0de8860535bb50b39e6d8.zip chromium_src-bbb011f6a1b9b2877ab0de8860535bb50b39e6d8.tar.gz chromium_src-bbb011f6a1b9b2877ab0de8860535bb50b39e6d8.tar.bz2 |
Don't convert HEAD requests to GETs on 303 redirects.
BUG=102130
TEST=URLRequestTestHTTP.Redirect*Tests
Review URL: http://codereview.chromium.org/8418024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108060 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request/url_request.cc')
-rw-r--r-- | net/url_request/url_request.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index 20f0b9c..0e3c984 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc @@ -695,15 +695,16 @@ int URLRequest::Redirect(const GURL& location, int http_status_code) { return ERR_UNSAFE_REDIRECT; } - // For 303 redirects, all request methods are converted to GETs, as per RFC - // 2616. The latest httpbis draft also allows POST requests to be converted - // to GETs when following 301/302 redirects for historical reasons. Most - // major browsers do this and so shall we. The RFC says to prompt the user - // to confirm the generation of new requests, other than GET and HEAD - // requests, but IE omits these prompts and so shall we. - // See: http://greenbytes.de/tech/webdav/draft-ietf-httpbis-p2-semantics-latest.html#status.3xx + // For 303 redirects, all request methods except HEAD are converted to GET, + // as per the latest httpbis draft. The draft also allows POST requests to + // be converted to GETs when following 301/302 redirects, for historical + // reasons. Most major browsers do this and so shall we. Both RFC 2616 and + // the httpbis draft say to prompt the user to confirm the generation of new + // requests, other than GET and HEAD requests, but IE omits these prompts and + // so shall we. + // See: https://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-17#section-7.3 bool was_post = method_ == "POST"; - if (http_status_code == 303 || + if ((http_status_code == 303 && method_ != "HEAD") || ((http_status_code == 301 || http_status_code == 302) && was_post)) { method_ = "GET"; upload_ = NULL; |