ruby-changes:49280
From: normal <ko1@a...>
Date: Fri, 22 Dec 2017 10:07:45 +0900 (JST)
Subject: [ruby-changes:49280] normal:r61397 (trunk): webrick: httpauth requires regular files
normal 2017-12-22 10:07:39 +0900 (Fri, 22 Dec 2017) New Revision: 61397 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61397 Log: webrick: httpauth requires regular files Be sure we do not try to open a pipe to read from, since we care about mtime in all cases. * lib/webrick/httpauth/htdigest.rb: use File.open * lib/webrick/httpauth/htgroup.rb: ditto * lib/webrick/httpauth/htpasswd.rb: ditto [Misc #14216] Modified files: trunk/lib/webrick/httpauth/htdigest.rb trunk/lib/webrick/httpauth/htgroup.rb trunk/lib/webrick/httpauth/htpasswd.rb Index: lib/webrick/httpauth/htgroup.rb =================================================================== --- lib/webrick/httpauth/htgroup.rb (revision 61396) +++ lib/webrick/httpauth/htgroup.rb (revision 61397) @@ -36,7 +36,7 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/httpauth/htgroup.rb#L36 @path = path @mtime = Time.at(0) @group = Hash.new - open(@path,"a").close unless File::exist?(@path) + File.open(@path,"a").close unless File.exist?(@path) reload end @@ -46,7 +46,7 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/httpauth/htgroup.rb#L46 def reload if (mtime = File::mtime(@path)) > @mtime @group.clear - open(@path){|io| + File.open(@path){|io| while line = io.gets line.chomp! group, members = line.split(/:\s*/) Index: lib/webrick/httpauth/htdigest.rb =================================================================== --- lib/webrick/httpauth/htdigest.rb (revision 61396) +++ lib/webrick/httpauth/htdigest.rb (revision 61397) @@ -40,7 +40,7 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/httpauth/htdigest.rb#L40 @digest = Hash.new @mutex = Thread::Mutex::new @auth_type = DigestAuth - open(@path,"a").close unless File::exist?(@path) + File.open(@path,"a").close unless File.exist?(@path) reload end @@ -51,7 +51,7 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/httpauth/htdigest.rb#L51 mtime = File::mtime(@path) if mtime > @mtime @digest.clear - open(@path){|io| + File.open(@path){|io| while line = io.gets line.chomp! user, realm, pass = line.split(/:/, 3) Index: lib/webrick/httpauth/htpasswd.rb =================================================================== --- lib/webrick/httpauth/htpasswd.rb (revision 61396) +++ lib/webrick/httpauth/htpasswd.rb (revision 61397) @@ -40,7 +40,7 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/httpauth/htpasswd.rb#L40 @mtime = Time.at(0) @passwd = Hash.new @auth_type = BasicAuth - open(@path,"a").close unless File::exist?(@path) + File.open(@path,"a").close unless File.exist?(@path) reload end @@ -51,7 +51,7 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/httpauth/htpasswd.rb#L51 mtime = File::mtime(@path) if mtime > @mtime @passwd.clear - open(@path){|io| + File.open(@path){|io| while line = io.gets line.chomp! case line -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/