| 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/http/partial_data.h" | 5 #include "net/http/partial_data.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 if (headers->response_code() == 304) { | 267 if (headers->response_code() == 304) { |
| 268 if (!byte_range_.IsValid() || truncated_) | 268 if (!byte_range_.IsValid() || truncated_) |
| 269 return true; | 269 return true; |
| 270 | 270 |
| 271 // We must have a complete range here. | 271 // We must have a complete range here. |
| 272 return byte_range_.HasFirstBytePosition() && | 272 return byte_range_.HasFirstBytePosition() && |
| 273 byte_range_.HasLastBytePosition(); | 273 byte_range_.HasLastBytePosition(); |
| 274 } | 274 } |
| 275 | 275 |
| 276 int64_t start, end, total_length; | 276 int64_t start, end, total_length; |
| 277 if (!headers->GetContentRange(&start, &end, &total_length)) | 277 if (!headers->GetContentRangeFor206(&start, &end, &total_length)) |
| 278 return false; | 278 return false; |
| 279 if (total_length <= 0) | 279 if (total_length <= 0) |
| 280 return false; | 280 return false; |
| 281 | 281 |
| 282 DCHECK_EQ(headers->response_code(), 206); | 282 DCHECK_EQ(headers->response_code(), 206); |
| 283 | 283 |
| 284 // A server should return a valid content length with a 206 (per the standard) | 284 // A server should return a valid content length with a 206 (per the standard) |
| 285 // but relax the requirement because some servers don't do that. | 285 // but relax the requirement because some servers don't do that. |
| 286 int64_t content_length = headers->GetContentLength(); | 286 int64_t content_length = headers->GetContentLength(); |
| 287 if (content_length > 0 && content_length != end - start + 1) | 287 if (content_length > 0 && content_length != end - start + 1) |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 cached_min_len_ = result; | 435 cached_min_len_ = result; |
| 436 if (result >= 0) | 436 if (result >= 0) |
| 437 result = 1; // Return success, go ahead and validate the entry. | 437 result = 1; // Return success, go ahead and validate the entry. |
| 438 | 438 |
| 439 CompletionCallback cb = callback_; | 439 CompletionCallback cb = callback_; |
| 440 callback_.Reset(); | 440 callback_.Reset(); |
| 441 cb.Run(result); | 441 cb.Run(result); |
| 442 } | 442 } |
| 443 | 443 |
| 444 } // namespace net | 444 } // namespace net |
| OLD | NEW |