summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-22 01:07:39 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-22 01:07:39 +0000
commitedddc28f6255364a4acfcaab3e2c0834f174f734 (patch)
treea0d0415ce4efb9bf26c3aca798299d1d538ea97c /lib
parente2479cc43febe9cf26093fa2103a199d2d245711 (diff)
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
Diffstat (limited to 'lib')
-rw-r--r--lib/webrick/httpauth/htdigest.rb4
-rw-r--r--lib/webrick/httpauth/htgroup.rb4
-rw-r--r--lib/webrick/httpauth/htpasswd.rb4
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