Commit 091547fa authored by Reilly Grant's avatar Reilly Grant Committed by Commit Bot

Support header modifications in WebRequestProxyingURLLoaderFactory

This change adds support for handling the |to_be_removed_request_headers|
and |modified_request_headers| parameters to FollowRedirect(). The changes
are reflected in the stored request object and passed on to the underlying
URLLoader.

Bug: 880069
Change-Id: I5c79b358537c741467bd5e2d3a71d19cfa5dec42
Reviewed-on: https://chromium-review.googlesource.com/1207712Reviewed-by: default avatarKen Rockot <rockot@chromium.org>
Commit-Queue: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589001}
parent f5a01d26
...@@ -121,12 +121,19 @@ void WebRequestProxyingURLLoaderFactory::InProgressRequest::FollowRedirect( ...@@ -121,12 +121,19 @@ void WebRequestProxyingURLLoaderFactory::InProgressRequest::FollowRedirect(
const base::Optional<std::vector<std::string>>& const base::Optional<std::vector<std::string>>&
to_be_removed_request_headers, to_be_removed_request_headers,
const base::Optional<net::HttpRequestHeaders>& modified_request_headers) { const base::Optional<net::HttpRequestHeaders>& modified_request_headers) {
DCHECK(!modified_request_headers.has_value()) << "Redirect with modified " if (to_be_removed_request_headers) {
"headers was not supported " for (const std::string& header : *to_be_removed_request_headers)
"yet. crbug.com/845683"; request_.headers.RemoveHeader(header);
}
if (modified_request_headers)
request_.headers.MergeFrom(*modified_request_headers);
if (target_loader_.is_bound()) {
target_loader_->FollowRedirect(to_be_removed_request_headers,
modified_request_headers);
}
if (target_loader_.is_bound())
target_loader_->FollowRedirect(base::nullopt, base::nullopt);
Restart(); Restart();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment