ruby-changes:37020
From: hsbt <ko1@a...>
Date: Fri, 2 Jan 2015 15:53:24 +0900 (JST)
Subject: [ruby-changes:37020] hsbt:r49101 (trunk): * lib/webrick/utils.rb: removed unused argument variable.
hsbt 2015-01-02 15:53:12 +0900 (Fri, 02 Jan 2015) New Revision: 49101 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49101 Log: * lib/webrick/utils.rb: removed unused argument variable. [fix GH-356] Patch by @vipulnsward * lib/webrick/server.rb: ditto. * lib/webrick/ssl.rb: ditto. * test/webrick/test_utils.rb: added test for WEBrick::Utils#create_listeners. Modified files: trunk/ChangeLog trunk/lib/webrick/server.rb trunk/lib/webrick/ssl.rb trunk/lib/webrick/utils.rb trunk/test/webrick/test_utils.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 49100) +++ ChangeLog (revision 49101) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Jan 2 15:53:00 2015 SHIBATA Hiroshi <shibata.hiroshi@g...> + + * lib/webrick/utils.rb: removed unused argument variable. + [fix GH-356] Patch by @vipulnsward + * lib/webrick/server.rb: ditto. + * lib/webrick/ssl.rb: ditto. + * test/webrick/test_utils.rb: added test for WEBrick::Utils#create_listeners. + Fri Jan 2 15:35:53 2015 SHIBATA Hiroshi <shibata.hiroshi@g...> * lib/securerandom.rb: improve syntax and grammar of documentation. Index: lib/webrick/utils.rb =================================================================== --- lib/webrick/utils.rb (revision 49100) +++ lib/webrick/utils.rb (revision 49101) @@ -63,7 +63,7 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/utils.rb#L63 # Creates TCP server sockets bound to +address+:+port+ and returns them. # # It will create IPV4 and IPV6 sockets on all interfaces. - def create_listeners(address, port, logger=nil) + def create_listeners(address, port) unless port raise ArgumentError, "must specify port" end Index: lib/webrick/ssl.rb =================================================================== --- lib/webrick/ssl.rb (revision 49100) +++ lib/webrick/ssl.rb (revision 49101) @@ -149,7 +149,7 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/ssl.rb#L149 # Updates +listen+ to enable SSL when the SSL configuration is active. def listen(address, port) # :nodoc: - listeners = Utils::create_listeners(address, port, @logger) + listeners = Utils::create_listeners(address, port) if @config[:SSLEnable] unless ssl_context @ssl_context = setup_ssl_context(@config) Index: lib/webrick/server.rb =================================================================== --- lib/webrick/server.rb (revision 49100) +++ lib/webrick/server.rb (revision 49101) @@ -130,7 +130,7 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/server.rb#L130 # WEBrick::Utils::create_listeners for details. def listen(address, port) - @listeners += Utils::create_listeners(address, port, @logger) + @listeners += Utils::create_listeners(address, port) setup_shutdown_pipe end Index: test/webrick/test_utils.rb =================================================================== --- test/webrick/test_utils.rb (revision 49100) +++ test/webrick/test_utils.rb (revision 49101) @@ -58,7 +58,11 @@ class TestWEBrickUtils < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/webrick/test_utils.rb#L58 do_test_timeout(WEBrick::Utils) end - #def test_timeout - # do_test_timeout(Timeout) - #end + def test_create_listeners + listeners = WEBrick::Utils.create_listeners("127.0.0.1", "9999") + srv = listeners.first + assert_equal true, srv.is_a?(TCPServer) + assert_equal ["AF_INET", 9999, "127.0.0.1", "127.0.0.1"], srv.addr + end + end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/