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

Unified Diff: net/url_request/url_request.cc

Issue 155897: Add support to URLRequest for deferring redirects.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months 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 side-by-side diff with in-line comments
Download patch
Index: net/url_request/url_request.cc
===================================================================
--- net/url_request/url_request.cc (revision 21335)
+++ net/url_request/url_request.cc (working copy)
@@ -252,6 +252,7 @@
job_->SetUpload(upload_.get());
is_pending_ = true;
+
response_info_.request_time = Time::Now();
response_info_.was_cached = false;
@@ -270,6 +271,7 @@
void URLRequest::RestartWithJob(URLRequestJob *job) {
DCHECK(job->request() == this);
+ job_->Kill();
OrphanJob();
status_ = URLRequestStatus();
is_pending_ = false;
@@ -335,12 +337,12 @@
return job_->Read(dest, dest_size, bytes_read);
}
-void URLRequest::ReceivedRedirect(const GURL& location) {
+void URLRequest::ReceivedRedirect(const GURL& location, bool* defer_redirect) {
URLRequestJob* job = GetJobManager()->MaybeInterceptRedirect(this, location);
if (job) {
RestartWithJob(job);
} else if (delegate_) {
- delegate_->OnReceivedRedirect(this, location);
+ delegate_->OnReceivedRedirect(this, location, defer_redirect);
}
}
@@ -353,6 +355,12 @@
}
}
+void URLRequest::FollowDeferredRedirect() {
+ DCHECK(job_);
+
+ job_->FollowDeferredRedirect();
+}
+
void URLRequest::SetAuth(const wstring& username, const wstring& password) {
DCHECK(job_);
DCHECK(job_->NeedsAuth());
@@ -423,7 +431,6 @@
}
url_ = location;
upload_ = NULL;
- status_ = URLRequestStatus();
--redirect_limit_;
if (strip_post_specific_headers) {
@@ -442,8 +449,10 @@
final_upload_progress_ = job_->GetUploadProgress();
}
+ job_->Kill();
OrphanJob();
+ status_ = URLRequestStatus();
is_pending_ = false;
Start();
return net::OK;

Powered by Google App Engine
This is Rietveld 408576698