Module: Async::HTTP::Protocol::HTTP2

Extended by:
Configurable
Defined in:
lib/async/http/protocol/http2.rb,
lib/async/http/protocol/http2/input.rb,
lib/async/http/protocol/http2/client.rb,
lib/async/http/protocol/http2/output.rb,
lib/async/http/protocol/http2/server.rb,
lib/async/http/protocol/http2/stream.rb,
lib/async/http/protocol/http2/request.rb,
lib/async/http/protocol/http2/response.rb,
lib/async/http/protocol/http2/connection.rb

Defined Under Namespace

Modules: Connection Classes: Client, Input, Output, Request, Response, Server, Stream

Constant Summary collapse

VERSION =
"HTTP/2"
CLIENT_SETTINGS =

The default settings for the client.

{
  ::Protocol::HTTP2::Settings::ENABLE_PUSH => 0,
  ::Protocol::HTTP2::Settings::MAXIMUM_FRAME_SIZE => 0x100000,
  ::Protocol::HTTP2::Settings::INITIAL_WINDOW_SIZE => 0x800000,
  ::Protocol::HTTP2::Settings::NO_RFC7540_PRIORITIES => 1,
}
SERVER_SETTINGS =

The default settings for the server.

{
  # We choose a lower maximum concurrent streams to avoid overloading a single connection/thread.
  ::Protocol::HTTP2::Settings::MAXIMUM_CONCURRENT_STREAMS => 128,
  ::Protocol::HTTP2::Settings::MAXIMUM_FRAME_SIZE => 0x100000,
  ::Protocol::HTTP2::Settings::INITIAL_WINDOW_SIZE => 0x800000,
  ::Protocol::HTTP2::Settings::ENABLE_CONNECT_PROTOCOL => 1,
  ::Protocol::HTTP2::Settings::NO_RFC7540_PRIORITIES => 1,
}
HTTPS =
"https".freeze
SCHEME =
":scheme".freeze
METHOD =
":method".freeze
PATH =
":path".freeze
AUTHORITY =
":authority".freeze
STATUS =
":status".freeze
PROTOCOL =
":protocol".freeze
CONTENT_LENGTH =
"content-length".freeze
CONNECTION =
"connection".freeze
TRAILER =
"trailer".freeze

Class Method Summary collapse

Methods included from Configurable

new

Class Method Details

.bidirectional?Boolean

Returns:



23
24
25
# File 'lib/async/http/protocol/http2.rb', line 23

def self.bidirectional?
  true
end

.client(peer, settings: CLIENT_SETTINGS) ⇒ Object

Create a client for an outbound connection.



54
55
56
57
58
59
60
61
62
# File 'lib/async/http/protocol/http2.rb', line 54

def self.client(peer, settings: CLIENT_SETTINGS)
  stream = ::IO::Stream(peer)
  client = Client.new(stream)
  
  client.send_connection_preface(settings)
  client.start_connection
  
  return client
end

.namesObject



79
80
81
# File 'lib/async/http/protocol/http2.rb', line 79

def self.names
  ["h2"]
end

.server(peer, settings: SERVER_SETTINGS) ⇒ Object

Create a server for an inbound connection.



68
69
70
71
72
73
74
75
76
# File 'lib/async/http/protocol/http2.rb', line 68

def self.server(peer, settings: SERVER_SETTINGS)
  stream = ::IO::Stream(peer)
  server = Server.new(stream)
  
  server.read_connection_preface(settings)
  server.start_connection
  
  return server
end

.trailer?Boolean

Returns:



28
29
30
# File 'lib/async/http/protocol/http2.rb', line 28

def self.trailer?
  true
end