1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Display httpd URLs

This commit is contained in:
Kentaro Goto 2021-04-26 09:58:31 +09:00 committed by Kentaro Goto
parent d7da5ca5e1
commit 8361675e3a
Notes: git 2021-08-23 09:59:43 +09:00

View file

@ -346,6 +346,14 @@ def httpd
end
options[:Port] ||= 8080 # HTTP Alternate
options[:DocumentRoot] = argv.shift || '.'
s = nil
options[:StartCallback] = Proc.new do
logger = s.logger
logger.info("To access this server, open this file in a browser:")
s.listeners.each do |listener|
logger.info(" http://#{listener.connect_address.inspect_sockaddr}")
end
end
s = WEBrick::HTTPServer.new(options)
shut = proc {s.shutdown}
siglist = %w"TERM QUIT"