diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index 0908669f..b9c1959d 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -833,7 +833,7 @@ module Sinatra private def route(verb, path, options={}, &block) # Because of self.options.host - host_name(options.delete(:host)) if options.key?(:host) + host_name(options.delete(:bind)) if options.key?(:host) options.each {|option, args| send(option, *args)} @@ -927,7 +927,7 @@ module Sinatra handler_name = handler.name.gsub(/.*::/, '') puts "== Sinatra/#{Sinatra::VERSION} has taken the stage " + "on #{port} for #{environment} with backup from #{handler_name}" unless handler_name =~/cgi/i - handler.run self, :Host => host, :Port => port do |server| + handler.run self, :Host => bind, :Port => port do |server| trap(:INT) do ## Use thins' hard #stop! if available, otherwise just #stop server.respond_to?(:stop!) ? server.stop! : server.stop @@ -1040,7 +1040,7 @@ module Sinatra set :run, false # start server via at-exit hook? set :running, false # is the built-in server running now? set :server, %w[thin mongrel webrick] - set :host, '0.0.0.0' + set :bind, '0.0.0.0' set :port, 4567 set :app_file, nil diff --git a/lib/sinatra/main.rb b/lib/sinatra/main.rb index d0afbfe3..56168001 100644 --- a/lib/sinatra/main.rb +++ b/lib/sinatra/main.rb @@ -17,7 +17,7 @@ module Sinatra op.on('-e env') { |val| set :environment, val.to_sym } op.on('-s server') { |val| set :server, val } op.on('-p port') { |val| set :port, val.to_i } - op.on('-h addr') { |val| set :host, val } + op.on('-b addr') { |val| set :bind, val } }.parse!(ARGV.dup) end end diff --git a/test/server_test.rb b/test/server_test.rb index 76d4ef97..886102a4 100644 --- a/test/server_test.rb +++ b/test/server_test.rb @@ -22,7 +22,7 @@ class ServerTest < Test::Unit::TestCase setup do mock_app { set :server, 'mock' - set :host, 'foo.local' + set :bind, 'foo.local' set :port, 9001 } $stdout = File.open('/dev/null', 'wb') diff --git a/test/settings_test.rb b/test/settings_test.rb index 610f55b5..78d6f995 100644 --- a/test/settings_test.rb +++ b/test/settings_test.rb @@ -306,10 +306,10 @@ class SettingsTest < Test::Unit::TestCase end end - describe 'host' do + describe 'bind' do it 'defaults to 0.0.0.0' do - assert_equal '0.0.0.0', @base.host - assert_equal '0.0.0.0', @application.host + assert_equal '0.0.0.0', @base.bind + assert_equal '0.0.0.0', @application.bind end end