module Roda::RodaPlugins::SinatraHelpers::RequestMethods
def uri(addr = nil, absolute = true, add_script_name = true)
Generates the absolute URI for a given path in the app.
def uri(addr = nil, absolute = true, add_script_name = true) addr = addr.to_s if addr return addr if addr =~ /\A[A-z][A-z0-9\+\.\-]*:/ uri = if absolute h = if @env.has_key?("HTTP_X_FORWARDED_HOST") || port != (ssl? ? 443 : 80) host_with_port else host end ["http#{'s' if ssl?}://#{h}"] else [''] end uri << script_name.to_s if add_script_name uri << (addr || path_info) File.join(uri) end