[前][次][番号順一覧][スレッド一覧]

ruby-changes:67216

From: Kentaro <ko1@a...>
Date: Mon, 23 Aug 2021 09:59:36 +0900 (JST)
Subject: [ruby-changes:67216] 8361675e3a (master): Display httpd URLs

https://git.ruby-lang.org/ruby.git/commit/?id=8361675e3a

From 8361675e3a117b2cccee6bcc92440667fe35be7b Mon Sep 17 00:00:00 2001
From: Kentaro Goto <gotoken@n...>
Date: Mon, 26 Apr 2021 09:58:31 +0900
Subject: Display httpd URLs

---
 lib/un.rb | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/un.rb b/lib/un.rb
index 3f59e3f..e2ee755 100644
--- a/lib/un.rb
+++ b/lib/un.rb
@@ -346,6 +346,14 @@ def httpd https://github.com/ruby/ruby/blob/trunk/lib/un.rb#L346
     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"
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]