Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Unified Diff: net/url_request/url_request.cc

Issue 8418024: Don't convert HEAD requests to GETs on 303 redirects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix sync unit tests Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/url_request/url_request.cc
===================================================================
--- net/url_request/url_request.cc (revision 107563)
+++ net/url_request/url_request.cc (working copy)
@@ -695,15 +695,16 @@
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
+ // For 303 redirects, all request methods except HEAD are converted to GET,
+ // as per RFC 2616. The exception for HEADs is not explicitly stated, but
+ // is implied. 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
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;

Powered by Google App Engine
This is Rietveld 408576698