diff options
author | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-03-23 10:09:07 +0000 |
---|---|---|
committer | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-03-23 10:09:07 +0000 |
commit | 3b6992be6712b7ec1a58f030b08ab53940db33ae (patch) | |
tree | 7cd71f8f00a9fc3ce650e2f8720f26aa848d6fb3 /lib/webrick/utils.rb | |
parent | 28199eeae85647c68fd03682c464221be3b88dbe (diff) |
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/webrick/utils.rb')
-rw-r--r-- | lib/webrick/utils.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/webrick/utils.rb b/lib/webrick/utils.rb index 41b54271c7..7283704c1d 100644 --- a/lib/webrick/utils.rb +++ b/lib/webrick/utils.rb @@ -49,6 +49,9 @@ module WEBrick module_function :getservername def create_listeners(address, port, logger=nil) + unless port + raise ArgumentError, "must specify port" + end res = Socket::getaddrinfo(address, port, Socket::AF_UNSPEC, # address family Socket::SOCK_STREAM, # socket type @@ -58,8 +61,9 @@ module WEBrick sockets = [] res.each{|ai| begin - logger.debug("TCPServer.new(#{ai[3]}, #{ai[1]})") if logger - sock = TCPServer.new(ai[3], ai[1]) + logger.debug("TCPServer.new(#{ai[3]}, #{port})") if logger + sock = TCPServer.new(ai[3], port) + port = sock.addr[1] if port == 0 Utils::set_close_on_exec(sock) sockets << sock rescue => ex |