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(io) ⇒ 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
220 221 222 |
# File 'lib/http/protocol/http2/settings_frame.rb', line 220 def apply(connection) connection.receive_settings(self) end |
#connection? ⇒ Boolean
208 209 210 |
# File 'lib/http/protocol/http2/settings_frame.rb', line 208 def connection? true end |
#pack(settings = []) ⇒ Object
216 217 218 |
# File 'lib/http/protocol/http2/settings_frame.rb', line 216 def pack(settings = []) super settings.map{|s| s.pack(FORMAT)}.join end |
#read_payload(io) ⇒ Object
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/http/protocol/http2/settings_frame.rb', line 224 def read_payload(io) 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
212 213 214 |
# File 'lib/http/protocol/http2/settings_frame.rb', line 212 def unpack super.scan(/....../).map{|s| s.unpack(FORMAT)} end |