| Index: net/url_request/url_request_http_job.cc
|
| diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
|
| index 947686cb9f2d9184310d031780b0c46fb5265d62..18d61559d3396ddf481b844fe027b41379b91716 100644
|
| --- a/net/url_request/url_request_http_job.cc
|
| +++ b/net/url_request/url_request_http_job.cc
|
| @@ -289,6 +289,12 @@ void URLRequestHttpJob::Kill() {
|
| void URLRequestHttpJob::NotifyHeadersComplete() {
|
| DCHECK(!response_info_);
|
|
|
| + if (override_redirect_url_.is_valid()) {
|
| + // Ignore the remainder of the response and let NotifyHeadersComplete handle
|
| + // the redirect.
|
| + URLRequestJob::NotifyHeadersComplete();
|
| + return;
|
| + }
|
| response_info_ = transaction_->GetResponseInfo();
|
|
|
| // Save boolean, as we'll need this info at destruction time, and filters may
|
| @@ -805,9 +811,11 @@ void URLRequestHttpJob::OnStartCompleted(int result) {
|
| // |on_headers_received_callback_| or
|
| // |NetworkDelegate::URLRequestDestroyed()| has been called.
|
| OnCallToDelegate();
|
| + override_redirect_url_ = GURL();
|
| int error = network_delegate()->NotifyHeadersReceived(
|
| request_,
|
| on_headers_received_callback_,
|
| + &override_redirect_url_,
|
| headers.get(),
|
| &override_response_headers_);
|
| if (error != net::OK) {
|
| @@ -1030,6 +1038,16 @@ Filter* URLRequestHttpJob::SetupFilter() const {
|
| ? Filter::Factory(encoding_types, *filter_context_) : NULL;
|
| }
|
|
|
| +bool URLRequestHttpJob::IsRedirectResponse(GURL* location,
|
| + int* http_status_code) {
|
| + if (override_redirect_url_.is_valid()) {
|
| + *location = GURL(override_redirect_url_);
|
| + *http_status_code = 307;
|
| + return true;
|
| + }
|
| + return URLRequestJob::IsRedirectResponse(location, http_status_code);
|
| +}
|
| +
|
| bool URLRequestHttpJob::IsSafeRedirect(const GURL& location) {
|
| // HTTP is always safe.
|
| // TODO(pauljensen): Remove once crbug.com/146591 is fixed.
|
| @@ -1037,6 +1055,10 @@ bool URLRequestHttpJob::IsSafeRedirect(const GURL& location) {
|
| (location.scheme() == "http" || location.scheme() == "https")) {
|
| return true;
|
| }
|
| + // A redirect override specified by the delegate is always safe.
|
| + if (override_redirect_url_.is_valid()) {
|
| + return true;
|
| + }
|
| // Query URLRequestJobFactory as to whether |location| would be safe to
|
| // redirect to.
|
| return request_->context()->job_factory() &&
|
|
|