Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow rack handler to accept ssl host #1129

Merged
merged 1 commit into from Dec 12, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/rack/handler/puma.rb
Expand Up @@ -35,6 +35,10 @@ def self.run(app, options = {})

if host && (host[0,1] == '.' || host[0,1] == '/')
c.bind "unix://#{host}"
elsif host && host =~ /^ssl:\/\//
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps not use a regular expression, but a String instance method?

elsif host && host.start_with?('ssl://')

uri = URI.parse(host)
uri.port ||= options[:Port] || ::Puma::Configuration::DefaultTCPPort
c.bind uri.to_s
else
host ||= ::Puma::Configuration::DefaultTCPHost
port = options[:Port] || ::Puma::Configuration::DefaultTCPPort
Expand Down