* 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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2015-01-02 06:53:12 +00:00
parent 045de8a9c5
commit 73fc0cc572
5 changed files with 18 additions and 6 deletions

View File

@ -1,3 +1,11 @@
Fri Jan 2 15:53:00 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
* 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@gmail.com> Fri Jan 2 15:35:53 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
* lib/securerandom.rb: improve syntax and grammar of documentation. * lib/securerandom.rb: improve syntax and grammar of documentation.

View File

@ -130,7 +130,7 @@ module WEBrick
# WEBrick::Utils::create_listeners for details. # WEBrick::Utils::create_listeners for details.
def listen(address, port) def listen(address, port)
@listeners += Utils::create_listeners(address, port, @logger) @listeners += Utils::create_listeners(address, port)
setup_shutdown_pipe setup_shutdown_pipe
end end

View File

@ -149,7 +149,7 @@ module WEBrick
# Updates +listen+ to enable SSL when the SSL configuration is active. # Updates +listen+ to enable SSL when the SSL configuration is active.
def listen(address, port) # :nodoc: def listen(address, port) # :nodoc:
listeners = Utils::create_listeners(address, port, @logger) listeners = Utils::create_listeners(address, port)
if @config[:SSLEnable] if @config[:SSLEnable]
unless ssl_context unless ssl_context
@ssl_context = setup_ssl_context(@config) @ssl_context = setup_ssl_context(@config)

View File

@ -63,7 +63,7 @@ module WEBrick
# Creates TCP server sockets bound to +address+:+port+ and returns them. # Creates TCP server sockets bound to +address+:+port+ and returns them.
# #
# It will create IPV4 and IPV6 sockets on all interfaces. # It will create IPV4 and IPV6 sockets on all interfaces.
def create_listeners(address, port, logger=nil) def create_listeners(address, port)
unless port unless port
raise ArgumentError, "must specify port" raise ArgumentError, "must specify port"
end end

View File

@ -58,7 +58,11 @@ class TestWEBrickUtils < Test::Unit::TestCase
do_test_timeout(WEBrick::Utils) do_test_timeout(WEBrick::Utils)
end end
#def test_timeout def test_create_listeners
# do_test_timeout(Timeout) listeners = WEBrick::Utils.create_listeners("127.0.0.1", "9999")
#end 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 end