OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // The rules for parsing content-types were borrowed from Firefox: | 5 // The rules for parsing content-types were borrowed from Firefox: |
6 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 | 6 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 |
7 | 7 |
8 #include "net/http/http_util.h" | 8 #include "net/http/http_util.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 range.set_suffix_length(last_byte_position); | 274 range.set_suffix_length(last_byte_position); |
275 } else if (!range.HasFirstBytePosition()) { | 275 } else if (!range.HasFirstBytePosition()) { |
276 return false; | 276 return false; |
277 } | 277 } |
278 | 278 |
279 // Do a final check on the HttpByteRange object. | 279 // Do a final check on the HttpByteRange object. |
280 if (!range.IsValid()) | 280 if (!range.IsValid()) |
281 return false; | 281 return false; |
282 ranges->push_back(range); | 282 ranges->push_back(range); |
283 } | 283 } |
284 return ranges->size() > 0; | 284 return !ranges->empty(); |
285 } | 285 } |
286 | 286 |
287 // static | 287 // static |
288 bool HttpUtil::HasHeader(const std::string& headers, const char* name) { | 288 bool HttpUtil::HasHeader(const std::string& headers, const char* name) { |
289 size_t name_len = strlen(name); | 289 size_t name_len = strlen(name); |
290 string::const_iterator it = | 290 string::const_iterator it = |
291 std::search(headers.begin(), | 291 std::search(headers.begin(), |
292 headers.end(), | 292 headers.end(), |
293 name, | 293 name, |
294 name + name_len, | 294 name + name_len, |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 value_is_quoted_ = true; | 868 value_is_quoted_ = true; |
869 // Do not store iterators into this. See declaration of unquoted_value_. | 869 // Do not store iterators into this. See declaration of unquoted_value_. |
870 unquoted_value_ = HttpUtil::Unquote(value_begin_, value_end_); | 870 unquoted_value_ = HttpUtil::Unquote(value_begin_, value_end_); |
871 } | 871 } |
872 } | 872 } |
873 | 873 |
874 return true; | 874 return true; |
875 } | 875 } |
876 | 876 |
877 } // namespace net | 877 } // namespace net |
OLD | NEW |