From edddc28f6255364a4acfcaab3e2c0834f174f734 Mon Sep 17 00:00:00 2001 From: normal Date: Fri, 22 Dec 2017 01:07:39 +0000 Subject: 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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/webrick/httpauth/htdigest.rb | 4 ++-- lib/webrick/httpauth/htgroup.rb | 4 ++-- lib/webrick/httpauth/htpasswd.rb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/webrick/httpauth/htdigest.rb b/lib/webrick/httpauth/htdigest.rb index 1b42c02dfa..c35b38433b 100644 --- a/lib/webrick/httpauth/htdigest.rb +++ b/lib/webrick/httpauth/htdigest.rb @@ -40,7 +40,7 @@ module WEBrick @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 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) diff --git a/lib/webrick/httpauth/htgroup.rb b/lib/webrick/httpauth/htgroup.rb index 832ae8bd04..399a62c37f 100644 --- a/lib/webrick/httpauth/htgroup.rb +++ b/lib/webrick/httpauth/htgroup.rb @@ -36,7 +36,7 @@ module WEBrick @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 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*/) diff --git a/lib/webrick/httpauth/htpasswd.rb b/lib/webrick/httpauth/htpasswd.rb index 8c7b09463b..976eeeb13e 100644 --- a/lib/webrick/httpauth/htpasswd.rb +++ b/lib/webrick/httpauth/htpasswd.rb @@ -40,7 +40,7 @@ module WEBrick @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 mtime = File::mtime(@path) if mtime > @mtime @passwd.clear - open(@path){|io| + File.open(@path){|io| while line = io.gets line.chomp! case line -- cgit v1.2.1