| 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 // The GZipHeader class allows you to parse a gzip header, such as you | 5 // The GZipHeader class allows you to parse a gzip header, such as you |
| 6 // might find at the beginning of a file compressed by gzip (ie, a .gz | 6 // might find at the beginning of a file compressed by gzip (ie, a .gz |
| 7 // file), or at the beginning of an HTTP response that uses a gzip | 7 // file), or at the beginning of an HTTP response that uses a gzip |
| 8 // Content-Encoding. See RFC 1952 for the specification for the gzip | 8 // Content-Encoding. See RFC 1952 for the specification for the gzip |
| 9 // header. | 9 // header. |
| 10 // | 10 // |
| 11 // The model is that you call ReadMore() for each chunk of bytes | 11 // The model is that you call ReadMore() for each chunk of bytes |
| 12 // you've read from a file or socket. | 12 // you've read from a file or socket. |
| 13 // | 13 // |
| 14 | 14 |
| 15 #ifndef NET_FILTER_GZIP_HEADER_H_ | 15 #ifndef NET_FILTER_GZIP_HEADER_H_ |
| 16 #define NET_FILTER_GZIP_HEADER_H_ | 16 #define NET_FILTER_GZIP_HEADER_H_ |
| 17 | 17 |
| 18 #include <stdint.h> | 18 #include <stdint.h> |
| 19 | 19 |
| 20 #include "base/macros.h" | 20 #include "base/macros.h" |
| 21 #include "net/base/net_export.h" |
| 21 | 22 |
| 22 namespace net { | 23 namespace net { |
| 23 | 24 |
| 24 class GZipHeader { | 25 class NET_EXPORT GZipHeader { |
| 25 public: | 26 public: |
| 26 enum Status { | 27 enum Status { |
| 27 INCOMPLETE_HEADER, // don't have all the bits yet... | 28 INCOMPLETE_HEADER, // don't have all the bits yet... |
| 28 COMPLETE_HEADER, // complete, valid header | 29 COMPLETE_HEADER, // complete, valid header |
| 29 INVALID_HEADER, // found something invalid in the header | 30 INVALID_HEADER, // found something invalid in the header |
| 30 }; | 31 }; |
| 31 | 32 |
| 32 GZipHeader(); | 33 GZipHeader(); |
| 33 ~GZipHeader(); | 34 ~GZipHeader(); |
| 34 | 35 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 int state_; // our current State in the parsing FSM: an int so we can ++ | 88 int state_; // our current State in the parsing FSM: an int so we can ++ |
| 88 uint8_t flags_; // the flags byte of the header ("FLG" in the RFC) | 89 uint8_t flags_; // the flags byte of the header ("FLG" in the RFC) |
| 89 uint16_t extra_length_; // how much of the "extra field" we have yet to read | 90 uint16_t extra_length_; // how much of the "extra field" we have yet to read |
| 90 | 91 |
| 91 DISALLOW_COPY_AND_ASSIGN(GZipHeader); | 92 DISALLOW_COPY_AND_ASSIGN(GZipHeader); |
| 92 }; | 93 }; |
| 93 | 94 |
| 94 } // namespace net | 95 } // namespace net |
| 95 | 96 |
| 96 #endif // NET_FILTER_GZIP_HEADER_H_ | 97 #endif // NET_FILTER_GZIP_HEADER_H_ |
| OLD | NEW |