/usr/lib/ruby/vendor_ruby/rack/auth/digest/params.rb is in ruby-rack 1.6.4-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | module Rack
module Auth
module Digest
class Params < Hash
def self.parse(str)
Params[*split_header_value(str).map do |param|
k, v = param.split('=', 2)
[k, dequote(v)]
end.flatten]
end
def self.dequote(str) # From WEBrick::HTTPUtils
ret = (/\A"(.*)"\Z/ =~ str) ? $1 : str.dup
ret.gsub!(/\\(.)/, "\\1")
ret
end
def self.split_header_value(str)
str.scan( /(\w+\=(?:"[^\"]+"|[^,]+))/n ).collect{ |v| v[0] }
end
def initialize
super()
yield self if block_given?
end
def [](k)
super k.to_s
end
def []=(k, v)
super k.to_s, v.to_s
end
UNQUOTED = ['nc', 'stale']
def to_s
map do |k, v|
"#{k}=" + (UNQUOTED.include?(k) ? v.to_s : quote(v))
end.join(', ')
end
def quote(str) # From WEBrick::HTTPUtils
'"' << str.gsub(/[\\\"]/o, "\\\1") << '"'
end
end
end
end
end
|