OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_RESPONSE_HEADERS_H_ | 5 #ifndef NET_HTTP_HTTP_RESPONSE_HEADERS_H_ |
6 #define NET_HTTP_HTTP_RESPONSE_HEADERS_H_ | 6 #define NET_HTTP_HTTP_RESPONSE_HEADERS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // with line_begin and end pointing at the begin and end of this line. If the | 271 // with line_begin and end pointing at the begin and end of this line. If the |
272 // status line is malformed, returns HttpVersion(0,0). | 272 // status line is malformed, returns HttpVersion(0,0). |
273 static HttpVersion ParseVersion(std::string::const_iterator line_begin, | 273 static HttpVersion ParseVersion(std::string::const_iterator line_begin, |
274 std::string::const_iterator line_end); | 274 std::string::const_iterator line_end); |
275 | 275 |
276 // Tries to extract the status line from a header block, given the first | 276 // Tries to extract the status line from a header block, given the first |
277 // line of said header block. If the status line is malformed, we'll | 277 // line of said header block. If the status line is malformed, we'll |
278 // construct a valid one. Example input: | 278 // construct a valid one. Example input: |
279 // HTTP/1.1 200 OK | 279 // HTTP/1.1 200 OK |
280 // with line_begin and end pointing at the begin and end of this line. | 280 // with line_begin and end pointing at the begin and end of this line. |
281 // Output will be a normalized version of this, with a trailing \n. | 281 // Output will be a normalized version of this. |
282 void ParseStatusLine(std::string::const_iterator line_begin, | 282 void ParseStatusLine(std::string::const_iterator line_begin, |
283 std::string::const_iterator line_end, | 283 std::string::const_iterator line_end, |
284 bool has_headers); | 284 bool has_headers); |
285 | 285 |
286 // Find the header in our list (case-insensitive) starting with parsed_ at | 286 // Find the header in our list (case-insensitive) starting with parsed_ at |
287 // index |from|. Returns string::npos if not found. | 287 // index |from|. Returns string::npos if not found. |
288 size_t FindHeader(size_t from, const std::string& name) const; | 288 size_t FindHeader(size_t from, const std::string& name) const; |
289 | 289 |
290 // Add a header->value pair to our list. If we already have header in our | 290 // Add a header->value pair to our list. If we already have header in our |
291 // list, append the value to it. | 291 // list, append the value to it. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 355 |
356 // The parsed http version number (not normalized). | 356 // The parsed http version number (not normalized). |
357 HttpVersion parsed_http_version_; | 357 HttpVersion parsed_http_version_; |
358 | 358 |
359 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); | 359 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); |
360 }; | 360 }; |
361 | 361 |
362 } // namespace net | 362 } // namespace net |
363 | 363 |
364 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ | 364 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ |
OLD | NEW |