OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_VARY_DATA_H_ | 5 #ifndef NET_HTTP_HTTP_VARY_DATA_H_ |
6 #define NET_HTTP_HTTP_VARY_DATA_H_ | 6 #define NET_HTTP_HTTP_VARY_DATA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/md5.h" | 9 #include "base/md5.h" |
10 #include "net/base/net_api.h" | 10 #include "net/base/net_export.h" |
11 | 11 |
12 class Pickle; | 12 class Pickle; |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 struct HttpRequestInfo; | 16 struct HttpRequestInfo; |
17 class HttpResponseHeaders; | 17 class HttpResponseHeaders; |
18 | 18 |
19 // Used to implement the HTTP/1.1 Vary header. This class contains a MD5 hash | 19 // Used to implement the HTTP/1.1 Vary header. This class contains a MD5 hash |
20 // over the request headers indicated by a Vary header. | 20 // over the request headers indicated by a Vary header. |
21 // | 21 // |
22 // While RFC 2616 requires strict request header comparisons, it is much | 22 // While RFC 2616 requires strict request header comparisons, it is much |
23 // cheaper to store a MD5 sum, which should be sufficient. Storing a hash also | 23 // cheaper to store a MD5 sum, which should be sufficient. Storing a hash also |
24 // avoids messy privacy issues as some of the request headers could hold | 24 // avoids messy privacy issues as some of the request headers could hold |
25 // sensitive data (e.g., cookies). | 25 // sensitive data (e.g., cookies). |
26 // | 26 // |
27 // NOTE: This class does not hold onto the contents of the Vary header. | 27 // NOTE: This class does not hold onto the contents of the Vary header. |
28 // Instead, it relies on the consumer to store that and to supply it again to | 28 // Instead, it relies on the consumer to store that and to supply it again to |
29 // the MatchesRequest function for comparing against future HTTP requests. | 29 // the MatchesRequest function for comparing against future HTTP requests. |
30 // | 30 // |
31 class NET_TEST HttpVaryData { | 31 class NET_EXPORT_PRIVATE HttpVaryData { |
32 public: | 32 public: |
33 HttpVaryData(); | 33 HttpVaryData(); |
34 | 34 |
35 bool is_valid() const { return is_valid_; } | 35 bool is_valid() const { return is_valid_; } |
36 | 36 |
37 // Initialize from a request and its corresponding response headers. | 37 // Initialize from a request and its corresponding response headers. |
38 // | 38 // |
39 // Returns true if a Vary header was found in the response headers and that | 39 // Returns true if a Vary header was found in the response headers and that |
40 // Vary header was not empty and did not contain the '*' value. Upon | 40 // Vary header was not empty and did not contain the '*' value. Upon |
41 // success, the object is also marked as valid such that is_valid() will | 41 // success, the object is also marked as valid such that is_valid() will |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // A digested version of the request headers corresponding to the Vary header. | 77 // A digested version of the request headers corresponding to the Vary header. |
78 base::MD5Digest request_digest_; | 78 base::MD5Digest request_digest_; |
79 | 79 |
80 // True when request_digest_ contains meaningful data. | 80 // True when request_digest_ contains meaningful data. |
81 bool is_valid_; | 81 bool is_valid_; |
82 }; | 82 }; |
83 | 83 |
84 } // namespace net | 84 } // namespace net |
85 | 85 |
86 #endif // NET_HTTP_HTTP_VARY_DATA_H_ | 86 #endif // NET_HTTP_HTTP_VARY_DATA_H_ |
OLD | NEW |