summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--lib/webrick/server.rb2
-rw-r--r--lib/webrick/ssl.rb2
-rw-r--r--lib/webrick/utils.rb2
-rw-r--r--test/webrick/test_utils.rb10
5 files changed, 18 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 045a0a0..067ce8b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* lib/securerandom.rb: improve syntax and grammar of documentation.
diff --git a/lib/webrick/server.rb b/lib/webrick/server.rb
index 4aafd1e..f1f0d81 100644
--- a/lib/webrick/server.rb
+++ b/lib/webrick/server.rb
@@ -130,7 +130,7 @@ module WEBrick
# 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
diff --git a/lib/webrick/ssl.rb b/lib/webrick/ssl.rb
index 19c1e10..b69a836 100644
--- a/lib/webrick/ssl.rb
+++ b/lib/webrick/ssl.rb
@@ -149,7 +149,7 @@ module WEBrick
# 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)
diff --git a/lib/webrick/utils.rb b/lib/webrick/utils.rb
index 606ede5..5be4db8 100644
--- a/lib/webrick/utils.rb
+++ b/lib/webrick/utils.rb
@@ -63,7 +63,7 @@ module WEBrick
# 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
diff --git a/test/webrick/test_utils.rb b/test/webrick/test_utils.rb
index e63e0eb..d7ef365 100644
--- a/test/webrick/test_utils.rb
+++ b/test/webrick/test_utils.rb
@@ -58,7 +58,11 @@ class TestWEBrickUtils < Test::Unit::TestCase
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