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

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2053693002: WIP: Move 'Upgrade-Insecure-Requests' to the browser process. Base URL: https://chromium.googlesource.com/chromium/src.git@replicate
Patch Set: 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
Index: content/browser/loader/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index 50153c6706bfa0951f8506161aa063702a7069b1..9b34213b12e5f78b1e344f6767170edd07be7f3b 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -119,6 +119,8 @@
#include "storage/browser/blob/shareable_file_reference.h"
#include "storage/browser/fileapi/file_permission_policy.h"
#include "storage/browser/fileapi/file_system_context.h"
+#include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h"
+#include "ui/base/page_transition_types.h"
#include "url/url_constants.h"
using base::Time;
@@ -1469,6 +1471,10 @@ void ResourceDispatcherHostImpl::BeginRequest(
new_request->set_first_party_for_cookies(
request_data.first_party_for_cookies);
new_request->set_initiator(request_data.request_initiator);
+ if (request_data.insecure_request_policy & blink::kUpgradeInsecureRequests) {
+ new_request->set_insecure_request_policy(
+ net::URLRequest::UPGRADE_ALL_INSECURE_REQUESTS);
mmenke 2016/06/09 18:56:55 Does this have to be a member of the URLRequest?.
Mike West 2016/06/10 09:55:16 This seems like the best approach if you want to k
+ }
if (request_data.originated_from_service_worker) {
new_request->SetUserData(URLRequestServiceWorkerData::kUserDataKey,
@@ -2238,6 +2244,16 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest(
new_request->set_first_party_for_cookies(
info.first_party_for_cookies);
new_request->set_initiator(info.request_initiator);
+ if (info.should_upgrade_to_secure_transport) {
+ net::URLRequest::InsecureRequestPolicy policy =
+ net::URLRequest::UPGRADE_ALL_INSECURE_REQUESTS;
+ if (info.is_main_frame &&
+ info.common_params.transition !=
+ ui::PageTransition::PAGE_TRANSITION_FORM_SUBMIT) {
+ policy = net::URLRequest::UPGRADE_SAME_HOST_INSECURE_REQUESTS;
+ }
+ new_request->set_insecure_request_policy(policy);
+ }
mmenke 2016/06/14 18:49:31 I'm not following how the "UPGRADE_SAME_HOST_INSEC
if (info.is_main_frame) {
new_request->set_first_party_url_policy(
net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT);

Powered by Google App Engine
This is Rietveld 408576698