Add limit on request redirects (fixes issue #3001)
This commit is contained in:
parent
a5d88d697a
commit
11f37bc6eb
|
@ -229,6 +229,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
|
|||
const uint32_t options_;
|
||||
bool input_stream_previously_failed_ = false;
|
||||
bool request_was_redirected_ = false;
|
||||
int redirect_limit_ = net::URLRequest::kMaxRedirects;
|
||||
|
||||
// To avoid sending multiple OnReceivedError callbacks.
|
||||
bool sent_error_callback_ = false;
|
||||
|
@ -485,6 +486,11 @@ void InterceptedRequest::OnReceiveRedirect(
|
|||
needs_callback = true;
|
||||
}
|
||||
|
||||
if (--redirect_limit_ == 0) {
|
||||
SendErrorAndCompleteImmediately(net::ERR_TOO_MANY_REDIRECTS);
|
||||
return;
|
||||
}
|
||||
|
||||
net::RedirectInfo new_redirect_info;
|
||||
|
||||
// When we redirect via ContinueToHandleOverrideHeaders the |redirect_info|
|
||||
|
|
Loading…
Reference in New Issue