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

Side by Side Diff: content/browser/frame_host/navigation_request.cc

Issue 2462513003: PlzNavigate: Add missing Upgrade-Insecure-Requests header. (Closed)
Patch Set: PlzNavigate:Add missing Upgrade-Insecure-Requests header. Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/frame_host/navigation_request.h" 5 #include "content/browser/frame_host/navigation_request.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/browser/child_process_security_policy_impl.h" 9 #include "content/browser/child_process_security_policy_impl.h"
10 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 10 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 navigation_type == FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE || 119 navigation_type == FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE ||
120 navigation_type == FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; 120 navigation_type == FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL;
121 if (is_reload) 121 if (is_reload)
122 headers->RemoveHeader("Save-Data"); 122 headers->RemoveHeader("Save-Data");
123 123
124 if (GetContentClient()->browser()->IsDataSaverEnabled(browser_context)) 124 if (GetContentClient()->browser()->IsDataSaverEnabled(browser_context))
125 headers->SetHeaderIfMissing("Save-Data", "on"); 125 headers->SetHeaderIfMissing("Save-Data", "on");
126 126
127 headers->SetHeaderIfMissing(net::HttpRequestHeaders::kUserAgent, 127 headers->SetHeaderIfMissing(net::HttpRequestHeaders::kUserAgent,
128 GetContentClient()->GetUserAgent()); 128 GetContentClient()->GetUserAgent());
129
130 // Tack an 'Upgrade-Insecure-Requests' header to outgoing navigational
clamy 2016/11/02 14:01:30 This is called also for subframe navigations, is t
arthursonzogni 2016/11/02 16:55:28 Yes it is. The browser-side implementation is putt
131 // requests, as described in
132 // https://w3c.github.io/webappsec/specs/upgrade/#feature-detect
133 headers->AddHeaderFromString("Upgrade-Insecure-Requests: 1");
129 } 134 }
130 135
131 } // namespace 136 } // namespace
132 137
133 // static 138 // static
134 std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated( 139 std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated(
135 FrameTreeNode* frame_tree_node, 140 FrameTreeNode* frame_tree_node,
136 const GURL& dest_url, 141 const GURL& dest_url,
137 const Referrer& dest_referrer, 142 const Referrer& dest_referrer,
138 const FrameNavigationEntry& frame_entry, 143 const FrameNavigationEntry& frame_entry,
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); 593 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture);
589 594
590 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 595 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
591 common_params_, request_params_, 596 common_params_, request_params_,
592 is_view_source_); 597 is_view_source_);
593 598
594 frame_tree_node_->ResetNavigationRequest(true); 599 frame_tree_node_->ResetNavigationRequest(true);
595 } 600 }
596 601
597 } // namespace content 602 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/security/upgrade-insecure-requests/https-header-top-level-browser-initiated.php » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698