Chromium Code Reviews| Index: net/base/sdch_manager.h |
| diff --git a/net/base/sdch_manager.h b/net/base/sdch_manager.h |
| index 0948b4c71782764569ee988726320a371752a263..d51fda8c5c3e7182aba69f7c9537d3b90b06f207 100644 |
| --- a/net/base/sdch_manager.h |
| +++ b/net/base/sdch_manager.h |
| @@ -59,11 +59,6 @@ class NET_EXPORT SdchManager { |
| typedef std::map<std::string, scoped_refptr<base::RefCountedData<Dictionary>>> |
| DictionaryMap; |
| - // Use the following static limits to block DOS attacks until we implement |
| - // a cached dictionary evicition strategy. |
| - static const size_t kMaxDictionarySize; |
| - static const size_t kMaxDictionaryCount; |
| - |
| class NET_EXPORT_PRIVATE Dictionary { |
| public: |
| // Construct a vc-diff usable dictionary from the dictionary_text starting |
| @@ -72,6 +67,7 @@ class NET_EXPORT SdchManager { |
| Dictionary(const std::string& dictionary_text, |
| size_t offset, |
| const std::string& client_hash, |
| + const std::string& server_hash, |
| const GURL& url, |
| const std::string& domain, |
| const std::string& path, |
| @@ -85,6 +81,7 @@ class NET_EXPORT SdchManager { |
| const GURL& url() const { return url_; } |
| const std::string& client_hash() const { return client_hash_; } |
| + const std::string& server_hash() const { return server_hash_; } |
| const std::string& domain() const { return domain_; } |
| const std::string& path() const { return path_; } |
| const base::Time& expiration() const { return expiration_; } |
| @@ -128,6 +125,10 @@ class NET_EXPORT SdchManager { |
| // it has a specific dictionary pre-cached. |
| std::string client_hash_; |
| + // Part of the hash of text_ that the server uses to identify the |
| + // dictionary it wants used for decoding. |
| + std::string server_hash_; |
| + |
| // The GURL that arrived with the text_ in a URL request to specify where |
| // this dictionary may be used. |
| const GURL url_; |
| @@ -233,6 +234,10 @@ class NET_EXPORT SdchManager { |
| SdchProblemCode OnGetDictionary(const GURL& request_url, |
| const GURL& dictionary_url); |
| + // Send out appropriate events notifying observers that a dictionary |
| + // was successfully used to decode a request. |
| + void OnDictionaryUsed(const std::string& server_hash); |
| + |
| // Get a handle to the available dictionaries that might be used |
| // for encoding responses for the given URL. The return set will not |
| // include expired dictionaries. If no dictionaries |
| @@ -270,10 +275,16 @@ class NET_EXPORT SdchManager { |
| // dictionaries. This addition will fail if addition is illegal |
| // (data in the dictionary is not acceptable from the |
| // dictionary_url; dictionary already added, etc.). |
| + // If |server_hash| is non-null, returns the server has that may be |
|
Bence
2015/01/08 14:37:17
s/server has/server hash/
Randy Smith (Not in Mondays)
2015/01/08 15:48:23
Done.
|
| + // used as an argument to GetDictionarySetByHash. |
| // Returns SDCH_OK if the addition was successfull, and corresponding error |
| // code otherwise. |
| SdchProblemCode AddSdchDictionary(const std::string& dictionary_text, |
| - const GURL& dictionary_url); |
| + const GURL& dictionary_url, |
| + std::string* server_hash_p); |
| + |
| + // Remove an SDCH dictionary |
| + SdchProblemCode RemoveSdchDictionary(const std::string& server_hash); |
| // Registration for events generated by the SDCH subsystem. |
| void AddObserver(SdchObserver* observer); |