*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
28199eeae8
commit
3b6992be67
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
Wed Mar 23 19:08:10 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||||
|
|
||||||
|
* lib/webrick/utils.rb (WEBrick::Utils.create_listeners):
|
||||||
|
- should raise ArgumentError if no port is specified.
|
||||||
|
- even if the specified port is 0, all TCPServers should be
|
||||||
|
initialized with the port given to the first one.
|
||||||
|
|
||||||
|
* lib/webrick/server.rb (WEBrick::GenericServer#initialize): if :Port
|
||||||
|
parameter is 0, it should be updated with the port number which
|
||||||
|
ectually listened.
|
||||||
|
|
||||||
Wed Mar 23 16:12:40 2005 Shugo Maeda <shugo@ruby-lang.org>
|
Wed Mar 23 16:12:40 2005 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
* parse.y (primary): fix lineno of rescue and ensure.
|
* parse.y (primary): fix lineno of rescue and ensure.
|
||||||
|
@ -61,6 +61,9 @@ module WEBrick
|
|||||||
warn(":Listen option is deprecated; use GenericServer#listen")
|
warn(":Listen option is deprecated; use GenericServer#listen")
|
||||||
end
|
end
|
||||||
listen(@config[:BindAddress], @config[:Port])
|
listen(@config[:BindAddress], @config[:Port])
|
||||||
|
if @config[:Port] == 0
|
||||||
|
@config[:Port] = @listeners[0].addr[1]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -49,6 +49,9 @@ module WEBrick
|
|||||||
module_function :getservername
|
module_function :getservername
|
||||||
|
|
||||||
def create_listeners(address, port, logger=nil)
|
def create_listeners(address, port, logger=nil)
|
||||||
|
unless port
|
||||||
|
raise ArgumentError, "must specify port"
|
||||||
|
end
|
||||||
res = Socket::getaddrinfo(address, port,
|
res = Socket::getaddrinfo(address, port,
|
||||||
Socket::AF_UNSPEC, # address family
|
Socket::AF_UNSPEC, # address family
|
||||||
Socket::SOCK_STREAM, # socket type
|
Socket::SOCK_STREAM, # socket type
|
||||||
@ -58,8 +61,9 @@ module WEBrick
|
|||||||
sockets = []
|
sockets = []
|
||||||
res.each{|ai|
|
res.each{|ai|
|
||||||
begin
|
begin
|
||||||
logger.debug("TCPServer.new(#{ai[3]}, #{ai[1]})") if logger
|
logger.debug("TCPServer.new(#{ai[3]}, #{port})") if logger
|
||||||
sock = TCPServer.new(ai[3], ai[1])
|
sock = TCPServer.new(ai[3], port)
|
||||||
|
port = sock.addr[1] if port == 0
|
||||||
Utils::set_close_on_exec(sock)
|
Utils::set_close_on_exec(sock)
|
||||||
sockets << sock
|
sockets << sock
|
||||||
rescue => ex
|
rescue => ex
|
||||||
|
Loading…
x
Reference in New Issue
Block a user