From 87fd86ef22b6b80fa75dd8e50f53a4e62e8339f7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 2 Feb 2011 15:22:02 -0800 Subject: allow binding on IPv6 sockets with listen "[#{addr}]:#{port}" This is much like how nginx does it, except we always require a port when explicitly binding to IPv6 using the "listen" directive. This also adds support to listen with an address-only, which can be useful to Rainbows! users. --- test/unit/test_configurator.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/unit') diff --git a/test/unit/test_configurator.rb b/test/unit/test_configurator.rb index ac1efa8..c19c427 100644 --- a/test/unit/test_configurator.rb +++ b/test/unit/test_configurator.rb @@ -33,6 +33,14 @@ class TestConfigurator < Test::Unit::TestCase assert_equal "0.0.0.0:2007", meth.call('2007') assert_equal "0.0.0.0:2007", meth.call(2007) + %w([::1]:2007 [::]:2007).each do |addr| + assert_equal addr, meth.call(addr.dup) + end + + # for Rainbows! users only + assert_equal "[::]:80", meth.call("[::]") + assert_equal "127.6.6.6:80", meth.call("127.6.6.6") + # the next two aren't portable, consider them unsupported for now # assert_match %r{\A\d+\.\d+\.\d+\.\d+:2007\z}, meth.call('1:2007') # assert_match %r{\A\d+\.\d+\.\d+\.\d+:2007\z}, meth.call('2:2007') -- cgit v1.2.3-24-ge0c7