зеркало из https://github.com/github/ruby.git
Display httpd URLs supporting HTTPS
This commit is contained in:
Родитель
8361675e3a
Коммит
f18e1752dc
13
lib/un.rb
13
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"
|
||||
|
|
Загрузка…
Ссылка в новой задаче