Class: Protocol::HTTP2::Settings
- Inherits:
-
Object
- Object
- Protocol::HTTP2::Settings
- Defined in:
- lib/protocol/http2/settings_frame.rb
Constant Summary collapse
- HEADER_TABLE_SIZE =
0x1
- ENABLE_PUSH =
0x2
- MAXIMUM_CONCURRENT_STREAMS =
0x3
- INITIAL_WINDOW_SIZE =
0x4
- MAXIMUM_FRAME_SIZE =
0x5
- MAXIMUM_HEADER_LIST_SIZE =
0x6
- ASSIGN =
[ nil, :header_table_size=, :enable_push=, :maximum_concurrent_streams=, :initial_window_size=, :maximum_frame_size=, :maximum_header_list_size=, ]
Instance Attribute Summary collapse
-
#enable_push ⇒ Object
This setting can be used to disable server push.
-
#header_table_size ⇒ Object
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 ⇒ Object
Indicates the sender’s initial window size (in octets) for stream-level flow control.
-
#maximum_concurrent_streams ⇒ Object
Indicates the maximum number of concurrent streams that the sender will allow.
-
#maximum_frame_size ⇒ Object
Indicates the size of the largest frame payload that the sender is willing to receive, in octets.
-
#maximum_header_list_size ⇒ Object
This advisory setting informs a peer of the maximum size of header list that the sender is prepared to accept, in octets.
Instance Method Summary collapse
- #difference(other) ⇒ Object
- #enable_push? ⇒ Boolean
-
#initialize ⇒ Settings
constructor
A new instance of Settings.
- #update(changes) ⇒ Object
Constructor Details
#initialize ⇒ Settings
Returns a new instance of Settings.
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/protocol/http2/settings_frame.rb', line 80 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 end |
Instance Attribute Details
#enable_push ⇒ Object
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.
37 38 39 |
# File 'lib/protocol/http2/settings_frame.rb', line 37 def enable_push @enable_push end |
#header_table_size ⇒ Object
Allows the sender to inform the remote endpoint of the maximum size of the header compression table used to decode header blocks, in octets.
34 35 36 |
# File 'lib/protocol/http2/settings_frame.rb', line 34 def header_table_size @header_table_size end |
#initial_window_size ⇒ Object
Indicates the sender’s initial window size (in octets) for stream-level flow control.
55 56 57 |
# File 'lib/protocol/http2/settings_frame.rb', line 55 def initial_window_size @initial_window_size end |
#maximum_concurrent_streams ⇒ Object
Indicates the maximum number of concurrent streams that the sender will allow.
52 53 54 |
# File 'lib/protocol/http2/settings_frame.rb', line 52 def maximum_concurrent_streams @maximum_concurrent_streams end |
#maximum_frame_size ⇒ Object
Indicates the size of the largest frame payload that the sender is willing to receive, in octets.
67 68 69 |
# File 'lib/protocol/http2/settings_frame.rb', line 67 def maximum_frame_size @maximum_frame_size end |
#maximum_header_list_size ⇒ Object
This advisory setting informs a peer of the maximum size of header list that the sender is prepared to accept, in octets.
78 79 80 |
# File 'lib/protocol/http2/settings_frame.rb', line 78 def maximum_header_list_size @maximum_header_list_size end |
Instance Method Details
#difference(other) ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/protocol/http2/settings_frame.rb', line 109 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 return changes end |
#enable_push? ⇒ Boolean
47 48 49 |
# File 'lib/protocol/http2/settings_frame.rb', line 47 def enable_push? @enable_push != 0 end |
#update(changes) ⇒ Object
101 102 103 104 105 106 107 |
# File 'lib/protocol/http2/settings_frame.rb', line 101 def update(changes) changes.each do |key, value| if name = ASSIGN[key] self.send(name, value) end end end |