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

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

Issue 531253004: HPACK: Check pseudo-header order in decoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update examples_07.hpack. Created 6 years, 3 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/data/spdy_tests/examples_07.hpack ('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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 private: 70 private:
71 // Adds the header representation to |decoded_block_|, applying the 71 // 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 72 // following rules, as per sections 8.1.3.3 & 8.1.3.4 of the HTTP2 draft
73 // specification: 73 // specification:
74 // - Multiple values of the Cookie header are joined, delmited by '; '. 74 // - Multiple values of the Cookie header are joined, delmited by '; '.
75 // This reconstruction is required to properly handle Cookie crumbling. 75 // This reconstruction is required to properly handle Cookie crumbling.
76 // - Multiple values of other headers are joined and delimited by '\0'. 76 // - 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 77 // Note that this may be too accomodating, as the sender's HTTP2 layer
78 // should have already joined and delimited these values. 78 // should have already joined and delimited these values.
79 // 79 //
80 // Returns false if a pseudo-header field follows a regular header one, which
81 // MUST be treated as malformed, as per sections 8.1.2.1. of the HTTP2 draft
82 // specification.
83 //
80 // TODO(jgraettinger): This method will eventually emit to the 84 // TODO(jgraettinger): This method will eventually emit to the
81 // SpdyHeadersHandlerInterface visitor. 85 // SpdyHeadersHandlerInterface visitor.
82 void HandleHeaderRepresentation(base::StringPiece name, 86 bool HandleHeaderRepresentation(base::StringPiece name,
83 base::StringPiece value); 87 base::StringPiece value);
84 88
85 const uint32 max_string_literal_size_; 89 const uint32 max_string_literal_size_;
86 HpackHeaderTable header_table_; 90 HpackHeaderTable header_table_;
87 91
88 // Incrementally reconstructed cookie value. 92 // Incrementally reconstructed cookie value.
89 std::string cookie_value_; 93 std::string cookie_value_;
90 94
91 // TODO(jgraettinger): Buffer for headers data, and storage for the last- 95 // TODO(jgraettinger): Buffer for headers data, and storage for the last-
92 // processed headers block. Both will be removed with the switch to 96 // processed headers block. Both will be removed with the switch to
93 // SpdyHeadersHandlerInterface. 97 // SpdyHeadersHandlerInterface.
94 std::string headers_block_buffer_; 98 std::string headers_block_buffer_;
95 std::map<std::string, std::string> decoded_block_; 99 std::map<std::string, std::string> decoded_block_;
96 100
101 // Flag to keep track of having seen a regular header field.
102 bool regular_header_seen_;
103
97 // Huffman table to be applied to decoded Huffman literals, 104 // Huffman table to be applied to decoded Huffman literals,
98 // and scratch space for storing those decoded literals. 105 // and scratch space for storing those decoded literals.
99 const HpackHuffmanTable& huffman_table_; 106 const HpackHuffmanTable& huffman_table_;
100 std::string key_buffer_, value_buffer_; 107 std::string key_buffer_, value_buffer_;
101 108
102 // Handlers for decoding HPACK opcodes and header representations 109 // Handlers for decoding HPACK opcodes and header representations
103 // (or parts thereof). These methods return true on success and 110 // (or parts thereof). These methods return true on success and
104 // false on error. 111 // false on error.
105 bool DecodeNextOpcode(HpackInputStream* input_stream); 112 bool DecodeNextOpcode(HpackInputStream* input_stream);
106 bool DecodeNextHeaderTableSizeUpdate(HpackInputStream* input_stream); 113 bool DecodeNextHeaderTableSizeUpdate(HpackInputStream* input_stream);
107 bool DecodeNextIndexedHeader(HpackInputStream* input_stream); 114 bool DecodeNextIndexedHeader(HpackInputStream* input_stream);
108 bool DecodeNextLiteralHeader(HpackInputStream* input_stream, 115 bool DecodeNextLiteralHeader(HpackInputStream* input_stream,
109 bool should_index); 116 bool should_index);
110 bool DecodeNextName(HpackInputStream* input_stream, 117 bool DecodeNextName(HpackInputStream* input_stream,
111 base::StringPiece* next_name); 118 base::StringPiece* next_name);
112 bool DecodeNextStringLiteral(HpackInputStream* input_stream, 119 bool DecodeNextStringLiteral(HpackInputStream* input_stream,
113 bool is_header_key, // As distinct from a value. 120 bool is_header_key, // As distinct from a value.
114 base::StringPiece* output); 121 base::StringPiece* output);
115 122
116 DISALLOW_COPY_AND_ASSIGN(HpackDecoder); 123 DISALLOW_COPY_AND_ASSIGN(HpackDecoder);
117 }; 124 };
118 125
119 } // namespace net 126 } // namespace net
120 127
121 #endif // NET_SPDY_HPACK_DECODER_H_ 128 #endif // NET_SPDY_HPACK_DECODER_H_
OLDNEW
« no previous file with comments | « net/data/spdy_tests/examples_07.hpack ('k') | net/spdy/hpack_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698