| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "webkit/glue/multipart_response_delegate.h" | 5 #include "webkit/glue/multipart_response_delegate.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 335 |
| 336 // Skip over the initial space. | 336 // Skip over the initial space. |
| 337 byte_range_lower_bound_start_offset++; | 337 byte_range_lower_bound_start_offset++; |
| 338 | 338 |
| 339 size_t byte_range_lower_bound_end_offset = | 339 size_t byte_range_lower_bound_end_offset = |
| 340 content_range.find("-", byte_range_lower_bound_start_offset); | 340 content_range.find("-", byte_range_lower_bound_start_offset); |
| 341 if (byte_range_lower_bound_end_offset == std::string::npos) { | 341 if (byte_range_lower_bound_end_offset == std::string::npos) { |
| 342 return false; | 342 return false; |
| 343 } | 343 } |
| 344 | 344 |
| 345 size_t byte_range_lower_bound_characters = | |
| 346 byte_range_lower_bound_end_offset - byte_range_lower_bound_start_offset; | |
| 347 std::string byte_range_lower_bound = | |
| 348 content_range.substr(byte_range_lower_bound_start_offset, | |
| 349 byte_range_lower_bound_characters); | |
| 350 | |
| 351 size_t byte_range_upper_bound_start_offset = | 345 size_t byte_range_upper_bound_start_offset = |
| 352 byte_range_lower_bound_end_offset + 1; | 346 byte_range_lower_bound_end_offset + 1; |
| 353 | 347 |
| 354 size_t byte_range_upper_bound_end_offset = | 348 size_t byte_range_upper_bound_end_offset = |
| 355 content_range.find("/", byte_range_upper_bound_start_offset); | 349 content_range.find("/", byte_range_upper_bound_start_offset); |
| 356 if (byte_range_upper_bound_end_offset == std::string::npos) { | 350 if (byte_range_upper_bound_end_offset == std::string::npos) { |
| 357 return false; | 351 return false; |
| 358 } | 352 } |
| 359 | 353 |
| 360 size_t byte_range_upper_bound_characters = | 354 if (!base::StringToInt( |
| 361 byte_range_upper_bound_end_offset - byte_range_upper_bound_start_offset; | 355 content_range.begin() + byte_range_lower_bound_start_offset, |
| 356 content_range.begin() + byte_range_lower_bound_end_offset, |
| 357 content_range_lower_bound)) |
| 358 return false; |
| 362 | 359 |
| 363 std::string byte_range_upper_bound = | 360 if (!base::StringToInt( |
| 364 content_range.substr(byte_range_upper_bound_start_offset, | 361 content_range.begin() + byte_range_upper_bound_start_offset, |
| 365 byte_range_upper_bound_characters); | 362 content_range.begin() + byte_range_upper_bound_end_offset, |
| 366 | 363 content_range_upper_bound)) |
| 367 if (!base::StringToInt(byte_range_lower_bound, content_range_lower_bound)) | |
| 368 return false; | |
| 369 if (!base::StringToInt(byte_range_upper_bound, content_range_upper_bound)) | |
| 370 return false; | 364 return false; |
| 371 return true; | 365 return true; |
| 372 } | 366 } |
| 373 | 367 |
| 374 } // namespace webkit_glue | 368 } // namespace webkit_glue |
| OLD | NEW |