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 #ifndef NET_HTTP_RESPONSE_HEADERS_H_ | 5 #ifndef NET_HTTP_RESPONSE_HEADERS_H_ |
6 #define NET_HTTP_RESPONSE_HEADERS_H_ | 6 #define NET_HTTP_RESPONSE_HEADERS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 219 |
220 // Helper function for ParseStatusLine. | 220 // Helper function for ParseStatusLine. |
221 // Tries to extract the "HTTP/X.Y" from a status line formatted like: | 221 // Tries to extract the "HTTP/X.Y" from a status line formatted like: |
222 // HTTP/1.1 200 OK | 222 // HTTP/1.1 200 OK |
223 // with line_begin and end pointing at the begin and end of this line. If the | 223 // with line_begin and end pointing at the begin and end of this line. If the |
224 // status line is malformed, returns HttpVersion(0,0). | 224 // status line is malformed, returns HttpVersion(0,0). |
225 static HttpVersion ParseVersion(std::string::const_iterator line_begin, | 225 static HttpVersion ParseVersion(std::string::const_iterator line_begin, |
226 std::string::const_iterator line_end); | 226 std::string::const_iterator line_end); |
227 | 227 |
228 // Tries to extract the status line from a header block, given the first | 228 // Tries to extract the status line from a header block, given the first |
229 // line of said header block. If the status line is malformed, we'll construc
t | 229 // line of said header block. If the status line is malformed, we'll |
230 // a valid one. Example input: | 230 // construct a valid one. Example input: |
231 // HTTP/1.1 200 OK | 231 // HTTP/1.1 200 OK |
232 // with line_begin and end pointing at the begin and end of this line. | 232 // with line_begin and end pointing at the begin and end of this line. |
233 // Output will be a normalized version of this, with a trailing \n. | 233 // Output will be a normalized version of this, with a trailing \n. |
234 void ParseStatusLine(std::string::const_iterator line_begin, | 234 void ParseStatusLine(std::string::const_iterator line_begin, |
235 std::string::const_iterator line_end, | 235 std::string::const_iterator line_end, |
236 bool has_headers); | 236 bool has_headers); |
237 | 237 |
238 // Find the header in our list (case-insensitive) starting with parsed_ at | 238 // Find the header in our list (case-insensitive) starting with parsed_ at |
239 // index |from|. Returns string::npos if not found. | 239 // index |from|. Returns string::npos if not found. |
240 size_t FindHeader(size_t from, const std::string& name) const; | 240 size_t FindHeader(size_t from, const std::string& name) const; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 302 |
303 // The parsed http version number (not normalized). | 303 // The parsed http version number (not normalized). |
304 HttpVersion parsed_http_version_; | 304 HttpVersion parsed_http_version_; |
305 | 305 |
306 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); | 306 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); |
307 }; | 307 }; |
308 | 308 |
309 } // namespace net | 309 } // namespace net |
310 | 310 |
311 #endif // NET_HTTP_RESPONSE_HEADERS_H_ | 311 #endif // NET_HTTP_RESPONSE_HEADERS_H_ |
OLD | NEW |