Index: content/browser/frame_host/navigation_request.cc |
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc |
index 769c8689b1695005ed175547955cd16fcdd0109c..4c168e95e7c800182c9d260d2d0051e1e6af3201 100644 |
--- a/content/browser/frame_host/navigation_request.cc |
+++ b/content/browser/frame_host/navigation_request.cc |
@@ -7,7 +7,6 @@ |
#include "content/browser/frame_host/frame_tree.h" |
#include "content/browser/frame_host/frame_tree_node.h" |
#include "content/browser/frame_host/navigation_controller_impl.h" |
-#include "content/browser/frame_host/navigation_handle_impl.h" |
#include "content/browser/frame_host/navigation_request_info.h" |
#include "content/browser/frame_host/navigator.h" |
#include "content/browser/loader/navigation_url_loader.h" |
@@ -285,7 +284,8 @@ void NavigationRequest::OnRequestStarted(base::TimeTicks timestamp) { |
} |
void NavigationRequest::OnStartChecksComplete( |
- NavigationThrottle::ThrottleCheckResult result) { |
+ NavigationThrottle::ThrottleCheckResult result, |
+ const NavigationHandleImpl::ExtraHeadersList& extra_headers_list) { |
CHECK(result != NavigationThrottle::DEFER); |
// Abort the request if needed. This will destroy the NavigationRequest. |
@@ -296,6 +296,14 @@ void NavigationRequest::OnStartChecksComplete( |
return; |
} |
+ // Add extra headers to the request before sending it to the network stack. |
+ net::HttpRequestHeaders headers; |
+ headers.AddHeadersFromString(begin_params_.headers); |
+ for (const auto& header : extra_headers_list) |
+ headers.SetHeader(header.first, header.second); |
+ begin_params_.headers = headers.ToString(); |
+ info_->begin_params.headers = headers.ToString(); |
+ |
InitializeServiceWorkerHandleIfNeeded(); |
loader_ = NavigationURLLoader::Create( |
frame_tree_node_->navigator()->GetController()->GetBrowserContext(), |
@@ -303,7 +311,8 @@ void NavigationRequest::OnStartChecksComplete( |
} |
void NavigationRequest::OnRedirectChecksComplete( |
- NavigationThrottle::ThrottleCheckResult result) { |
+ NavigationThrottle::ThrottleCheckResult result, |
+ const NavigationHandleImpl::ExtraHeadersList& extra_headers_list) { |
CHECK(result != NavigationThrottle::DEFER); |
// Abort the request if needed. This will destroy the NavigationRequest. |
@@ -314,7 +323,7 @@ void NavigationRequest::OnRedirectChecksComplete( |
return; |
} |
- loader_->FollowRedirect(); |
+ loader_->FollowRedirect(extra_headers_list); |
navigation_handle_->DidRedirectNavigation(common_params_.url); |
} |