| 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 #include "net/spdy/hpack_decoder.h" | 5 #include "net/spdy/hpack_decoder.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "net/spdy/hpack_constants.h" | 10 #include "net/spdy/hpack_constants.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 headers_block_buffer_.insert(headers_block_buffer_.end(), | 41 headers_block_buffer_.insert(headers_block_buffer_.end(), |
| 42 headers_data, | 42 headers_data, |
| 43 headers_data + headers_data_length); | 43 headers_data + headers_data_length); |
| 44 return true; | 44 return true; |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool HpackDecoder::HandleControlFrameHeadersComplete(SpdyStreamId id) { | 47 bool HpackDecoder::HandleControlFrameHeadersComplete(SpdyStreamId id) { |
| 48 HpackInputStream input_stream(max_string_literal_size_, | 48 HpackInputStream input_stream(max_string_literal_size_, |
| 49 headers_block_buffer_); | 49 headers_block_buffer_); |
| 50 while (input_stream.HasMoreData()) { | 50 while (input_stream.HasMoreData()) { |
| 51 if (!DecodeNextOpcode(&input_stream)) | 51 if (!DecodeNextOpcode(&input_stream)) { |
| 52 headers_block_buffer_.clear(); |
| 52 return false; | 53 return false; |
| 54 } |
| 53 } | 55 } |
| 54 headers_block_buffer_.clear(); | 56 headers_block_buffer_.clear(); |
| 55 | 57 |
| 56 // Emit everything in the reference set that hasn't already been emitted. | 58 // Emit everything in the reference set that hasn't already been emitted. |
| 57 // Also clear entry state for the next decoded headers block. | 59 // Also clear entry state for the next decoded headers block. |
| 58 // TODO(jgraettinger): We may need to revisit the order in which headers | 60 // TODO(jgraettinger): We may need to revisit the order in which headers |
| 59 // are emitted (b/14051713). | 61 // are emitted (b/14051713). |
| 60 for (HpackEntry::OrderedSet::const_iterator it = | 62 for (HpackEntry::OrderedSet::const_iterator it = |
| 61 header_table_.reference_set().begin(); | 63 header_table_.reference_set().begin(); |
| 62 it != header_table_.reference_set().end(); ++it) { | 64 it != header_table_.reference_set().end(); ++it) { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 return result; | 233 return result; |
| 232 } else if (input_stream->MatchPrefixAndConsume( | 234 } else if (input_stream->MatchPrefixAndConsume( |
| 233 kStringLiteralIdentityEncoded)) { | 235 kStringLiteralIdentityEncoded)) { |
| 234 return input_stream->DecodeNextIdentityString(output); | 236 return input_stream->DecodeNextIdentityString(output); |
| 235 } else { | 237 } else { |
| 236 return false; | 238 return false; |
| 237 } | 239 } |
| 238 } | 240 } |
| 239 | 241 |
| 240 } // namespace net | 242 } // namespace net |
| OLD | NEW |