mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-09-01 00:00:35 -04:00
passing fallback protocol as option; this will allow to override, specially in the case when user knows that server can do unencrypted http/2
This commit is contained in:
parent
4e094f79d0
commit
e6a5fbdf45
@ -10,6 +10,7 @@ module HTTPX
|
||||
attr_reader :ip, :port, :uri
|
||||
|
||||
def initialize(uri, options)
|
||||
@fallback_protocol = options.fallback_protocol
|
||||
@connected = false
|
||||
@uri = uri
|
||||
@ip = TCPSocket.getaddress(@uri.host)
|
||||
@ -32,7 +33,7 @@ module HTTPX
|
||||
end
|
||||
|
||||
def protocol
|
||||
"http/1.1"
|
||||
@fallback_protocol
|
||||
end
|
||||
|
||||
def connect
|
||||
|
@ -43,6 +43,7 @@ module HTTPX
|
||||
defaults = {
|
||||
:proxy => {},
|
||||
:ssl => { alpn_protocols: %w[h2 http/1.1] },
|
||||
:fallback_protocol => "http/1.1",
|
||||
:timeout => Timeout.by(:per_operation),
|
||||
:headers => {},
|
||||
:cookies => {},
|
||||
@ -94,7 +95,7 @@ module HTTPX
|
||||
params form json body
|
||||
proxy follow ssl max_retries
|
||||
request_class response_class headers_class response_body_class
|
||||
io
|
||||
io fallback_protocol
|
||||
].each do |method_name|
|
||||
def_option(method_name)
|
||||
end
|
||||
|
@ -67,6 +67,7 @@ class OptionsSpec < Minitest::Test
|
||||
:form => {:bar => "bar"},
|
||||
:timeout => Timeout::PerOperation.new,
|
||||
:ssl => {:foo => "bar", :alpn_protocols => %w[h2 http/1.1] },
|
||||
:fallback_protocol => "http/1.1",
|
||||
:headers => {"Foo" => "foo", "Accept" => "xml", "Bar" => "bar"},
|
||||
:proxy => {:proxy_address => "127.0.0.1", :proxy_port => 8080},
|
||||
:cookies => {},
|
||||
|
Loading…
x
Reference in New Issue
Block a user