Index: net/url_request/url_request.cc |
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc |
index 690bc37fdf7ee3564644791223d481fe5778b4be..148c3e805515557f4cb015d6fd880c5fdc3afe00 100644 |
--- a/net/url_request/url_request.cc |
+++ b/net/url_request/url_request.cc |
@@ -917,8 +917,12 @@ void URLRequest::PrepareToRestart() { |
proxy_server_ = ProxyServer(); |
} |
-int URLRequest::Redirect(const RedirectInfo& redirect_info) { |
- // Matches call in NotifyReceivedRedirect. |
+void URLRequest::Redirect(const RedirectInfo& redirect_info) { |
+ // This method always succeeds. Whether |job_| is allowed to redirect to |
+ // |redirect_info| is checked in URLRequestJob::CanFollowRedirect, before |
+ // NotifyReceivedRedirect. This means the delegate can assume that, if it |
+ // accepted the redirect, future calls to OnResponseStarted correspond to |
+ // |redirect_info.new_url|. |
OnCallToDelegateComplete(); |
if (net_log_.IsCapturing()) { |
net_log_.AddEvent( |
@@ -930,19 +934,6 @@ int URLRequest::Redirect(const RedirectInfo& redirect_info) { |
if (network_delegate_) |
network_delegate_->NotifyBeforeRedirect(this, redirect_info.new_url); |
- if (redirect_limit_ <= 0) { |
- DVLOG(1) << "disallowing redirect: exceeds limit"; |
- return ERR_TOO_MANY_REDIRECTS; |
- } |
- |
- if (!redirect_info.new_url.is_valid()) |
- return ERR_INVALID_URL; |
- |
- if (!job_->IsSafeRedirect(redirect_info.new_url)) { |
- DVLOG(1) << "disallowing redirect: unsafe protocol"; |
- return ERR_UNSAFE_REDIRECT; |
- } |
- |
if (!final_upload_progress_.position() && upload_data_stream_) |
final_upload_progress_ = upload_data_stream_->GetUploadProgress(); |
PrepareToRestart(); |
@@ -997,7 +988,6 @@ int URLRequest::Redirect(const RedirectInfo& redirect_info) { |
--redirect_limit_; |
Start(); |
- return OK; |
} |
const URLRequestContext* URLRequest::context() const { |