OLD | NEW |
---|---|
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Provides global database of differential decompression dictionaries for the | 5 // Provides global database of differential decompression dictionaries for the |
6 // SDCH filter (processes sdch enconded content). | 6 // SDCH filter (processes sdch enconded content). |
7 | 7 |
8 // Exactly one instance of SdchManager is built, and all references are made | 8 // Exactly one instance of SdchManager is built, and all references are made |
9 // into that collection. | 9 // into that collection. |
10 // | 10 // |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 }; | 49 }; |
50 //------------------------------------------------------------------------------ | 50 //------------------------------------------------------------------------------ |
51 | 51 |
52 class SdchManager { | 52 class SdchManager { |
53 public: | 53 public: |
54 // A list of errors that appeared and were either resolved, or used to turn | 54 // A list of errors that appeared and were either resolved, or used to turn |
55 // off sdch encoding. | 55 // off sdch encoding. |
56 enum ProblemCodes { | 56 enum ProblemCodes { |
57 MIN_PROBLEM_CODE, | 57 MIN_PROBLEM_CODE, |
58 | 58 |
59 // Content Decode problems. | 59 // Content-encoding correction problems. |
60 ADDED_CONTENT_ENCODING, | 60 ADDED_CONTENT_ENCODING, |
Lincoln
2008/11/24 17:31:42
Do you want to add explicit initializers to these
| |
61 FIXED_CONTENT_ENCODING, | 61 FIXED_CONTENT_ENCODING, |
62 FIXED_CONTENT_ENCODINGS, | 62 FIXED_CONTENT_ENCODINGS, |
63 | 63 |
64 // Content decoding errors. | 64 // Content decoding errors. |
65 DECODE_HEADER_ERROR, | 65 DECODE_HEADER_ERROR, |
66 DECODE_BODY_ERROR, | 66 DECODE_BODY_ERROR, |
67 | 67 |
68 // More content-encoding correction problems. | |
69 OPTIONAL_GUNZIP_ENCODING_ADDED, | |
70 | |
68 // Dictionary selection for use problems. | 71 // Dictionary selection for use problems. |
69 DICTIONARY_FOUND_HAS_WRONG_DOMAIN = 10, | 72 DICTIONARY_FOUND_HAS_WRONG_DOMAIN = 10, |
70 DICTIONARY_FOUND_HAS_WRONG_PORT_LIST, | 73 DICTIONARY_FOUND_HAS_WRONG_PORT_LIST = 11, |
71 DICTIONARY_FOUND_HAS_WRONG_PATH, | 74 DICTIONARY_FOUND_HAS_WRONG_PATH = 12, |
72 DICTIONARY_FOUND_HAS_WRONG_SCHEME, | 75 DICTIONARY_FOUND_HAS_WRONG_SCHEME = 13, |
73 DICTIONARY_HASH_NOT_FOUND, | 76 DICTIONARY_HASH_NOT_FOUND = 14, |
74 DICTIONARY_HASH_MALFORMED, | 77 DICTIONARY_HASH_MALFORMED = 15, |
75 | 78 |
76 // Decode recovery methods. | 79 // Decode recovery methods. |
77 META_REFRESH_RECOVERY, | 80 META_REFRESH_RECOVERY = 16, |
78 PASSING_THROUGH_NON_SDCH, | 81 PASSING_THROUGH_NON_SDCH = 17, |
79 UNRECOVERABLE_ERROR, | 82 UNRECOVERABLE_ERROR = 18, |
80 | 83 |
81 // Dictionary saving problems. | 84 // Dictionary saving problems. |
82 DICTIONARY_HAS_NO_HEADER = 20, | 85 DICTIONARY_HAS_NO_HEADER = 20, |
83 DICTIONARY_HEADER_LINE_MISSING_COLON, | 86 DICTIONARY_HEADER_LINE_MISSING_COLON = 21, |
84 DICTIONARY_MISSING_DOMAIN_SPECIFIER, | 87 DICTIONARY_MISSING_DOMAIN_SPECIFIER = 22, |
85 DICTIONARY_SPECIFIES_TOP_LEVEL_DOMAIN, | 88 DICTIONARY_SPECIFIES_TOP_LEVEL_DOMAIN = 23, |
86 DICTIONARY_DOMAIN_NOT_MATCHING_SOURCE_URL, | 89 DICTIONARY_DOMAIN_NOT_MATCHING_SOURCE_URL = 24, |
87 DICTIONARY_PORT_NOT_MATCHING_SOURCE_URL, | 90 DICTIONARY_PORT_NOT_MATCHING_SOURCE_URL = 25, |
88 DICTIONARY_HAS_NO_TEXT, | 91 DICTIONARY_HAS_NO_TEXT = 26, |
89 | 92 |
90 // Dictionary loading problems. | 93 // Dictionary loading problems. |
91 DICTIONARY_LOAD_ATTEMPT_FROM_DIFFERENT_HOST = 30, | 94 DICTIONARY_LOAD_ATTEMPT_FROM_DIFFERENT_HOST = 30, |
92 DICTIONARY_SELECTED_FOR_SSL, | 95 DICTIONARY_SELECTED_FOR_SSL = 31, |
93 DICTIONARY_ALREADY_LOADED, | 96 DICTIONARY_ALREADY_LOADED = 32, |
94 DICTIONARY_SELECTED_FROM_NON_HTTP, | 97 DICTIONARY_SELECTED_FROM_NON_HTTP = 33, |
95 DICTIONARY_IS_TOO_LARGE, | 98 DICTIONARY_IS_TOO_LARGE= 34, |
96 DICTIONARY_COUNT_EXCEEDED, | 99 DICTIONARY_COUNT_EXCEEDED = 35, |
97 | 100 |
98 // Failsafe hack. | 101 // Failsafe hack. |
99 ATTEMPT_TO_DECODE_NON_HTTP_DATA = 40, | 102 ATTEMPT_TO_DECODE_NON_HTTP_DATA = 40, |
100 | 103 |
104 | |
105 // Content-Encoding problems detected, with no action taken. | |
106 MULTIENCODING_FOR_NON_SDCH_REQUEST = 50, | |
107 SDCH_CONTENT_ENCODE_FOR_NON_SDCH_REQUEST = 51, | |
108 | |
101 MAX_PROBLEM_CODE // Used to bound histogram. | 109 MAX_PROBLEM_CODE // Used to bound histogram. |
102 }; | 110 }; |
103 | 111 |
104 // Use the following static limits to block DOS attacks until we implement | 112 // Use the following static limits to block DOS attacks until we implement |
105 // a cached dictionary evicition strategy. | 113 // a cached dictionary evicition strategy. |
106 static const size_t kMaxDictionarySize; | 114 static const size_t kMaxDictionarySize; |
107 static const size_t kMaxDictionaryCount; | 115 static const size_t kMaxDictionaryCount; |
108 | 116 |
109 // There is one instance of |Dictionary| for each memory-cached SDCH | 117 // There is one instance of |Dictionary| for each memory-cached SDCH |
110 // dictionary. | 118 // dictionary. |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
265 // domain is supported. | 273 // domain is supported. |
266 std::string supported_domain_; | 274 std::string supported_domain_; |
267 | 275 |
268 // List domains where decode failures have required disabling sdch. | 276 // List domains where decode failures have required disabling sdch. |
269 std::set<std::string> blacklisted_domains_; | 277 std::set<std::string> blacklisted_domains_; |
270 | 278 |
271 DISALLOW_COPY_AND_ASSIGN(SdchManager); | 279 DISALLOW_COPY_AND_ASSIGN(SdchManager); |
272 }; | 280 }; |
273 | 281 |
274 #endif // NET_BASE_SDCH_MANAGER_H_ | 282 #endif // NET_BASE_SDCH_MANAGER_H_ |
OLD | NEW |