Skip to content

Commit

Permalink
Revert "Update Thin handler to better handle more options"
Browse files Browse the repository at this point in the history
This reverts commit 371bd58.

This broke the thin adapter.  Reverting it restores the previous
behavior.  This was added to make SSL configuration easier.  Users
who want to do that should use the thin executable instead of the
rackup executable.

Fixes #1583
  • Loading branch information
jeremyevans committed Feb 9, 2020
1 parent 9b211e7 commit b9262d6
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions lib/rack/handler/thin.rb
Expand Up @@ -12,20 +12,14 @@ def self.run(app, **options)
environment = ENV['RACK_ENV'] || 'development'
default_host = environment == 'development' ? 'localhost' : '0.0.0.0'

if block_given?
host = options.delete(:Host) || default_host
port = options.delete(:Port) || 8080
args = [host, port, app, options]
# Thin versions below 0.8.0 do not support additional options
args.pop if ::Thin::VERSION::MAJOR < 1 && ::Thin::VERSION::MINOR < 8
server = ::Thin::Server.new(*args)
yield server
server.start
else
options[:address] = options[:Host] || default_host
options[:port] = options[:Port] || 8080
::Thin::Controllers::Controller.new(options).start
end
host = options.delete(:Host) || default_host
port = options.delete(:Port) || 8080
args = [host, port, app, options]
# Thin versions below 0.8.0 do not support additional options
args.pop if ::Thin::VERSION::MAJOR < 1 && ::Thin::VERSION::MINOR < 8
server = ::Thin::Server.new(*args)
yield server if block_given?
server.start
end

def self.valid_options
Expand Down

3 comments on commit b9262d6

@ioquatix
Copy link
Member

Choose a reason for hiding this comment

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

@jeremyevans should we cherry pick this into 2-2-stable and do a patch release?

@jeremyevans
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We probably should.

@ioquatix
Copy link
Member

Choose a reason for hiding this comment

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

Okay, I can do this today.

Please sign in to comment.