OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Derived from: | 5 // Derived from: |
6 // mozilla/netwerk/protocol/http/src/nsHttpChunkedDecoder.h | 6 // mozilla/netwerk/protocol/http/src/nsHttpChunkedDecoder.h |
7 // The license block is: | 7 // The license block is: |
8 /* ***** BEGIN LICENSE BLOCK ***** | 8 /* ***** BEGIN LICENSE BLOCK ***** |
9 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 9 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
10 * | 10 * |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // | 70 // |
71 // The chunk-size field is a string of hex digits indicating the size of the | 71 // The chunk-size field is a string of hex digits indicating the size of the |
72 // chunk. The chunked encoding is ended by any chunk whose size is zero, | 72 // chunk. The chunked encoding is ended by any chunk whose size is zero, |
73 // followed by the trailer, which is terminated by an empty line. | 73 // followed by the trailer, which is terminated by an empty line. |
74 // | 74 // |
75 // NOTE: This implementation does not bother to parse trailers since they are | 75 // NOTE: This implementation does not bother to parse trailers since they are |
76 // not used on the web. | 76 // not used on the web. |
77 // | 77 // |
78 class NET_EXPORT_PRIVATE HttpChunkedDecoder { | 78 class NET_EXPORT_PRIVATE HttpChunkedDecoder { |
79 public: | 79 public: |
| 80 // The maximum length of |line_buf_| between calls to FilterBuff(). |
| 81 // Exposed for tests. |
| 82 static const size_t kMaxLineBufLen; |
| 83 |
80 HttpChunkedDecoder(); | 84 HttpChunkedDecoder(); |
81 | 85 |
82 // Indicates that a previous call to FilterBuf encountered the final CRLF. | 86 // Indicates that a previous call to FilterBuf encountered the final CRLF. |
83 bool reached_eof() const { return reached_eof_; } | 87 bool reached_eof() const { return reached_eof_; } |
84 | 88 |
85 // Returns the number of bytes after the final CRLF. | 89 // Returns the number of bytes after the final CRLF. |
86 int bytes_after_eof() const { return bytes_after_eof_; } | 90 int bytes_after_eof() const { return bytes_after_eof_; } |
87 | 91 |
88 // Called to filter out the chunk markers from buf and to check for end-of- | 92 // Called to filter out the chunk markers from buf and to check for end-of- |
89 // file. This method modifies |buf| inline if necessary to remove chunk | 93 // file. This method modifies |buf| inline if necessary to remove chunk |
(...skipping 29 matching lines...) Expand all Loading... |
119 bool reached_eof_; | 123 bool reached_eof_; |
120 | 124 |
121 // The number of unfiltered bytes after the final CRLF, either extraneous | 125 // The number of unfiltered bytes after the final CRLF, either extraneous |
122 // data or the first part of the next response in a pipelined stream. | 126 // data or the first part of the next response in a pipelined stream. |
123 int bytes_after_eof_; | 127 int bytes_after_eof_; |
124 }; | 128 }; |
125 | 129 |
126 } // namespace net | 130 } // namespace net |
127 | 131 |
128 #endif // NET_HTTP_HTTP_CHUNKED_DECODER_H_ | 132 #endif // NET_HTTP_HTTP_CHUNKED_DECODER_H_ |
OLD | NEW |