OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // GZipFilter applies gzip and deflate content encoding/decoding to a data | 5 // GZipFilter applies gzip and deflate content encoding/decoding to a data |
6 // stream. As specified by HTTP 1.1, with gzip encoding the content is | 6 // stream. As specified by HTTP 1.1, with gzip encoding the content is |
7 // wrapped with a gzip header, and with deflate encoding the content is in | 7 // wrapped with a gzip header, and with deflate encoding the content is in |
8 // a raw, headerless DEFLATE stream. | 8 // a raw, headerless DEFLATE stream. |
9 // | 9 // |
10 // Internally GZipFilter uses zlib inflate to do decoding. | 10 // Internally GZipFilter uses zlib inflate to do decoding. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 enum GZipCheckHeaderState { | 67 enum GZipCheckHeaderState { |
68 GZIP_CHECK_HEADER_IN_PROGRESS, | 68 GZIP_CHECK_HEADER_IN_PROGRESS, |
69 GZIP_GET_COMPLETE_HEADER, | 69 GZIP_GET_COMPLETE_HEADER, |
70 GZIP_GET_INVALID_HEADER | 70 GZIP_GET_INVALID_HEADER |
71 }; | 71 }; |
72 | 72 |
73 static const int kGZipFooterSize = 8; | 73 static const int kGZipFooterSize = 8; |
74 | 74 |
75 // Only to be instantiated by Filter::Factory. | 75 // Only to be instantiated by Filter::Factory. |
76 GZipFilter(); | 76 GZipFilter(FilterType type); |
77 friend class Filter; | 77 friend class Filter; |
78 | 78 |
79 // Parses and verifies the GZip header. | 79 // Parses and verifies the GZip header. |
80 // Upon exit, the function updates gzip_header_status_ accordingly. | 80 // Upon exit, the function updates gzip_header_status_ accordingly. |
81 // | 81 // |
82 // The function returns Filter::FILTER_OK if it gets a complete header and | 82 // The function returns Filter::FILTER_OK if it gets a complete header and |
83 // there are more data in the pre-filter buffer. | 83 // there are more data in the pre-filter buffer. |
84 // The function returns Filter::FILTER_NEED_MORE_DATA if it parses all data | 84 // The function returns Filter::FILTER_NEED_MORE_DATA if it parses all data |
85 // in the pre-filter buffer, either getting a complete header or a partial | 85 // in the pre-filter buffer, either getting a complete header or a partial |
86 // header. The caller needs to check gzip_header_status_ and call this | 86 // header. The caller needs to check gzip_header_status_ and call this |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // If this flag is set, then we will revert to being a pass through filter if | 141 // If this flag is set, then we will revert to being a pass through filter if |
142 // we don't get a valid gzip header. | 142 // we don't get a valid gzip header. |
143 bool possible_sdch_pass_through_; | 143 bool possible_sdch_pass_through_; |
144 | 144 |
145 DISALLOW_COPY_AND_ASSIGN(GZipFilter); | 145 DISALLOW_COPY_AND_ASSIGN(GZipFilter); |
146 }; | 146 }; |
147 | 147 |
148 } // namespace net | 148 } // namespace net |
149 | 149 |
150 #endif // NET_FILTER_GZIP_FILTER_H__ | 150 #endif // NET_FILTER_GZIP_FILTER_H__ |
OLD | NEW |