summaryrefslogtreecommitdiff
path: root/lib/un.rb
diff options
authorKentaro Goto <gotoken@notwork.org>2021-04-26 09:58:31 +0900
committerKentaro Goto <gotoken+github@gmail.com>2021-08-23 09:59:09 +0900
commit8361675e3a117b2cccee6bcc92440667fe35be7b (patch)
treedce8ed8bd1a92045862ef6452222092a58ad591f /lib/un.rb
parentd7da5ca5e1a6b0b17c31ba821b6217bbabcc1fca (diff)
Display httpd URLs
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4415
Diffstat (limited to 'lib/un.rb')
-rw-r--r--lib/un.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/un.rb b/lib/un.rb
index 3f59e3ff8b..e2ee755ce0 100644
--- a/lib/un.rb
+++ b/lib/un.rb
@@ -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"
close