Module: HTTPX::Plugins::H2C

Defined in:
lib/httpx/plugins/h2c.rb

Overview

This plugin adds support for upgrading a plaintext HTTP/1.1 connection to HTTP/2 (datatracker.ietf.org/doc/html/rfc7540#section-3.2)

gitlab.com/os85/httpx/wikis/Connection-Upgrade#h2c

Defined Under Namespace

Modules: ConnectionMethods Classes: H2CParser

Constant Summary collapse

VALID_H2C_VERBS =
%w[GET OPTIONS HEAD].freeze

Class Method Summary collapse

Class Method Details

.call(connection, request, response) ⇒ Object



19
20
21
# File 'lib/httpx/plugins/h2c.rb', line 19

def call(connection, request, response)
  connection.upgrade_to_h2c(request, response)
end

.extra_options(options) ⇒ Object



23
24
25
# File 'lib/httpx/plugins/h2c.rb', line 23

def extra_options(options)
  options.merge(max_concurrent_requests: 1, upgrade_handlers: options.upgrade_handlers.merge("h2c" => self))
end

.load_dependencies(klass) ⇒ Object



15
16
17
# File 'lib/httpx/plugins/h2c.rb', line 15

def load_dependencies(klass)
  klass.plugin(:upgrade)
end