Commit 4d3cf41c authored by Arthur Sonzogni's avatar Arthur Sonzogni Committed by Commit Bot

WebRequestProxyingURLLoader: Close the current loader before internal redirect.

Please see the explanation here:
https://bugs.chromium.org/p/chromium/issues/detail?id=882661#c72

Generating a fake internal redirect causes conflicts with what the
current URLLoader is doing. The latter doesn't know anything about the
redirect. To work properly, the current URLLoader must be destroyed
first. The current code automatically handles creating a new
URLLoader after FollowRedirect().

Bug: 882661
Change-Id: Ib17dc2f29a2c63da735794b4792ef7805e7dbc58
Reviewed-on: https://chromium-review.googlesource.com/c/1326481
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Reviewed-by: default avatarClark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606792}
parent 0cd41aa3
......@@ -244,6 +244,17 @@ void WebRequestProxyingURLLoaderFactory::InProgressRequest::
}
if (!redirect_url_.is_empty()) {
// The extension requested a redirect. Close the connexion with the current
// URLLoader and inform the URLLoaderClient the WebRequest API generated a
// redirect. To load |redirect_url_|, a new URLLoader will be recreated
// after receiving FollowRedirect().
// Forgetting to close the connexion with the current URLLoader caused bugs.
// The latter doesn't know anything about the redirect. Continuing the load
// with it gives unexpected results. See https://crbug.com/882661#c72.
proxied_client_binding_.Close();
target_loader_.reset();
constexpr int kInternalRedirectStatusCode = 307;
net::RedirectInfo redirect_info;
......
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