| 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_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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 static std::string SpecForRequest(const GURL& url); | 33 static std::string SpecForRequest(const GURL& url); |
| 34 | 34 |
| 35 // Locates the next occurance of delimiter in line, skipping over quoted | 35 // Locates the next occurance of delimiter in line, skipping over quoted |
| 36 // strings (e.g., commas will not be treated as delimiters if they appear | 36 // strings (e.g., commas will not be treated as delimiters if they appear |
| 37 // within a quoted string). Returns the offset of the found delimiter or | 37 // within a quoted string). Returns the offset of the found delimiter or |
| 38 // line.size() if no delimiter was found. | 38 // line.size() if no delimiter was found. |
| 39 static size_t FindDelimiter(const std::string& line, | 39 static size_t FindDelimiter(const std::string& line, |
| 40 size_t search_start, | 40 size_t search_start, |
| 41 char delimiter); | 41 char delimiter); |
| 42 | 42 |
| 43 // Parses an "HTTP/X.Y" version from a string, such as: | |
| 44 // "HTTP/1.1" | |
| 45 // Returns whether or not the version string was successfully parsed. | |
| 46 static bool ParseVersion(const std::string& version_str, | |
| 47 HttpVersion* version); | |
| 48 | |
| 49 // Parses the value of a Content-Type header. The resulting mime_type and | 43 // Parses the value of a Content-Type header. The resulting mime_type and |
| 50 // charset values are normalized to lowercase. The mime_type and charset | 44 // charset values are normalized to lowercase. The mime_type and charset |
| 51 // output values are only modified if the content_type_str contains a mime | 45 // output values are only modified if the content_type_str contains a mime |
| 52 // type and charset value, respectively. The boundary output value is | 46 // type and charset value, respectively. The boundary output value is |
| 53 // optional and will be assigned the (quoted) value of the boundary | 47 // optional and will be assigned the (quoted) value of the boundary |
| 54 // paramter, if any. | 48 // paramter, if any. |
| 55 static void ParseContentType(const std::string& content_type_str, | 49 static void ParseContentType(const std::string& content_type_str, |
| 56 std::string* mime_type, | 50 std::string* mime_type, |
| 57 std::string* charset, | 51 std::string* charset, |
| 58 bool* had_charset, | 52 bool* had_charset, |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 // into the original's unquoted_value_ member. | 350 // into the original's unquoted_value_ member. |
| 357 std::string unquoted_value_; | 351 std::string unquoted_value_; |
| 358 | 352 |
| 359 bool value_is_quoted_; | 353 bool value_is_quoted_; |
| 360 }; | 354 }; |
| 361 }; | 355 }; |
| 362 | 356 |
| 363 } // namespace net | 357 } // namespace net |
| 364 | 358 |
| 365 #endif // NET_HTTP_HTTP_UTIL_H_ | 359 #endif // NET_HTTP_HTTP_UTIL_H_ |
| OLD | NEW |