From 8361675e3a117b2cccee6bcc92440667fe35be7b Mon Sep 17 00:00:00 2001 From: Kentaro Goto Date: Mon, 26 Apr 2021 09:58:31 +0900 Subject: [PATCH] Display httpd URLs --- lib/un.rb | 8 ++++++++ 1 file changed, 8 insertions(+) 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"