Class: HTTP::Protocol::HTTP2::SettingsFrame
- Includes:
- Acknowledgement
- Defined in:
- lib/http/protocol/http2/settings_frame.rb
Overview
The SETTINGS frame conveys configuration parameters that affect how endpoints communicate, such as preferences and constraints on peer behavior. The SETTINGS frame is also used to acknowledge the receipt of those parameters. Individually, a SETTINGS parameter can also be referred to as a “setting”.
-------------------------------
| Identifier (16) | -------------------------------
——————————-+ | Value (32) | ---------------------------------------------------------------
Constant Summary collapse
- TYPE =
0x4
- FORMAT =
"nN".freeze
Constants inherited from Frame
Frame::HEADER_FORMAT, Frame::LENGTH_HISHIFT, Frame::LENGTH_LOMASK, Frame::STREAM_ID_MASK, Frame::VALID_LENGTH, Frame::VALID_STREAM_ID
Instance Attribute Summary
Attributes inherited from Frame
#flags, #length, #payload, #stream_id, #type
Instance Method Summary collapse
- #apply(connection) ⇒ Object
- #connection? ⇒ Boolean
- #pack(settings = []) ⇒ Object
- #read_payload(stream) ⇒ Object
- #unpack ⇒ Object
Methods included from Acknowledgement
#acknowledge, #acknowledgement?
Methods inherited from Frame
#<=>, #clear_flags, #flag_set?, #header, #initialize, parse_header, #read, #read_header, #set_flags, #to_ary, #write, #write_header, #write_payload
Constructor Details
This class inherits a constructor from HTTP::Protocol::HTTP2::Frame
Instance Method Details
#apply(connection) ⇒ Object
217 218 219 |
# File 'lib/http/protocol/http2/settings_frame.rb', line 217 def apply(connection) connection.receive_settings(self) end |
#connection? ⇒ Boolean
205 206 207 |
# File 'lib/http/protocol/http2/settings_frame.rb', line 205 def connection? true end |
#pack(settings = []) ⇒ Object
213 214 215 |
# File 'lib/http/protocol/http2/settings_frame.rb', line 213 def pack(settings = []) super settings.map{|s| s.pack(FORMAT)}.join end |
#read_payload(stream) ⇒ Object
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/http/protocol/http2/settings_frame.rb', line 221 def read_payload(stream) super if @stream_id != 0 raise ProtocolError, "Settings apply to connection only, but stream_id was given" end if acknowledgement? and @length != 0 raise FrameSizeError, "Settings acknowledgement must not contain payload: #{@payload.inspect}" end if (@length % 6) != 0 raise FrameSizeError, "Invalid frame length" end end |
#unpack ⇒ Object
209 210 211 |
# File 'lib/http/protocol/http2/settings_frame.rb', line 209 def unpack super.scan(/....../).map{|s| s.unpack(FORMAT)} end |