| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // named |name|. | 76 // named |name|. |
| 77 static bool IsSafeHeader(const std::string& name); | 77 static bool IsSafeHeader(const std::string& name); |
| 78 | 78 |
| 79 // Returns true if |name| is a valid HTTP header name. | 79 // Returns true if |name| is a valid HTTP header name. |
| 80 static bool IsValidHeaderName(const std::string& name); | 80 static bool IsValidHeaderName(const std::string& name); |
| 81 | 81 |
| 82 // Returns false if |value| contains NUL or CRLF. This method does not perform | 82 // Returns false if |value| contains NUL or CRLF. This method does not perform |
| 83 // a fully RFC-2616-compliant header value validation. | 83 // a fully RFC-2616-compliant header value validation. |
| 84 static bool IsValidHeaderValue(const std::string& value); | 84 static bool IsValidHeaderValue(const std::string& value); |
| 85 | 85 |
| 86 // Returns true if |value| is a valid HTTP header value according to | |
| 87 // RFC 7230 and doesn't contain CR or LF. | |
| 88 // i.e. returns true if |value| matches |*field-content| in RFC 7230. | |
| 89 static bool IsValidHeaderValueRFC7230(const base::StringPiece& value); | |
| 90 | |
| 91 // Strips all header lines from |headers| whose name matches | 86 // Strips all header lines from |headers| whose name matches |
| 92 // |headers_to_remove|. |headers_to_remove| is a list of null-terminated | 87 // |headers_to_remove|. |headers_to_remove| is a list of null-terminated |
| 93 // lower-case header names, with array length |headers_to_remove_len|. | 88 // lower-case header names, with array length |headers_to_remove_len|. |
| 94 // Returns the stripped header lines list, separated by "\r\n". | 89 // Returns the stripped header lines list, separated by "\r\n". |
| 95 static std::string StripHeaders(const std::string& headers, | 90 static std::string StripHeaders(const std::string& headers, |
| 96 const char* const headers_to_remove[], | 91 const char* const headers_to_remove[], |
| 97 size_t headers_to_remove_len); | 92 size_t headers_to_remove_len); |
| 98 | 93 |
| 99 // Multiple occurances of some headers cannot be coalesced into a comma- | 94 // Multiple occurances of some headers cannot be coalesced into a comma- |
| 100 // separated list since their values are (or contain) unquoted HTTP-date | 95 // separated list since their values are (or contain) unquoted HTTP-date |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 // True if quotes values are required to be properly quoted; false if | 440 // True if quotes values are required to be properly quoted; false if |
| 446 // mismatched quotes and other problems with quoted values should be more | 441 // mismatched quotes and other problems with quoted values should be more |
| 447 // or less gracefully treated as valid. | 442 // or less gracefully treated as valid. |
| 448 bool strict_quotes_; | 443 bool strict_quotes_; |
| 449 }; | 444 }; |
| 450 }; | 445 }; |
| 451 | 446 |
| 452 } // namespace net | 447 } // namespace net |
| 453 | 448 |
| 454 #endif // NET_HTTP_HTTP_UTIL_H_ | 449 #endif // NET_HTTP_HTTP_UTIL_H_ |
| OLD | NEW |