Bug #1822 ยป webrick.patch
lib/webrick/httpservlet/abstract.rb | ||
---|---|---|
end
|
||
def do_OPTIONS(req, res)
|
||
m = self.methods.grep(/^do_[A-Z]+$/)
|
||
m.collect!{|i| i.sub(/do_/, "") }
|
||
m.sort!
|
||
res["allow"] = m.join(",")
|
||
res["allow"] = methods.grep(/^do_[A-Z]+$/).collect { |m|
|
||
m.to_s.sub(/do_/, "")
|
||
}.sort.join(',')
|
||
end
|
||
private
|
test/webrick/test_filehandler.rb | ||
---|---|---|
return res
|
||
end
|
||
def test_do_options
|
||
req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
|
||
res = WEBrick::HTTPResponse.new(WEBrick::Config::HTTP)
|
||
handler = default_file_handler(__FILE__)
|
||
handler.do_OPTIONS(req, res)
|
||
allow_list = res['allow'].split(',')
|
||
assert allow_list.length > 0, "allow list should be greater than 0"
|
||
res['allow'].split(',').each do |option|
|
||
assert(
|
||
handler.respond_to?(:"do_#{option}"),
|
||
"handler should respond to do_#{option}"
|
||
)
|
||
end
|
||
end
|
||
def test_make_partial_content
|
||
filename = __FILE__
|
||
filesize = File.size(filename)
|