| OLD | NEW |
| 1 // Copyright (c) 2011 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_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_export.h" | 10 #include "net/base/net_export.h" |
| 11 | 11 |
| 12 class Pickle; | 12 class Pickle; |
| 13 class PickleIterator; |
| 13 | 14 |
| 14 namespace net { | 15 namespace net { |
| 15 | 16 |
| 16 struct HttpRequestInfo; | 17 struct HttpRequestInfo; |
| 17 class HttpResponseHeaders; | 18 class HttpResponseHeaders; |
| 18 | 19 |
| 19 // Used to implement the HTTP/1.1 Vary header. This class contains a MD5 hash | 20 // 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. | 21 // over the request headers indicated by a Vary header. |
| 21 // | 22 // |
| 22 // While RFC 2616 requires strict request header comparisons, it is much | 23 // While RFC 2616 requires strict request header comparisons, it is much |
| (...skipping 22 matching lines...) Expand all Loading... |
| 45 bool Init(const HttpRequestInfo& request_info, | 46 bool Init(const HttpRequestInfo& request_info, |
| 46 const HttpResponseHeaders& response_headers); | 47 const HttpResponseHeaders& response_headers); |
| 47 | 48 |
| 48 // Initialize from a pickle that contains data generated by a call to the | 49 // Initialize from a pickle that contains data generated by a call to the |
| 49 // vary data's Persist method. | 50 // vary data's Persist method. |
| 50 // | 51 // |
| 51 // Upon success, true is returned and the object is marked as valid such that | 52 // Upon success, true is returned and the object is marked as valid such that |
| 52 // is_valid() will return true. Otherwise, false is returned to indicate | 53 // is_valid() will return true. Otherwise, false is returned to indicate |
| 53 // that this object is marked as invalid. | 54 // that this object is marked as invalid. |
| 54 // | 55 // |
| 55 bool InitFromPickle(const Pickle& pickle, void** pickle_iter); | 56 bool InitFromPickle(const Pickle& pickle, PickleIterator* pickle_iter); |
| 56 | 57 |
| 57 // Call this method to persist the vary data. Illegal to call this on an | 58 // Call this method to persist the vary data. Illegal to call this on an |
| 58 // invalid object. | 59 // invalid object. |
| 59 void Persist(Pickle* pickle) const; | 60 void Persist(Pickle* pickle) const; |
| 60 | 61 |
| 61 // Call this method to test if the given request matches the previous request | 62 // Call this method to test if the given request matches the previous request |
| 62 // with which this vary data corresponds. The |cached_response_headers| must | 63 // with which this vary data corresponds. The |cached_response_headers| must |
| 63 // be the same response headers used to generate this vary data. | 64 // be the same response headers used to generate this vary data. |
| 64 bool MatchesRequest(const HttpRequestInfo& request_info, | 65 bool MatchesRequest(const HttpRequestInfo& request_info, |
| 65 const HttpResponseHeaders& cached_response_headers) const; | 66 const HttpResponseHeaders& cached_response_headers) const; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 77 // A digested version of the request headers corresponding to the Vary header. | 78 // A digested version of the request headers corresponding to the Vary header. |
| 78 base::MD5Digest request_digest_; | 79 base::MD5Digest request_digest_; |
| 79 | 80 |
| 80 // True when request_digest_ contains meaningful data. | 81 // True when request_digest_ contains meaningful data. |
| 81 bool is_valid_; | 82 bool is_valid_; |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 } // namespace net | 85 } // namespace net |
| 85 | 86 |
| 86 #endif // NET_HTTP_HTTP_VARY_DATA_H_ | 87 #endif // NET_HTTP_HTTP_VARY_DATA_H_ |
| OLD | NEW |