diff --git a/lib/un.rb b/lib/un.rb index e2ee755ce0..e656a4a981 100644 --- a/lib/un.rb +++ b/lib/un.rb @@ -347,13 +347,20 @@ def httpd options[:Port] ||= 8080 # HTTP Alternate options[:DocumentRoot] = argv.shift || '.' s = nil - options[:StartCallback] = Proc.new do + options[:StartCallback] = proc { 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}") + if options[:SSLEnable] + addr = listener.addr + addr[3] = "127.0.0.1" if addr[3] == "0.0.0.0" + addr[3] = "::1" if addr[3] == "::" + logger.info(" https://#{Addrinfo.new(addr).inspect_sockaddr}") + else + logger.info(" http://#{listener.connect_address.inspect_sockaddr}") + end end - end + } s = WEBrick::HTTPServer.new(options) shut = proc {s.shutdown} siglist = %w"TERM QUIT"