1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
normal 2017-12-22 01:07:39 +00:00
parent e2479cc43f
commit edddc28f62
3 changed files with 6 additions and 6 deletions

View file

@ -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)

View file

@ -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*/)

View file

@ -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