Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: net/spdy/hpack_decoder.h

Issue 1263803002: Replace SpdyNameValueBlock typedef with SpdyHeaderBlock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/spdy/fuzzing/hpack_fuzz_util_test.cc ('k') | net/spdy/hpack_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef NET_SPDY_HPACK_DECODER_H_ 5 #ifndef NET_SPDY_HPACK_DECODER_H_
6 #define NET_SPDY_HPACK_DECODER_H_ 6 #define NET_SPDY_HPACK_DECODER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // the Cookie header (which has been incrementally reconstructed) and notify 56 // the Cookie header (which has been incrementally reconstructed) and notify
57 // the visitor that the block is finished. For now, this method decodes the 57 // the visitor that the block is finished. For now, this method decodes the
58 // complete buffered block, and stores results to |decoded_block_|. 58 // complete buffered block, and stores results to |decoded_block_|.
59 bool HandleControlFrameHeadersComplete(SpdyStreamId stream_id); 59 bool HandleControlFrameHeadersComplete(SpdyStreamId stream_id);
60 60
61 // Accessor for the most recently decoded headers block. Valid until the next 61 // Accessor for the most recently decoded headers block. Valid until the next
62 // call to HandleControlFrameHeadersData(). 62 // call to HandleControlFrameHeadersData().
63 // TODO(jgraettinger): This was added to facilitate re-encoding the block in 63 // TODO(jgraettinger): This was added to facilitate re-encoding the block in
64 // SPDY3 format for delivery to the SpdyFramer visitor, and will be removed 64 // SPDY3 format for delivery to the SpdyFramer visitor, and will be removed
65 // with the migration to SpdyHeadersHandlerInterface. 65 // with the migration to SpdyHeadersHandlerInterface.
66 const std::map<std::string, std::string>& decoded_block() { 66 const SpdyHeaderBlock& decoded_block() { return decoded_block_; }
67 return decoded_block_;
68 }
69 67
70 private: 68 private:
71 // Adds the header representation to |decoded_block_|, applying the 69 // Adds the header representation to |decoded_block_|, applying the
72 // following rules, as per sections 8.1.3.3 & 8.1.3.4 of the HTTP2 draft 70 // following rules, as per sections 8.1.3.3 & 8.1.3.4 of the HTTP2 draft
73 // specification: 71 // specification:
74 // - Multiple values of the Cookie header are joined, delmited by '; '. 72 // - Multiple values of the Cookie header are joined, delmited by '; '.
75 // This reconstruction is required to properly handle Cookie crumbling. 73 // This reconstruction is required to properly handle Cookie crumbling.
76 // - Multiple values of other headers are joined and delimited by '\0'. 74 // - Multiple values of other headers are joined and delimited by '\0'.
77 // Note that this may be too accomodating, as the sender's HTTP2 layer 75 // Note that this may be too accomodating, as the sender's HTTP2 layer
78 // should have already joined and delimited these values. 76 // should have already joined and delimited these values.
(...skipping 10 matching lines...) Expand all
89 const uint32 max_string_literal_size_; 87 const uint32 max_string_literal_size_;
90 HpackHeaderTable header_table_; 88 HpackHeaderTable header_table_;
91 89
92 // Incrementally reconstructed cookie value. 90 // Incrementally reconstructed cookie value.
93 std::string cookie_value_; 91 std::string cookie_value_;
94 92
95 // TODO(jgraettinger): Buffer for headers data, and storage for the last- 93 // TODO(jgraettinger): Buffer for headers data, and storage for the last-
96 // processed headers block. Both will be removed with the switch to 94 // processed headers block. Both will be removed with the switch to
97 // SpdyHeadersHandlerInterface. 95 // SpdyHeadersHandlerInterface.
98 std::string headers_block_buffer_; 96 std::string headers_block_buffer_;
99 std::map<std::string, std::string> decoded_block_; 97 SpdyHeaderBlock decoded_block_;
100 98
101 // Flag to keep track of having seen a regular header field. 99 // Flag to keep track of having seen a regular header field.
102 bool regular_header_seen_; 100 bool regular_header_seen_;
103 101
104 // Huffman table to be applied to decoded Huffman literals, 102 // Huffman table to be applied to decoded Huffman literals,
105 // and scratch space for storing those decoded literals. 103 // and scratch space for storing those decoded literals.
106 const HpackHuffmanTable& huffman_table_; 104 const HpackHuffmanTable& huffman_table_;
107 std::string key_buffer_, value_buffer_; 105 std::string key_buffer_, value_buffer_;
108 106
109 // Handlers for decoding HPACK opcodes and header representations 107 // Handlers for decoding HPACK opcodes and header representations
110 // (or parts thereof). These methods return true on success and 108 // (or parts thereof). These methods return true on success and
111 // false on error. 109 // false on error.
112 bool DecodeNextOpcode(HpackInputStream* input_stream); 110 bool DecodeNextOpcode(HpackInputStream* input_stream);
113 bool DecodeNextHeaderTableSizeUpdate(HpackInputStream* input_stream); 111 bool DecodeNextHeaderTableSizeUpdate(HpackInputStream* input_stream);
114 bool DecodeNextIndexedHeader(HpackInputStream* input_stream); 112 bool DecodeNextIndexedHeader(HpackInputStream* input_stream);
115 bool DecodeNextLiteralHeader(HpackInputStream* input_stream, 113 bool DecodeNextLiteralHeader(HpackInputStream* input_stream,
116 bool should_index); 114 bool should_index);
117 bool DecodeNextName(HpackInputStream* input_stream, 115 bool DecodeNextName(HpackInputStream* input_stream,
118 base::StringPiece* next_name); 116 base::StringPiece* next_name);
119 bool DecodeNextStringLiteral(HpackInputStream* input_stream, 117 bool DecodeNextStringLiteral(HpackInputStream* input_stream,
120 bool is_header_key, // As distinct from a value. 118 bool is_header_key, // As distinct from a value.
121 base::StringPiece* output); 119 base::StringPiece* output);
122 120
123 DISALLOW_COPY_AND_ASSIGN(HpackDecoder); 121 DISALLOW_COPY_AND_ASSIGN(HpackDecoder);
124 }; 122 };
125 123
126 } // namespace net 124 } // namespace net
127 125
128 #endif // NET_SPDY_HPACK_DECODER_H_ 126 #endif // NET_SPDY_HPACK_DECODER_H_
OLDNEW
« no previous file with comments | « net/spdy/fuzzing/hpack_fuzz_util_test.cc ('k') | net/spdy/hpack_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698