/usr/lib/ruby/1.8/merb-core/rack/helpers.rb is in libmerb-core-ruby1.8 1.0.12+dfsg-4fakesync1.
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 | module Merb
module Rack
module Helpers
# A helper to build a rack response which implements a redirect. The status will be set to
# the passed in status if passed. If you pass in permanent it will be a 301, permanent redirect,
# otherwise it defaults to a temporary 302 redirect.
#
# ==== Parameters
# url<~to_s>:: The url to redirect to.
# options<Hash>:: A hash of options for the redirect
# status: The status code to use for the redirect
# permanent: True if this is a permanent redirect (301)
#
# ==== Returns
# <Array>:: A rack response to redirect to the specified url.
#
# :api: plugin
def self.redirect(url, options = {})
# Build the rack array
status = options.delete(:status)
status ||= options[:permanent] ? 301 : 302
Merb.logger.info("Dispatcher redirecting to: #{url} (#{status})")
Merb.logger.flush
[status, { Merb::Const::LOCATION => url },
Merb::Rack::StreamWrapper.new("<html><body>You are being <a href=\"#{url}\">redirected</a>.</body></html>")]
end
end
end
end
|