Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Side by Side Diff: net/url_request/url_request_job.cc

Issue 11364057: Set blocked_on_delegate_ when a URLRequest is blocked during redirects (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix comment Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/url_request/url_request_job.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/url_request/url_request_job.h" 5 #include "net/url_request/url_request_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 void URLRequestJob::FollowDeferredRedirect() { 184 void URLRequestJob::FollowDeferredRedirect() {
185 DCHECK(deferred_redirect_status_code_ != -1); 185 DCHECK(deferred_redirect_status_code_ != -1);
186 186
187 // NOTE: deferred_redirect_url_ may be invalid, and attempting to redirect to 187 // NOTE: deferred_redirect_url_ may be invalid, and attempting to redirect to
188 // such an URL will fail inside FollowRedirect. The DCHECK above asserts 188 // such an URL will fail inside FollowRedirect. The DCHECK above asserts
189 // that we called OnReceivedRedirect. 189 // that we called OnReceivedRedirect.
190 190
191 // It is also possible that FollowRedirect will drop the last reference to 191 // It is also possible that FollowRedirect will drop the last reference to
192 // this job, so we need to reset our members before calling it. 192 // this job, so we need to reset our members before calling it.
193 193
194 SetUnblockedOnDelegate();
195
194 GURL redirect_url = deferred_redirect_url_; 196 GURL redirect_url = deferred_redirect_url_;
195 int redirect_status_code = deferred_redirect_status_code_; 197 int redirect_status_code = deferred_redirect_status_code_;
196 198
197 deferred_redirect_url_ = GURL(); 199 deferred_redirect_url_ = GURL();
198 deferred_redirect_status_code_ = -1; 200 deferred_redirect_status_code_ = -1;
199 201
200 FollowRedirect(redirect_url, redirect_status_code); 202 FollowRedirect(redirect_url, redirect_status_code);
201 } 203 }
202 204
203 bool URLRequestJob::GetMimeType(std::string* mime_type) const { 205 bool URLRequestJob::GetMimeType(std::string* mime_type) const {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // Ensure that the request wasn't detached or destroyed in 302 // Ensure that the request wasn't detached or destroyed in
301 // NotifyReceivedRedirect 303 // NotifyReceivedRedirect
302 if (!request_ || !request_->has_delegate()) 304 if (!request_ || !request_->has_delegate())
303 return; 305 return;
304 306
305 // If we were not cancelled, then maybe follow the redirect. 307 // If we were not cancelled, then maybe follow the redirect.
306 if (request_->status().is_success()) { 308 if (request_->status().is_success()) {
307 if (defer_redirect) { 309 if (defer_redirect) {
308 deferred_redirect_url_ = new_location; 310 deferred_redirect_url_ = new_location;
309 deferred_redirect_status_code_ = http_status_code; 311 deferred_redirect_status_code_ = http_status_code;
312 SetBlockedOnDelegate();
310 } else { 313 } else {
311 FollowRedirect(new_location, http_status_code); 314 FollowRedirect(new_location, http_status_code);
312 } 315 }
313 return; 316 return;
314 } 317 }
315 } else if (NeedsAuth()) { 318 } else if (NeedsAuth()) {
316 scoped_refptr<AuthChallengeInfo> auth_info; 319 scoped_refptr<AuthChallengeInfo> auth_info;
317 GetAuthChallengeInfo(&auth_info); 320 GetAuthChallengeInfo(&auth_info);
318 // Need to check for a NULL auth_info because the server may have failed 321 // Need to check for a NULL auth_info because the server may have failed
319 // to send a challenge with the 401 response. 322 // to send a challenge with the 401 response.
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 } 702 }
700 703
701 bool URLRequestJob::FilterHasData() { 704 bool URLRequestJob::FilterHasData() {
702 return filter_.get() && filter_->stream_data_len(); 705 return filter_.get() && filter_->stream_data_len();
703 } 706 }
704 707
705 void URLRequestJob::UpdatePacketReadTimes() { 708 void URLRequestJob::UpdatePacketReadTimes() {
706 } 709 }
707 710
708 } // namespace net 711 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_job.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698