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

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: Response to comments, part 2 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
« no previous file with comments | « net/tools/testserver/testserver.py ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request.cc
===================================================================
--- net/url_request/url_request.cc (revision 107962)
+++ 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
- // 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;
« no previous file with comments | « net/tools/testserver/testserver.py ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698