Class: Protocol::HTTP2::Server
- Inherits:
-
Connection
- Object
- Connection
- Protocol::HTTP2::Server
- Defined in:
- lib/protocol/http2/server.rb
Instance Attribute Summary
Attributes inherited from Connection
#children, #framer, #local_settings, #local_window, #remote_settings, #remote_stream_id, #remote_window, #state, #streams
Instance Method Summary collapse
- #accept_push_promise_stream(stream_id, &block) ⇒ Object
- #enable_push? ⇒ Boolean
-
#initialize(framer) ⇒ Server
constructor
A new instance of Server.
- #read_connection_preface(settings = []) ⇒ Object
- #valid_remote_stream_id?(stream_id) ⇒ Boolean
Methods inherited from Connection
#[], #accept_stream, #active_streams, #add_child, #close, #close!, #closed?, #create_push_promise_stream, #create_stream, #decode_headers, #encode_headers, #exclusive_child, #id, #ignore_frame?, #maximum_concurrent_streams, #maximum_frame_size, #next_stream_id, #open!, #parent, #process_settings, #read_frame, #receive_continuation, #receive_data, #receive_frame, #receive_goaway, #receive_headers, #receive_ping, #receive_priority, #receive_push_promise, #receive_reset_stream, #receive_settings, #receive_window_update, #remove_child, #send_goaway, #send_ping, #send_priority, #send_settings, #update_local_settings, #update_remote_settings, #write_frame, #write_frames
Methods included from FlowControl
#available_frame_size, #available_size, #consume_local_window, #consume_remote_window, #consume_window, #receive_window_update, #send_window_update, #window_updated
Constructor Details
#initialize(framer) ⇒ Server
Returns a new instance of Server.
26 27 28 |
# File 'lib/protocol/http2/server.rb', line 26 def initialize(framer) super(framer, 2) end |
Instance Method Details
#accept_push_promise_stream(stream_id, &block) ⇒ Object
48 49 50 |
# File 'lib/protocol/http2/server.rb', line 48 def accept_push_promise_stream(stream_id, &block) raise ProtocolError, "Cannot accept push promises on server!" end |
#enable_push? ⇒ Boolean
52 53 54 |
# File 'lib/protocol/http2/server.rb', line 52 def enable_push? @remote_settings.enable_push? end |
#read_connection_preface(settings = []) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/protocol/http2/server.rb', line 34 def read_connection_preface(settings = []) if @state == :new @framer.read_connection_preface send_settings(settings) read_frame do |frame| raise ProtocolError, "First frame must be #{SettingsFrame}, but got #{frame.class}" unless frame.is_a? SettingsFrame end else raise ProtocolError, "Cannot send connection preface in state #{@state}" end end |
#valid_remote_stream_id?(stream_id) ⇒ Boolean
30 31 32 |
# File 'lib/protocol/http2/server.rb', line 30 def valid_remote_stream_id?(stream_id) stream_id.odd? end |