diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2015-07-24 11:35:05 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2015-07-24 11:35:05 +0900 |
commit | de2a7086a710301319d170e2a75269be1de04df9 (patch) | |
tree | 6db57613b717ba8704d7f7d65a4acb812cb56ff9 /lib | |
parent | 2cee8612a140462172882f2da2fc380fcfac5a0a (diff) | |
download | plum-de2a7086a710301319d170e2a75269be1de04df9.tar.gz |
server_connection: process WINDOW_UPDATE
Diffstat (limited to 'lib')
-rw-r--r-- | lib/plum/server_connection.rb | 18 | ||||
-rw-r--r-- | lib/plum/stream.rb | 9 |
2 files changed, 22 insertions, 5 deletions
diff --git a/lib/plum/server_connection.rb b/lib/plum/server_connection.rb index 2a28d21..a523fcf 100644 --- a/lib/plum/server_connection.rb +++ b/lib/plum/server_connection.rb @@ -125,9 +125,11 @@ module Plum when :settings process_settings(frame) when :window_update + process_window_update(frame) when :ping process_ping(frame) when :goaway + close when :data, :headers, :priority, :rst_stream, :push_promise, :continuation raise Plum::ConnectionError.new(:protocol_error) else @@ -142,8 +144,10 @@ module Plum received = (frame.length / (2 + 4)).times.map {|i| id = payload.uint16(6 * i) val = payload.uint32(6 * i + 2) - [Frame::SETTINGS_TYPE.key(id), val] - } + name = Frame::SETTINGS_TYPE.key(id) + next unless name # 6.5.2 unknown or unsupported identifier MUST be ignored + [name, val] + }.compact @remote_settings = DEFAULT_SETTINGS.merge(received.to_h) @hpack_encoder.limit = @remote_settings[:header_table_size] @@ -154,6 +158,16 @@ module Plum send(settings_ack) end + def process_window_update(frame) + @streams.values.each do |s| + begin + s.__send__(:process_window_update, frame) + rescue Plum::StreamError => e + raise Plum::ConnectionError.new(e.http2_error_type) + end + end + end + def process_ping(frame) return if frame.flags.include?(:ack) diff --git a/lib/plum/stream.rb b/lib/plum/stream.rb index 148129e..c4c3669 100644 --- a/lib/plum/stream.rb +++ b/lib/plum/stream.rb @@ -209,11 +209,14 @@ module Plum if frame.size != 4 raise Plum::ConnectionError.new(:frame_size_error) end - inc = frame.payload.uint32 - if inc == 0 + r_wsi = frame.payload.uint32 + r = r_wsi >> 31 + wsi = r_wsi & ~(1 << 31) + if wsi == 0 raise Plum::StreamError.new(:protocol_error) + else + # TODO end - # TODO end def extract_padded(frame) |