Chromium Code Reviews| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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). | 78 // True if the request method is "safe" (per section 4.2.1 of RFC 7231). |
| 79 static bool IsMethodSafe(const std::string& method); | 79 static bool IsMethodSafe(const std::string& method); |
| 80 | 80 |
| 81 // Returns true if the request method is idempotent. | |
|
mmenke
2017/05/09 15:52:49
nit: Reference RFC? (4.2.2 of RFC 7231)
tfarina
2017/05/09 16:50:39
Done.
| |
| 82 static bool IsMethodIdempotent(const std::string& method); | |
| 83 | |
| 81 // Returns true if it is safe to allow users and scripts to specify the header | 84 // Returns true if it is safe to allow users and scripts to specify the header |
| 82 // named |name|. | 85 // named |name|. |
| 83 static bool IsSafeHeader(const std::string& name); | 86 static bool IsSafeHeader(const std::string& name); |
| 84 | 87 |
| 85 // Returns true if |name| is a valid HTTP header name. | 88 // Returns true if |name| is a valid HTTP header name. |
| 86 static bool IsValidHeaderName(const base::StringPiece& name); | 89 static bool IsValidHeaderName(const base::StringPiece& name); |
| 87 | 90 |
| 88 // Returns false if |value| contains NUL or CRLF. This method does not perform | 91 // Returns false if |value| contains NUL or CRLF. This method does not perform |
| 89 // a fully RFC-2616-compliant header value validation. | 92 // a fully RFC-2616-compliant header value validation. |
| 90 static bool IsValidHeaderValue(const base::StringPiece& value); | 93 static bool IsValidHeaderValue(const base::StringPiece& value); |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 444 // True if quotes values are required to be properly quoted; false if | 447 // True if quotes values are required to be properly quoted; false if |
| 445 // mismatched quotes and other problems with quoted values should be more | 448 // mismatched quotes and other problems with quoted values should be more |
| 446 // or less gracefully treated as valid. | 449 // or less gracefully treated as valid. |
| 447 bool strict_quotes_; | 450 bool strict_quotes_; |
| 448 }; | 451 }; |
| 449 }; | 452 }; |
| 450 | 453 |
| 451 } // namespace net | 454 } // namespace net |
| 452 | 455 |
| 453 #endif // NET_HTTP_HTTP_UTIL_H_ | 456 #endif // NET_HTTP_HTTP_UTIL_H_ |
| OLD | NEW |