class Protocol::HTTP2::Settings
Constants
- ASSIGN
- ENABLE_CONNECT_PROTOCOL
- ENABLE_PUSH
- HEADER_TABLE_SIZE
- INITIAL_WINDOW_SIZE
- MAXIMUM_CONCURRENT_STREAMS
- MAXIMUM_FRAME_SIZE
- MAXIMUM_HEADER_LIST_SIZE
Attributes
enable_connect_protocol[R]
enable_push[R]
This setting can be used to disable server push. An endpoint MUST NOT send a PUSH_PROMISE frame if it receives this parameter set to a value of 0.
header_table_size[RW]
Allows the sender to inform the remote endpoint of the maximum size of the header compression table used to decode header blocks, in octets.
initial_window_size[R]
Indicates the sender's initial window size (in octets) for stream-level flow control.
maximum_concurrent_streams[RW]
Indicates the maximum number of concurrent streams that the sender will allow.
maximum_frame_size[R]
Indicates the size of the largest frame payload that the sender is willing to receive, in octets.
maximum_header_list_size[RW]
This advisory setting informs a peer of the maximum size of header list that the sender is prepared to accept, in octets.
Public Class Methods
new()
click to toggle source
# File lib/protocol/http2/settings_frame.rb, line 97 def initialize # These limits are taken from the RFC: # https://tools.ietf.org/html/rfc7540#section-6.5.2 @header_table_size = 4096 @enable_push = 1 @maximum_concurrent_streams = 0xFFFFFFFF @initial_window_size = 0xFFFF # 2**16 - 1 @maximum_frame_size = 0x4000 # 2**14 @maximum_header_list_size = 0xFFFFFFFF @enable_connect_protocol = 0 end
Public Instance Methods
difference(other)
click to toggle source
# File lib/protocol/http2/settings_frame.rb, line 129 def difference(other) changes = [] if @header_table_size != other.header_table_size changes << [HEADER_TABLE_SIZE, @header_table_size] end if @enable_push != other.enable_push changes << [ENABLE_PUSH, @enable_push ? 1 : 0] end if @maximum_concurrent_streams != other.maximum_concurrent_streams changes << [MAXIMUM_CONCURRENT_STREAMS, @maximum_concurrent_streams] end if @initial_window_size != other.initial_window_size changes << [INITIAL_WINDOW_SIZE, @initial_window_size] end if @maximum_frame_size != other.maximum_frame_size changes << [MAXIMUM_FRAME_SIZE, @maximum_frame_size] end if @maximum_header_list_size != other.maximum_header_list_size changes << [MAXIMUM_HEADER_LIST_SIZE, @maximum_header_list_size] end if @enable_connect_protocol != other.enable_connect_protocol changes << [ENABLE_CONNECT_PROTOCOL, @enable_connect_protocol] end return changes end
enable_connect_protocol=(value)
click to toggle source
# File lib/protocol/http2/settings_frame.rb, line 85 def enable_connect_protocol= value if value == 0 or value == 1 @enable_connect_protocol = value else raise ProtocolError, "Invalid value for enable_connect_protocol: #{value}" end end
enable_connect_protocol?()
click to toggle source
# File lib/protocol/http2/settings_frame.rb, line 93 def enable_connect_protocol? @enable_connect_protocol == 1 end
enable_push=(value)
click to toggle source
# File lib/protocol/http2/settings_frame.rb, line 40 def enable_push= value if value == 0 or value == 1 @enable_push = value else raise ProtocolError, "Invalid value for enable_push: #{value}" end end
enable_push?()
click to toggle source
# File lib/protocol/http2/settings_frame.rb, line 48 def enable_push? @enable_push == 1 end
initial_window_size=(value)
click to toggle source
# File lib/protocol/http2/settings_frame.rb, line 58 def initial_window_size= value if value <= MAXIMUM_ALLOWED_WINDOW_SIZE @initial_window_size = value else # An endpoint MUST treat a change to SETTINGS_INITIAL_WINDOW_SIZE that causes any flow-control window to exceed the maximum size as a connection error of type FLOW_CONTROL_ERROR. raise FlowControlError, "Invalid value for initial_window_size: #{value} > #{MAXIMUM_ALLOWED_WINDOW_SIZE}" end end
maximum_frame_size=(value)
click to toggle source
# File lib/protocol/http2/settings_frame.rb, line 70 def maximum_frame_size= value if value > MAXIMUM_ALLOWED_FRAME_SIZE raise ProtocolError, "Invalid value for maximum_frame_size: #{value} > #{MAXIMUM_ALLOWED_FRAME_SIZE}" elsif value < MINIMUM_ALLOWED_FRAME_SIZE raise ProtocolError, "Invalid value for maximum_frame_size: #{value} < #{MINIMUM_ALLOWED_FRAME_SIZE}" else @maximum_frame_size = value end end
update(changes)
click to toggle source
# File lib/protocol/http2/settings_frame.rb, line 121 def update(changes) changes.each do |key, value| if name = ASSIGN[key] self.send(name, value) end end end