| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 public: | 152 public: |
| 153 HeadersIterator(std::string::const_iterator headers_begin, | 153 HeadersIterator(std::string::const_iterator headers_begin, |
| 154 std::string::const_iterator headers_end, | 154 std::string::const_iterator headers_end, |
| 155 const std::string& line_delimiter); | 155 const std::string& line_delimiter); |
| 156 | 156 |
| 157 // Advances the iterator to the next header, if any. Returns true if there | 157 // Advances the iterator to the next header, if any. Returns true if there |
| 158 // is a next header. Use name* and values* methods to access the resultant | 158 // is a next header. Use name* and values* methods to access the resultant |
| 159 // header name and values. | 159 // header name and values. |
| 160 bool GetNext(); | 160 bool GetNext(); |
| 161 | 161 |
| 162 // Iterates through the list of headers, starting with the current position |
| 163 // and looks for the specified header. Note that the name _must_ be |
| 164 // lower cased. |
| 165 // If the header was found, the return value will be true and the current |
| 166 // position points to the header. If the return value is false, the |
| 167 // current position will be at the end of the headers. |
| 168 bool AdvanceTo(const char* lowercase_name); |
| 169 |
| 162 std::string::const_iterator name_begin() const { | 170 std::string::const_iterator name_begin() const { |
| 163 return name_begin_; | 171 return name_begin_; |
| 164 } | 172 } |
| 165 std::string::const_iterator name_end() const { | 173 std::string::const_iterator name_end() const { |
| 166 return name_end_; | 174 return name_end_; |
| 167 } | 175 } |
| 168 std::string name() const { | 176 std::string name() const { |
| 169 return std::string(name_begin_, name_end_); | 177 return std::string(name_begin_, name_end_); |
| 170 } | 178 } |
| 171 | 179 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 private: | 229 private: |
| 222 StringTokenizer values_; | 230 StringTokenizer values_; |
| 223 std::string::const_iterator value_begin_; | 231 std::string::const_iterator value_begin_; |
| 224 std::string::const_iterator value_end_; | 232 std::string::const_iterator value_end_; |
| 225 }; | 233 }; |
| 226 }; | 234 }; |
| 227 | 235 |
| 228 } // namespace net | 236 } // namespace net |
| 229 | 237 |
| 230 #endif // NET_HTTP_HTTP_UTIL_H_ | 238 #endif // NET_HTTP_HTTP_UTIL_H_ |
| OLD | NEW |