| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 #ifndef NET_HTTP_HTTP_UTIL_H_ | 5 #ifndef NET_HTTP_HTTP_UTIL_H_ |
| 6 #define NET_HTTP_HTTP_UTIL_H_ | 6 #define NET_HTTP_HTTP_UTIL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/string_tokenizer.h" | 10 #include "base/string_tokenizer.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 // Scans the headers and look for the first "Range" header in |headers|, | 48 // Scans the headers and look for the first "Range" header in |headers|, |
| 49 // if "Range" exists and the first one of it is well formatted then returns | 49 // if "Range" exists and the first one of it is well formatted then returns |
| 50 // true, |ranges| will contain a list of valid ranges. If return | 50 // true, |ranges| will contain a list of valid ranges. If return |
| 51 // value is false then values in |ranges| should not be used. The format of | 51 // value is false then values in |ranges| should not be used. The format of |
| 52 // "Range" header is defined in RFC 2616 Section 14.35.1. | 52 // "Range" header is defined in RFC 2616 Section 14.35.1. |
| 53 // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1 | 53 // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1 |
| 54 static bool ParseRanges(const std::string& headers, | 54 static bool ParseRanges(const std::string& headers, |
| 55 std::vector<HttpByteRange>* ranges); | 55 std::vector<HttpByteRange>* ranges); |
| 56 | 56 |
| 57 // Same thing as ParseRanges except the Range header is known and its value |
| 58 // is directly passed in, rather than requiring searching through a string. |
| 59 static bool ParseRangeHeader(const std::string& range_specifier, |
| 60 std::vector<HttpByteRange>* ranges); |
| 61 |
| 57 // Scans the '\r\n'-delimited headers for the given header name. Returns | 62 // Scans the '\r\n'-delimited headers for the given header name. Returns |
| 58 // true if a match is found. Input is assumed to be well-formed. | 63 // true if a match is found. Input is assumed to be well-formed. |
| 59 // TODO(darin): kill this | 64 // TODO(darin): kill this |
| 60 static bool HasHeader(const std::string& headers, const char* name); | 65 static bool HasHeader(const std::string& headers, const char* name); |
| 61 | 66 |
| 62 // Strips all header lines from |headers| whose name matches | 67 // Strips all header lines from |headers| whose name matches |
| 63 // |headers_to_remove|. |headers_to_remove| is a list of null-terminated | 68 // |headers_to_remove|. |headers_to_remove| is a list of null-terminated |
| 64 // lower-case header names, with array length |headers_to_remove_len|. | 69 // lower-case header names, with array length |headers_to_remove_len|. |
| 65 // Returns the stripped header lines list, separated by "\r\n". | 70 // Returns the stripped header lines list, separated by "\r\n". |
| 66 static std::string StripHeaders(const std::string& headers, | 71 static std::string StripHeaders(const std::string& headers, |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 private: | 244 private: |
| 240 StringTokenizer values_; | 245 StringTokenizer values_; |
| 241 std::string::const_iterator value_begin_; | 246 std::string::const_iterator value_begin_; |
| 242 std::string::const_iterator value_end_; | 247 std::string::const_iterator value_end_; |
| 243 }; | 248 }; |
| 244 }; | 249 }; |
| 245 | 250 |
| 246 } // namespace net | 251 } // namespace net |
| 247 | 252 |
| 248 #endif // NET_HTTP_HTTP_UTIL_H_ | 253 #endif // NET_HTTP_HTTP_UTIL_H_ |
| OLD | NEW |