/usr/lib/ruby/vendor_ruby/mechanize/test_case/form_servlet.rb is in ruby-mechanize 2.7.2-1.
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 53 54 | class FormServlet < WEBrick::HTTPServlet::AbstractServlet
def do_GET(req, res)
res.content_type = 'text/html'
query = []
req.query.each_key { |k|
key = WEBrick::HTTPUtils.unescape k
req.query[k].each_data { |data|
value = WEBrick::HTTPUtils.unescape data
query << "<li><a href=\"#\">#{key}:#{value}</a>"
}
}
res.body = <<-BODY
<!DOCTYPE html>
<title>GET results</title>
<ul>
#{query.join "\n"}
</ul>
<div id=\"query\">#{req.query}</div>
BODY
end
def do_POST(req, res)
res.content_type = 'text/html'
query = []
req.query.each_key { |k|
key = WEBrick::HTTPUtils.unescape k
req.query[k].each_data { |data|
value = WEBrick::HTTPUtils.unescape data
query << "<li><a href=\"#\">#{key}:#{value}</a>"
}
}
res.body = <<-BODY
<!DOCTYPE html>
<title>POST results</title>
<ul>
#{query.join "\n"}
</ul>
<div id=\"query\">#{req.body}</div>
BODY
end
end
|