Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

display un.rb httpd URLs #4415

Merged
merged 3 commits into from Aug 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions lib/un.rb
Expand Up @@ -346,6 +346,21 @@ def httpd
end
options[:Port] ||= 8080 # HTTP Alternate
options[:DocumentRoot] = argv.shift || '.'
s = nil
options[:StartCallback] = proc {
logger = s.logger
logger.info("To access this server, open this URL in a browser:")
s.listeners.each do |listener|
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
}
s = WEBrick::HTTPServer.new(options)
shut = proc {s.shutdown}
siglist = %w"TERM QUIT"
Expand Down