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

Unified Diff: net/url_request/url_request.cc

Issue 2111623003: Reland of Apply Referrer-Policy header when following redirects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: initialize |read_handler| Created 4 years, 6 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/url_request/url_request.h ('k') | net/url_request/url_request_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request.cc
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
index 7fac9c77caf2a50c1052cc72ac4880ea96dbac05..0c1d5f4c197b9ffb799fff6bb274909163fd406d 100644
--- a/net/url_request/url_request.cc
+++ b/net/url_request/url_request.cc
@@ -479,6 +479,15 @@ void URLRequest::SetReferrer(const std::string& referrer) {
void URLRequest::set_referrer_policy(ReferrerPolicy referrer_policy) {
DCHECK(!is_pending_);
+ // External callers shouldn't be setting NO_REFERRER or
+ // ORIGIN. |referrer_policy_| is only applied during server redirects,
+ // so external callers must set the referrer themselves using
+ // SetReferrer() for the initial request. Once the referrer has been
+ // set to an origin or to an empty string, there is no point in
+ // setting the policy to NO_REFERRER or ORIGIN as it would have the
+ // same effect as using NEVER_CLEAR_REFERRER across redirects.
+ DCHECK_NE(referrer_policy, NO_REFERRER);
+ DCHECK_NE(referrer_policy, ORIGIN);
referrer_policy_ = referrer_policy;
}
@@ -978,6 +987,7 @@ int URLRequest::Redirect(const RedirectInfo& redirect_info) {
}
referrer_ = redirect_info.new_referrer;
+ referrer_policy_ = redirect_info.new_referrer_policy;
first_party_for_cookies_ = redirect_info.new_first_party_for_cookies;
token_binding_referrer_ = redirect_info.referred_token_binding_host;
« no previous file with comments | « net/url_request/url_request.h ('k') | net/url_request/url_request_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698