Skip to content

Commit

Permalink
Use server_context for SSL.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Aug 5, 2018
1 parent badb09b commit 383cb06
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion falcon.gemspec
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
spec.add_dependency("rack", ">= 1.0")

spec.add_dependency('samovar', "~> 1.3")
spec.add_dependency('localhost', "~> 1.0")
spec.add_dependency('localhost', "~> 1.1")

spec.add_development_dependency "async-rspec", "~> 1.7"
spec.add_development_dependency "async-websocket", "~> 0.6.0"
Expand Down
2 changes: 1 addition & 1 deletion lib/falcon/command/serve.rb
Expand Up @@ -71,7 +71,7 @@ def load_app(verbose)
def run(verbose)
app, options = load_app(verbose)

endpoint = Endpoint.parse(@options[:bind], reuse_port: true, **@options)
endpoint = Endpoint.parse(@options[:bind], reuse_port: true)

bound_endpoint = Async::Reactor.run do
Async::IO::SharedEndpoint.bound(endpoint)
Expand Down
5 changes: 1 addition & 4 deletions lib/falcon/endpoint.rb
Expand Up @@ -33,10 +33,7 @@ def build_endpoint(endpoint = nil)
def build_ssl_context(hostname = self.hostname)
authority = Localhost::Authority.fetch(hostname)

OpenSSL::SSL::SSLContext.new.tap do |context|
context.cert = authority.certificate
context.key = authority.key

authority.server_context.tap do |context|
context.alpn_select_cb = lambda do |protocols|
if protocols.include? "h2"
return "h2"
Expand Down

0 comments on commit 383cb06

Please sign in to comment.