lib/falcon/hosts.rb in falcon-0.18.5 vs lib/falcon/hosts.rb in falcon-0.18.6

- old
+ new

@@ -23,10 +23,11 @@ module Falcon class Host def initialize @app = nil @endpoint = nil + @ssl_certificate = nil @ssl_key = nil @ssl_context = nil end @@ -35,10 +36,11 @@ attr_accessor :endpoint attr_accessor :ssl_certificate attr_accessor :ssl_key + attr_accessor :ssl_context def freeze return if frozen? @@ -54,19 +56,19 @@ def ssl_key_path= path @ssl_key = OpenSSL::PKey::RSA.new(File.read(path)) end def ssl_context - @ssl_context ||= OpenSSL::SSL::SSLContext.new(:TLSv1).tap do |context| + @ssl_context ||= OpenSSL::SSL::SSLContext.new.tap do |context| context.cert = @ssl_certificate context.key = @ssl_key context.session_id_context = "falcon" context.set_params - context.freeze + context.setup end end def start if app = self.app @@ -99,22 +101,22 @@ reuse_address: true ) end def ssl_context - @server_context ||= OpenSSL::SSL::SSLContext.new(:TLSv1).tap do |context| + @server_context ||= OpenSSL::SSL::SSLContext.new.tap do |context| context.servername_cb = Proc.new do |socket, hostname| self.host_context(socket, hostname) end context.session_id_context = "falcon" context.alpn_protocols = DEFAULT_ALPN_PROTOCOLS context.set_params - context.freeze + context.setup end end def host_context(socket, hostname) if host = @named[hostname] @@ -134,8 +136,12 @@ def client_endpoints Hash[ @named.collect{|name, host| [name, host.endpoint]} ] + end + + def proxy + Proxy.new(Falcon::BadRequest, self.client_endpoints) end end end