Class: HTTP2::Settings

Inherits:
Struct
  • Object
show all
Defined in:
sig/settings.rbs,
lib/http/2/settings.rb

Overview

Container for all settings required for the management of an HTTP/2 connection. This includes the managemenet of the settings negotiated via the SETTINGS frame, as well as user-level configuration related with header compression.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(settings_header_table_size: 4096, settings_enable_push: 1, settings_max_concurrent_streams: 100, settings_initial_window_size: 65_535, settings_max_frame_size: 16_384, settings_max_header_list_size: MAX_HEADER_LIST_SIZE, huffman: :shorter, index: :all, table_size: 4096) ⇒ Settings

Returns a new instance of Settings.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/http/2/settings.rb', line 32

def initialize(
  # connection settings
  settings_header_table_size: 4096,
  settings_enable_push: 1,
  settings_max_concurrent_streams: 100,
  settings_initial_window_size: 65_535,
  settings_max_frame_size: 16_384,
  settings_max_header_list_size: MAX_HEADER_LIST_SIZE,
  # encoding context settings
  huffman: :shorter,
  index: :all,
  table_size: 4096
)
  super
end

Instance Attribute Details

#huffmanhuffman_type

controls how to use huffman encoding to encode strings. can be one of the following values:

  • :always - Always use Huffman encoding
  • :never - Do not use Huffman encoding
  • :shorter - Use Huffman when the result is strictly shorter

Returns:

  • (huffman_type)


41
42
43
# File 'sig/settings.rbs', line 41

def huffman
  @huffman
end

#indexindex_type

controls the configuration of the HPACK indexing tables:

  • :static - use the static table only
  • :all - use the static table and the dynamic table
  • :never - do not use any of the tables.

Returns:

  • (index_type)


48
49
50
# File 'sig/settings.rbs', line 48

def index
  @index
end

#settings_enable_pushInteger

can be used to disable server push (set to 0)

Returns:

  • (Integer)


22
23
24
# File 'sig/settings.rbs', line 22

def settings_enable_push
  @settings_enable_push
end

#settings_header_table_sizeInteger

maximum size of the header compression table used to decode header blocks, in bytes.

Returns:

  • (Integer)


19
20
21
# File 'sig/settings.rbs', line 19

def settings_header_table_size
  @settings_header_table_size
end

#settings_initial_window_sizeInteger

initial window size (in bytes) for stream-level flow control.

Returns:

  • (Integer)


28
29
30
# File 'sig/settings.rbs', line 28

def settings_initial_window_size
  @settings_initial_window_size
end

#settings_max_concurrent_streamsInteger

maximum number of concurrent streams that the sender will allow.

Returns:

  • (Integer)


25
26
27
# File 'sig/settings.rbs', line 25

def settings_max_concurrent_streams
  @settings_max_concurrent_streams
end

#settings_max_frame_sizeInteger

max size of for payload that the sender is willing to receive, in bytes.

Returns:

  • (Integer)


31
32
33
# File 'sig/settings.rbs', line 31

def settings_max_frame_size
  @settings_max_frame_size
end

#settings_max_header_list_sizeObject

Returns the value of attribute settings_max_header_list_size

Returns:

  • (Object)

    the current value of settings_max_header_list_size



18
19
20
# File 'lib/http/2/settings.rb', line 18

def settings_max_header_list_size
  @settings_max_header_list_size
end

#table_sizeInteger

maximum dynamic table size in bytes

Returns:

  • (Integer)


51
52
53
# File 'sig/settings.rbs', line 51

def table_size
  @table_size
end

Instance Method Details

#connection_settingsself #connection_settingsEnumerable[[Symbol, Integer]]

yields connection-level settings only.

Overloads:

  • #connection_settingsself

    Returns:

    • (self)
  • #connection_settingsEnumerable[[Symbol, Integer]]

    Returns:

    • (Enumerable[[Symbol, Integer]])

Yields:

Yield Parameters:

  • arg0 (Symbol)
  • arg1 (Integer)

Yield Returns:

  • (void)


68
69
70
71
72
73
74
75
76
# File 'sig/settings.rbs', line 68

def connection_settings
  return enum_for(__method__) unless block_given?

  each_pair do |k, v|
    next if ENCODING_CONTEXT_SETTINGS.include?(k)

    yield k, v
  end
end