17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/httpx/plugins/h2c.rb', line 17
def request(*args, **options)
h2c_options = options.merge(fallback_protocol: "h2c")
requests = build_requests(*args, h2c_options)
upgrade_request = requests.first
return super unless valid_h2c_upgrade_request?(upgrade_request)
upgrade_request..add("connection", "upgrade")
upgrade_request..add("connection", "http2-settings")
upgrade_request.["upgrade"] = "h2c"
upgrade_request.["http2-settings"] = HTTP2::Client.(upgrade_request.options.http2_settings)
wrap { send_requests(*upgrade_request, h2c_options).first }
responses = send_requests(*requests, h2c_options)
return responses.first if responses.size == 1
responses
end
|