summaryrefslogtreecommitdiffstats
path: root/net/url_request/url_request_job.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/url_request/url_request_job.cc')
-rw-r--r--net/url_request/url_request_job.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc
index f9043cc..4518d8a 100644
--- a/net/url_request/url_request_job.cc
+++ b/net/url_request/url_request_job.cc
@@ -10,6 +10,7 @@
#include "net/base/io_buffer.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
+#include "net/http/http_response_headers.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_job_metrics.h"
#include "net/url_request/url_request_job_tracker.h"
@@ -70,6 +71,22 @@ void URLRequestJob::SetupFilter() {
}
}
+bool URLRequestJob::IsRedirectResponse(GURL* location,
+ int* http_status_code) {
+ // For non-HTTP jobs, headers will be null.
+ net::HttpResponseHeaders* headers = request_->response_headers();
+ if (!headers)
+ return false;
+
+ std::string value;
+ if (!headers->IsRedirect(&value))
+ return false;
+
+ *location = request_->url().Resolve(value);
+ *http_status_code = headers->response_code();
+ return true;
+}
+
void URLRequestJob::GetAuthChallengeInfo(
scoped_refptr<net::AuthChallengeInfo>* auth_info) {
// This will only be called if NeedsAuth() returns true, in which