mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-09-01 00:00:35 -04:00
ssl options: passing alpn fixtures as ssl default options; this will allow disabling, and will centralize defaults
This commit is contained in:
parent
6220ecec15
commit
4e094f79d0
@ -101,10 +101,6 @@ module HTTPX
|
||||
@negotiated = false
|
||||
@ctx = OpenSSL::SSL::SSLContext.new
|
||||
@ctx.set_params(options.ssl)
|
||||
@ctx.alpn_protocols = %w[h2 http/1.1] if @ctx.respond_to?(:alpn_protocols=)
|
||||
@ctx.alpn_select_cb = lambda do |pr|
|
||||
pr.first unless pr.nil? || pr.empty?
|
||||
end if @ctx.respond_to?(:alpn_select_cb=)
|
||||
super
|
||||
end
|
||||
|
||||
|
@ -42,7 +42,7 @@ module HTTPX
|
||||
def initialize(options = {})
|
||||
defaults = {
|
||||
:proxy => {},
|
||||
:ssl => {},
|
||||
:ssl => { alpn_protocols: %w[h2 http/1.1] },
|
||||
:timeout => Timeout.by(:per_operation),
|
||||
:headers => {},
|
||||
:cookies => {},
|
||||
@ -107,6 +107,8 @@ module HTTPX
|
||||
case k
|
||||
when :headers
|
||||
v1.merge(v2)
|
||||
when :ssl
|
||||
v1.merge(v2)
|
||||
else
|
||||
v2
|
||||
end
|
||||
|
@ -66,7 +66,7 @@ class OptionsSpec < Minitest::Test
|
||||
:body_threshold_size => 114_688,
|
||||
:form => {:bar => "bar"},
|
||||
:timeout => Timeout::PerOperation.new,
|
||||
:ssl => {:foo => "bar"},
|
||||
:ssl => {:foo => "bar", :alpn_protocols => %w[h2 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