fix: notify URLLoaderClient about redirect inside intercepted protocol's handler (#23742)
* fix: notify URLLoaderClient about redirect inside intercepted protocol's handler * fix: update new_request's site_for_coookies * fix: Unound client, so it an be passed to sub-methods
This commit is contained in:
parent
5918dd6e65
commit
5218a6e6ab
1 changed files with 18 additions and 1 deletions
|
@ -236,8 +236,25 @@ void ElectronURLLoaderFactory::StartLoading(
|
||||||
// API in WebRequestProxyingURLLoaderFactory.
|
// API in WebRequestProxyingURLLoaderFactory.
|
||||||
std::string location;
|
std::string location;
|
||||||
if (head->headers->IsRedirect(&location)) {
|
if (head->headers->IsRedirect(&location)) {
|
||||||
|
GURL new_location = GURL(location);
|
||||||
|
net::SiteForCookies new_site_for_cookies =
|
||||||
|
net::SiteForCookies::FromUrl(new_location);
|
||||||
network::ResourceRequest new_request = request;
|
network::ResourceRequest new_request = request;
|
||||||
new_request.url = GURL(location);
|
new_request.url = new_location;
|
||||||
|
new_request.site_for_cookies = new_site_for_cookies;
|
||||||
|
|
||||||
|
net::RedirectInfo redirect_info;
|
||||||
|
redirect_info.status_code = head->headers->response_code();
|
||||||
|
redirect_info.new_method = request.method;
|
||||||
|
redirect_info.new_url = new_location;
|
||||||
|
redirect_info.new_site_for_cookies = new_site_for_cookies;
|
||||||
|
mojo::Remote<network::mojom::URLLoaderClient> client_remote(
|
||||||
|
std::move(client));
|
||||||
|
|
||||||
|
client_remote->OnReceiveRedirect(redirect_info, std::move(head));
|
||||||
|
|
||||||
|
// Unound client, so it an be passed to sub-methods
|
||||||
|
client = client_remote.Unbind();
|
||||||
// When the redirection comes from an intercepted scheme (which has
|
// When the redirection comes from an intercepted scheme (which has
|
||||||
// |proxy_factory| passed), we askes the proxy factory to create a loader
|
// |proxy_factory| passed), we askes the proxy factory to create a loader
|
||||||
// for new URL, otherwise we call |StartLoadingHttp|, which creates
|
// for new URL, otherwise we call |StartLoadingHttp|, which creates
|
||||||
|
|
Loading…
Reference in a new issue