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:
parent
e2479cc43f
commit
edddc28f62
3 changed files with 6 additions and 6 deletions
|
@ -40,7 +40,7 @@ module WEBrick
|
||||||
@digest = Hash.new
|
@digest = Hash.new
|
||||||
@mutex = Thread::Mutex::new
|
@mutex = Thread::Mutex::new
|
||||||
@auth_type = DigestAuth
|
@auth_type = DigestAuth
|
||||||
open(@path,"a").close unless File::exist?(@path)
|
File.open(@path,"a").close unless File.exist?(@path)
|
||||||
reload
|
reload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ module WEBrick
|
||||||
mtime = File::mtime(@path)
|
mtime = File::mtime(@path)
|
||||||
if mtime > @mtime
|
if mtime > @mtime
|
||||||
@digest.clear
|
@digest.clear
|
||||||
open(@path){|io|
|
File.open(@path){|io|
|
||||||
while line = io.gets
|
while line = io.gets
|
||||||
line.chomp!
|
line.chomp!
|
||||||
user, realm, pass = line.split(/:/, 3)
|
user, realm, pass = line.split(/:/, 3)
|
||||||
|
|
|
@ -36,7 +36,7 @@ module WEBrick
|
||||||
@path = path
|
@path = path
|
||||||
@mtime = Time.at(0)
|
@mtime = Time.at(0)
|
||||||
@group = Hash.new
|
@group = Hash.new
|
||||||
open(@path,"a").close unless File::exist?(@path)
|
File.open(@path,"a").close unless File.exist?(@path)
|
||||||
reload
|
reload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ module WEBrick
|
||||||
def reload
|
def reload
|
||||||
if (mtime = File::mtime(@path)) > @mtime
|
if (mtime = File::mtime(@path)) > @mtime
|
||||||
@group.clear
|
@group.clear
|
||||||
open(@path){|io|
|
File.open(@path){|io|
|
||||||
while line = io.gets
|
while line = io.gets
|
||||||
line.chomp!
|
line.chomp!
|
||||||
group, members = line.split(/:\s*/)
|
group, members = line.split(/:\s*/)
|
||||||
|
|
|
@ -40,7 +40,7 @@ module WEBrick
|
||||||
@mtime = Time.at(0)
|
@mtime = Time.at(0)
|
||||||
@passwd = Hash.new
|
@passwd = Hash.new
|
||||||
@auth_type = BasicAuth
|
@auth_type = BasicAuth
|
||||||
open(@path,"a").close unless File::exist?(@path)
|
File.open(@path,"a").close unless File.exist?(@path)
|
||||||
reload
|
reload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ module WEBrick
|
||||||
mtime = File::mtime(@path)
|
mtime = File::mtime(@path)
|
||||||
if mtime > @mtime
|
if mtime > @mtime
|
||||||
@passwd.clear
|
@passwd.clear
|
||||||
open(@path){|io|
|
File.open(@path){|io|
|
||||||
while line = io.gets
|
while line = io.gets
|
||||||
line.chomp!
|
line.chomp!
|
||||||
case line
|
case line
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue