diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2015-07-17 10:52:29 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2015-07-17 10:52:29 +0900 |
commit | 2733cc466d7b8ae701d8686de3aeb1e92966e020 (patch) | |
tree | 891b1717f618ba6e44d3599b3d9653cc11948ee2 /lib/plum/stream.rb | |
parent | dd785a6762cde5ac7921b51e4d50a51928b4ee99 (diff) | |
download | plum-2733cc466d7b8ae701d8686de3aeb1e92966e020.tar.gz |
stream: client can't push
Diffstat (limited to 'lib/plum/stream.rb')
-rw-r--r-- | lib/plum/stream.rb | 48 |
1 files changed, 16 insertions, 32 deletions
diff --git a/lib/plum/stream.rb b/lib/plum/stream.rb index a7e6b01..6e834d8 100644 --- a/lib/plum/stream.rb +++ b/lib/plum/stream.rb @@ -21,8 +21,6 @@ module Plum process_priority(frame) when :rst_stream process_rst_stream(frame) - when :push_promise - process_push_promise(frame) when :window_update process_window_update(frame) when :continuation @@ -97,8 +95,22 @@ module Plum if frame.flags.include?(:end_headers) callback(:headers, @connection.hpack_decoder.decode(payload).to_h) else - @header_fragment = payload - @continuation = true + @continuation = payload + end + end + + def process_continuation(frame) + unless @continuation + raise Plum::ConnectionError.new(:protocol_error) + end + + @continuation << frame.payload + if frame.flags.include?(:end_headers) + headers = @connection.hpack_decoder.decode(@continuation) + @continuation = nil + callback(:headers, headers) + else + # continue end end @@ -126,14 +138,6 @@ module Plum end end - def process_push_promise(frame) - payload = extract_padded(frame) - rpsid = payload.slice!(0, 4).unpack("N")[0] - r = rpsid >> 31 - psid = rpsid & ~(1 << 31) - # TODO - end - def process_window_update(frame) if frame.size != 4 raise Plum::ConnectionError.new(:frame_size_error) @@ -145,26 +149,6 @@ module Plum # TODO end - def process_continuation(frame) - # TODO - unless @continuation - raise Plum::ConnectionError.new(:protocol_error) - end - - @header_fragment << frame.payload - if frame.flags.include?(:end_headers) - if @continuation == :push_promise - @connection.push_promise - else # @continuation == :headers - headers = @connection.hpack_decoder.decode(@header_fragment) - end - @header_fragment = nil - @continuation = nil - else - # continue - end - end - def extract_padded(frame) if frame.flags.include?(:padded) padding_length = frame.payload[0, 1].unpack("C")[0] |