| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 void Parse(const std::string& raw_input); | 300 void Parse(const std::string& raw_input); |
| 301 | 301 |
| 302 // Helper function for ParseStatusLine. | 302 // Helper function for ParseStatusLine. |
| 303 // Tries to extract the "HTTP/X.Y" from a status line formatted like: | 303 // Tries to extract the "HTTP/X.Y" from a status line formatted like: |
| 304 // HTTP/1.1 200 OK | 304 // HTTP/1.1 200 OK |
| 305 // with line_begin and end pointing at the begin and end of this line. If the | 305 // with line_begin and end pointing at the begin and end of this line. If the |
| 306 // status line is malformed, returns HttpVersion(0,0). | 306 // status line is malformed, returns HttpVersion(0,0). |
| 307 static HttpVersion ParseVersion(std::string::const_iterator line_begin, | 307 static HttpVersion ParseVersion(std::string::const_iterator line_begin, |
| 308 std::string::const_iterator line_end); | 308 std::string::const_iterator line_end); |
| 309 | 309 |
| 310 // Helper function for ParseVersion to handle multiple digits and leading |
| 311 // zeros in Http Version |
| 312 static bool ParseVersionInternal(std::string::const_iterator version_begin, |
| 313 std::string::const_iterator version_end, |
| 314 uint32* value); |
| 315 |
| 310 // Tries to extract the status line from a header block, given the first | 316 // Tries to extract the status line from a header block, given the first |
| 311 // line of said header block. If the status line is malformed, we'll | 317 // line of said header block. If the status line is malformed, we'll |
| 312 // construct a valid one. Example input: | 318 // construct a valid one. Example input: |
| 313 // HTTP/1.1 200 OK | 319 // HTTP/1.1 200 OK |
| 314 // with line_begin and end pointing at the begin and end of this line. | 320 // with line_begin and end pointing at the begin and end of this line. |
| 315 // Output will be a normalized version of this. | 321 // Output will be a normalized version of this. |
| 316 void ParseStatusLine(std::string::const_iterator line_begin, | 322 void ParseStatusLine(std::string::const_iterator line_begin, |
| 317 std::string::const_iterator line_end, | 323 std::string::const_iterator line_end, |
| 318 bool has_headers); | 324 bool has_headers); |
| 319 | 325 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 | 394 |
| 389 // The parsed http version number (not normalized). | 395 // The parsed http version number (not normalized). |
| 390 HttpVersion parsed_http_version_; | 396 HttpVersion parsed_http_version_; |
| 391 | 397 |
| 392 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); | 398 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); |
| 393 }; | 399 }; |
| 394 | 400 |
| 395 } // namespace net | 401 } // namespace net |
| 396 | 402 |
| 397 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ | 403 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ |
| OLD | NEW |