| 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 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 // Parses a Retry-After header that is either an absolute date/time or a | 69 // Parses a Retry-After header that is either an absolute date/time or a |
| 70 // number of seconds in the future. Interprets absolute times as relative to | 70 // number of seconds in the future. Interprets absolute times as relative to |
| 71 // |now|. If |retry_after_string| is successfully parsed and indicates a time | 71 // |now|. If |retry_after_string| is successfully parsed and indicates a time |
| 72 // that is not in the past, fills in |*retry_after| and returns true; | 72 // that is not in the past, fills in |*retry_after| and returns true; |
| 73 // otherwise, returns false. | 73 // otherwise, returns false. |
| 74 static bool ParseRetryAfterHeader(const std::string& retry_after_string, | 74 static bool ParseRetryAfterHeader(const std::string& retry_after_string, |
| 75 base::Time now, | 75 base::Time now, |
| 76 base::TimeDelta* retry_after); | 76 base::TimeDelta* retry_after); |
| 77 | 77 |
| 78 // True if the request method is "safe" (per section 4.2.1 of RFC 7231). |
| 79 static bool IsMethodSafe(const std::string& method); |
| 80 |
| 78 // Returns true if it is safe to allow users and scripts to specify the header | 81 // Returns true if it is safe to allow users and scripts to specify the header |
| 79 // named |name|. | 82 // named |name|. |
| 80 static bool IsSafeHeader(const std::string& name); | 83 static bool IsSafeHeader(const std::string& name); |
| 81 | 84 |
| 82 // Returns true if |name| is a valid HTTP header name. | 85 // Returns true if |name| is a valid HTTP header name. |
| 83 static bool IsValidHeaderName(const base::StringPiece& name); | 86 static bool IsValidHeaderName(const base::StringPiece& name); |
| 84 | 87 |
| 85 // Returns false if |value| contains NUL or CRLF. This method does not perform | 88 // Returns false if |value| contains NUL or CRLF. This method does not perform |
| 86 // a fully RFC-2616-compliant header value validation. | 89 // a fully RFC-2616-compliant header value validation. |
| 87 static bool IsValidHeaderValue(const base::StringPiece& value); | 90 static bool IsValidHeaderValue(const base::StringPiece& value); |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 // True if quotes values are required to be properly quoted; false if | 444 // True if quotes values are required to be properly quoted; false if |
| 442 // mismatched quotes and other problems with quoted values should be more | 445 // mismatched quotes and other problems with quoted values should be more |
| 443 // or less gracefully treated as valid. | 446 // or less gracefully treated as valid. |
| 444 bool strict_quotes_; | 447 bool strict_quotes_; |
| 445 }; | 448 }; |
| 446 }; | 449 }; |
| 447 | 450 |
| 448 } // namespace net | 451 } // namespace net |
| 449 | 452 |
| 450 #endif // NET_HTTP_HTTP_UTIL_H_ | 453 #endif // NET_HTTP_HTTP_UTIL_H_ |
| OLD | NEW |