OLD | NEW |
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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/power_monitor/power_monitor.h" | 10 #include "base/power_monitor/power_monitor.h" |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 // new one has none. This duplicates mozilla's behavior. | 312 // new one has none. This duplicates mozilla's behavior. |
313 if (url.is_valid() && url.has_ref() && !new_location.has_ref()) { | 313 if (url.is_valid() && url.has_ref() && !new_location.has_ref()) { |
314 GURL::Replacements replacements; | 314 GURL::Replacements replacements; |
315 // Reference the |ref| directly out of the original URL to avoid a | 315 // Reference the |ref| directly out of the original URL to avoid a |
316 // malloc. | 316 // malloc. |
317 replacements.SetRef(url.spec().data(), | 317 replacements.SetRef(url.spec().data(), |
318 url.parsed_for_possibly_invalid_spec().ref); | 318 url.parsed_for_possibly_invalid_spec().ref); |
319 new_location = new_location.ReplaceComponents(replacements); | 319 new_location = new_location.ReplaceComponents(replacements); |
320 } | 320 } |
321 | 321 |
| 322 // Redirect response bodies are not read. Notify the transaction |
| 323 // so it does not treat being stopped as an error. |
| 324 DoneReading(); |
| 325 |
322 bool defer_redirect = false; | 326 bool defer_redirect = false; |
323 request_->NotifyReceivedRedirect(new_location, &defer_redirect); | 327 request_->NotifyReceivedRedirect(new_location, &defer_redirect); |
324 | 328 |
325 // Ensure that the request wasn't detached or destroyed in | 329 // Ensure that the request wasn't detached or destroyed in |
326 // NotifyReceivedRedirect | 330 // NotifyReceivedRedirect |
327 if (!request_ || !request_->has_delegate()) | 331 if (!request_ || !request_->has_delegate()) |
328 return; | 332 return; |
329 | 333 |
330 // If we were not cancelled, then maybe follow the redirect. | 334 // If we were not cancelled, then maybe follow the redirect. |
331 if (request_->status().is_success()) { | 335 if (request_->status().is_success()) { |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 } | 731 } |
728 | 732 |
729 bool URLRequestJob::FilterHasData() { | 733 bool URLRequestJob::FilterHasData() { |
730 return filter_.get() && filter_->stream_data_len(); | 734 return filter_.get() && filter_->stream_data_len(); |
731 } | 735 } |
732 | 736 |
733 void URLRequestJob::UpdatePacketReadTimes() { | 737 void URLRequestJob::UpdatePacketReadTimes() { |
734 } | 738 } |
735 | 739 |
736 } // namespace net | 740 } // namespace net |
OLD | NEW |