| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 // Scans the '\r\n'-delimited headers for the given header name. Returns | 69 // Scans the '\r\n'-delimited headers for the given header name. Returns |
| 70 // true if a match is found. Input is assumed to be well-formed. | 70 // true if a match is found. Input is assumed to be well-formed. |
| 71 // TODO(darin): kill this | 71 // TODO(darin): kill this |
| 72 static bool HasHeader(const std::string& headers, const char* name); | 72 static bool HasHeader(const std::string& headers, const char* name); |
| 73 | 73 |
| 74 // Returns true if it is safe to allow users and scripts to specify the header | 74 // Returns true if it is safe to allow users and scripts to specify the header |
| 75 // named |name|. | 75 // named |name|. |
| 76 static bool IsSafeHeader(const std::string& name); | 76 static bool IsSafeHeader(const std::string& name); |
| 77 | 77 |
| 78 // Returns true if |name| is a valid HTTP header name. |
| 79 static bool IsValidHeaderName(const std::string& name); |
| 80 |
| 81 // Returns false if |value| contains NUL or CRLF. This method does not perform |
| 82 // a fully RFC-2616-compliant header value validation. |
| 83 static bool IsValidHeaderValue(const std::string& value); |
| 84 |
| 78 // Strips all header lines from |headers| whose name matches | 85 // Strips all header lines from |headers| whose name matches |
| 79 // |headers_to_remove|. |headers_to_remove| is a list of null-terminated | 86 // |headers_to_remove|. |headers_to_remove| is a list of null-terminated |
| 80 // lower-case header names, with array length |headers_to_remove_len|. | 87 // lower-case header names, with array length |headers_to_remove_len|. |
| 81 // Returns the stripped header lines list, separated by "\r\n". | 88 // Returns the stripped header lines list, separated by "\r\n". |
| 82 static std::string StripHeaders(const std::string& headers, | 89 static std::string StripHeaders(const std::string& headers, |
| 83 const char* const headers_to_remove[], | 90 const char* const headers_to_remove[], |
| 84 size_t headers_to_remove_len); | 91 size_t headers_to_remove_len); |
| 85 | 92 |
| 86 // Multiple occurances of some headers cannot be coalesced into a comma- | 93 // Multiple occurances of some headers cannot be coalesced into a comma- |
| 87 // separated list since their values are (or contain) unquoted HTTP-date | 94 // separated list since their values are (or contain) unquoted HTTP-date |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 // into the original's unquoted_value_ member. | 357 // into the original's unquoted_value_ member. |
| 351 std::string unquoted_value_; | 358 std::string unquoted_value_; |
| 352 | 359 |
| 353 bool value_is_quoted_; | 360 bool value_is_quoted_; |
| 354 }; | 361 }; |
| 355 }; | 362 }; |
| 356 | 363 |
| 357 } // namespace net | 364 } // namespace net |
| 358 | 365 |
| 359 #endif // NET_HTTP_HTTP_UTIL_H_ | 366 #endif // NET_HTTP_HTTP_UTIL_H_ |
| OLD | NEW |