lib/protocol/http2/settings_frame.rb in protocol-http2-0.2.1 vs lib/protocol/http2/settings_frame.rb in protocol-http2-0.3.0
- old
+ new
@@ -27,27 +27,28 @@
ENABLE_PUSH = 0x2
MAXIMUM_CONCURRENT_STREAMS = 0x3
INITIAL_WINDOW_SIZE = 0x4
MAXIMUM_FRAME_SIZE = 0x5
MAXIMUM_HEADER_LIST_SIZE = 0x6
+ ENABLE_CONNECT_PROTOCOL = 0x8
# Allows the sender to inform the remote endpoint of the maximum size of the header compression table used to decode header blocks, in octets.
attr_accessor :header_table_size
# 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.
attr :enable_push
def enable_push= value
- if @enable_push == 0 || @enable_push == 1
+ if value == 0 or value == 1
@enable_push = value
else
raise ProtocolError, "Invalid value for enable_push: #{value}"
end
end
def enable_push?
- @enable_push != 0
+ @enable_push == 1
end
# Indicates the maximum number of concurrent streams that the sender will allow.
attr_accessor :maximum_concurrent_streams
@@ -75,29 +76,46 @@
end
# This advisory setting informs a peer of the maximum size of header list that the sender is prepared to accept, in octets.
attr_accessor :maximum_header_list_size
+ attr :enable_connect_protocol
+
+ 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?
+ @enable_connect_protocol == 1
+ end
+
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
ASSIGN = [
nil,
:header_table_size=,
:enable_push=,
:maximum_concurrent_streams=,
:initial_window_size=,
:maximum_frame_size=,
:maximum_header_list_size=,
+ nil, nil,
+ :enable_connect_protocol=,
]
def update(changes)
changes.each do |key, value|
if name = ASSIGN[key]
@@ -129,9 +147,13 @@
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
end