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

Side by Side Diff: net/url_request/url_request.cc

Issue 893843003: Add RedirectInfo as a redirect parameter to ResourceThrottles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Document ResourceThrottle Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « net/url_request/url_request.h ('k') | net/url_request/url_request_job.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/url_request/url_request.h" 5 #include "net/url_request/url_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 FirstPartyURLPolicy first_party_url_policy) { 459 FirstPartyURLPolicy first_party_url_policy) {
460 DCHECK(!is_pending_); 460 DCHECK(!is_pending_);
461 first_party_url_policy_ = first_party_url_policy; 461 first_party_url_policy_ = first_party_url_policy;
462 } 462 }
463 463
464 void URLRequest::set_method(const std::string& method) { 464 void URLRequest::set_method(const std::string& method) {
465 DCHECK(!is_pending_); 465 DCHECK(!is_pending_);
466 method_ = method; 466 method_ = method;
467 } 467 }
468 468
469 // static
470 std::string URLRequest::ComputeMethodForRedirect(
471 const std::string& method,
472 int http_status_code) {
473 // For 303 redirects, all request methods except HEAD are converted to GET,
474 // as per the latest httpbis draft. The draft also allows POST requests to
475 // be converted to GETs when following 301/302 redirects, for historical
476 // reasons. Most major browsers do this and so shall we. Both RFC 2616 and
477 // the httpbis draft say to prompt the user to confirm the generation of new
478 // requests, other than GET and HEAD requests, but IE omits these prompts and
479 // so shall we.
480 // See: https://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-17#sectio n-7.3
481 if ((http_status_code == 303 && method != "HEAD") ||
482 ((http_status_code == 301 || http_status_code == 302) &&
483 method == "POST")) {
484 return "GET";
485 }
486 return method;
487 }
488
489 void URLRequest::SetReferrer(const std::string& referrer) { 469 void URLRequest::SetReferrer(const std::string& referrer) {
490 DCHECK(!is_pending_); 470 DCHECK(!is_pending_);
491 GURL referrer_url(referrer); 471 GURL referrer_url(referrer);
492 if (referrer_url.is_valid()) { 472 if (referrer_url.is_valid()) {
493 referrer_ = referrer_url.GetAsReferrer().spec(); 473 referrer_ = referrer_url.GetAsReferrer().spec();
494 } else { 474 } else {
495 referrer_ = referrer; 475 referrer_ = referrer;
496 } 476 }
497 } 477 }
498 478
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 new base::debug::StackTrace(NULL, 0); 1194 new base::debug::StackTrace(NULL, 0);
1215 *stack_trace_copy = stack_trace; 1195 *stack_trace_copy = stack_trace;
1216 stack_trace_.reset(stack_trace_copy); 1196 stack_trace_.reset(stack_trace_copy);
1217 } 1197 }
1218 1198
1219 const base::debug::StackTrace* URLRequest::stack_trace() const { 1199 const base::debug::StackTrace* URLRequest::stack_trace() const {
1220 return stack_trace_.get(); 1200 return stack_trace_.get();
1221 } 1201 }
1222 1202
1223 } // namespace net 1203 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request.h ('k') | net/url_request/url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698