Skip to content

Commit

Permalink
Merge ca067cd into 91b8972
Browse files Browse the repository at this point in the history
  • Loading branch information
kenichi committed Aug 15, 2018
2 parents 91b8972 + ca067cd commit 77413a6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/http/2/compressor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ def dereference(index)
# - http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-10#section-4.1
#
# @param cmd [Hash] { type:, name:, value:, index: }
# @return [Array] +[name, value]+ header field that is added to the decoded header list
# @return [Array, nil] +[name, value]+ header field that is added to the decoded header list,
# or nil if +cmd[:type]+ is +:changetablesize+
def process(cmd)
emit = nil

Expand Down Expand Up @@ -553,14 +554,15 @@ def decode(buf)
decoding_pseudo_headers = true
until buf.empty?
next_header = @cc.process(header(buf))
next if next_header.nil?
is_pseudo_header = next_header.first.start_with? ':'
if !decoding_pseudo_headers && is_pseudo_header
fail ProtocolError, 'one or more pseudo headers encountered after regular headers'
end
decoding_pseudo_headers = is_pseudo_header
list << next_header
end
list.compact
list
end
end
end
Expand Down
16 changes: 16 additions & 0 deletions spec/compressor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,22 @@
},
],
},
{ title: 'D.6.a. Response Examples with Huffman - dynamic table size updates should not trigger exceptions',
type: :response,
table_size: 4096,
huffman: :always,
bypass_encoder: true,
streams: [
{ wire: '2088 7689 aa63 55e5 80ae 16d7 17',
emitted: [
[':status', '200'],
['server', 'nginx/1.15.2'],
],
table: [],
table_size: 0,
},
],
},
]

context 'decode' do
Expand Down

0 comments on commit 77413a6

Please sign in to comment.