class Protocol::HTTP2::Settings
HTTP/2 connection settings container and management.
def enable_connect_protocol= value
@parameter value [Integer] Must be 0 (disabled) or 1 (enabled).
Set the CONNECT protocol enable flag.
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
def enable_connect_protocol?
Check if CONNECT protocol is enabled.
def enable_connect_protocol? @enable_connect_protocol == 1 end
def enable_push= value
@parameter value [Integer] Must be 0 (disabled) or 1 (enabled).
Set the server push enable flag.
def enable_push= value if value == 0 or value == 1 @enable_push = value else raise ProtocolError, "Invalid value for enable_push: #{value}" end end
def enable_push?
Check if server push is enabled.
def enable_push? @enable_push == 1 end
def initial_window_size= value
@parameter value [Integer] The window size in octets.
Set the initial window size for stream-level flow control.
def initial_window_size= value if value <= MAXIMUM_ALLOWED_WINDOW_SIZE @initial_window_size = value else raise ProtocolError, "Invalid value for initial_window_size: #{value} > #{MAXIMUM_ALLOWED_WINDOW_SIZE}" end end
def initialize
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 @no_rfc7540_priorities = 0 end
def maximum_frame_size= value
@parameter value [Integer] The maximum frame size in octets.
Set the maximum frame size the sender is willing to receive.
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
def no_rfc7540_priorities= value
@parameter value [Integer] Must be 0 (enabled) or 1 (disabled).
Set the RFC 7540 priorities disable flag.
def no_rfc7540_priorities= value if value == 0 or value == 1 @no_rfc7540_priorities = value else raise ProtocolError, "Invalid value for no_rfc7540_priorities: #{value}" end end
def no_rfc7540_priorities?
Check if RFC 7540 priorities are disabled.
def no_rfc7540_priorities? @no_rfc7540_priorities == 1 end
def update(changes)
Update settings with a hash of changes.
def update(changes) changes.each do |key, value| if name = ASSIGN[key] self.send(name, value) end end end