| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 const std::string& header_value, | 203 const std::string& header_value, |
| 204 std::string* headers); | 204 std::string* headers); |
| 205 | 205 |
| 206 // Returns true if the parameters describe a response with a strong etag or | 206 // Returns true if the parameters describe a response with a strong etag or |
| 207 // last-modified header. See section 13.3.3 of RFC 2616. | 207 // last-modified header. See section 13.3.3 of RFC 2616. |
| 208 static bool HasStrongValidators(HttpVersion version, | 208 static bool HasStrongValidators(HttpVersion version, |
| 209 const std::string& etag_header, | 209 const std::string& etag_header, |
| 210 const std::string& last_modified_header, | 210 const std::string& last_modified_header, |
| 211 const std::string& date_header); | 211 const std::string& date_header); |
| 212 | 212 |
| 213 // Returns true if this response has any validator (either a Last-Modified or |
| 214 // an ETag) regardless of whether it is strong or weak. See section 13.3.3 of |
| 215 // RFC 2616. |
| 216 static bool HasValidators(HttpVersion version, |
| 217 const std::string& etag_header, |
| 218 const std::string& last_modified_header); |
| 219 |
| 213 // Gets a vector of common HTTP status codes for histograms of status | 220 // Gets a vector of common HTTP status codes for histograms of status |
| 214 // codes. Currently returns everything in the range [100, 600), plus 0 | 221 // codes. Currently returns everything in the range [100, 600), plus 0 |
| 215 // (for invalid responses/status codes). | 222 // (for invalid responses/status codes). |
| 216 static std::vector<int> GetStatusCodesForHistogram(); | 223 static std::vector<int> GetStatusCodesForHistogram(); |
| 217 | 224 |
| 218 // Maps an HTTP status code to one of the status codes in the vector | 225 // Maps an HTTP status code to one of the status codes in the vector |
| 219 // returned by GetStatusCodesForHistogram. | 226 // returned by GetStatusCodesForHistogram. |
| 220 static int MapStatusCodeForHistogram(int code); | 227 static int MapStatusCodeForHistogram(int code); |
| 221 | 228 |
| 222 // Used to iterate over the name/value pairs of HTTP headers. To iterate | 229 // Used to iterate over the name/value pairs of HTTP headers. To iterate |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 | 397 |
| 391 // True if values are required for each name/value pair; false if a | 398 // True if values are required for each name/value pair; false if a |
| 392 // name is permitted to appear without a corresponding value. | 399 // name is permitted to appear without a corresponding value. |
| 393 bool values_optional_; | 400 bool values_optional_; |
| 394 }; | 401 }; |
| 395 }; | 402 }; |
| 396 | 403 |
| 397 } // namespace net | 404 } // namespace net |
| 398 | 405 |
| 399 #endif // NET_HTTP_HTTP_UTIL_H_ | 406 #endif // NET_HTTP_HTTP_UTIL_H_ |
| OLD | NEW |