module HTTPX::Plugins::H2C::InstanceMethods

  1. lib/httpx/plugins/h2c.rb

Methods

Public Instance

  1. send_requests

Public Instance methods

send_requests(*requests)
[show source]
   # File lib/httpx/plugins/h2c.rb
29 def send_requests(*requests)
30   upgrade_request, *remainder = requests
31 
32   return super unless VALID_H2C_VERBS.include?(upgrade_request.verb) && upgrade_request.scheme == "http"
33 
34   connection = pool.find_connection(upgrade_request.uri, upgrade_request.options)
35 
36   return super if connection && connection.upgrade_protocol == "h2c"
37 
38   # build upgrade request
39   upgrade_request.headers.add("connection", "upgrade")
40   upgrade_request.headers.add("connection", "http2-settings")
41   upgrade_request.headers["upgrade"] = "h2c"
42   upgrade_request.headers["http2-settings"] = ::HTTP2::Client.settings_header(upgrade_request.options.http2_settings)
43 
44   super(upgrade_request, *remainder)
45 end