class Vpim::Agent::Base
Public Instance Methods
css(template)
click to toggle source
# File lib/vpim/agent/base.rb, line 22 def css(template) render :css, template, {} end
host_port()
click to toggle source
URL-ready form of the host and port, where the port isn't specified if it is the default for the URL scheme.
# File lib/vpim/agent/base.rb, line 52 def host_port r = request host_port = r.host if r.scheme == "https" && r.port != 443 || r.scheme == "http" && r.port != 80 host_port << ":#{r.port}" end host_port end
request_path()
click to toggle source
Complete path, as requested by the client. Take care about CGI path rewriting.
# File lib/vpim/agent/base.rb, line 31 def request_path # Using .to_s because rack/request.rb does, though I think the Rack # spec requires these to be strings already. begin URI.parse(env["SCRIPT_URI"].to_s).path rescue env["SCRIPT_NAME"].to_s + env["PATH_INFO"].to_s end end
script_path()
click to toggle source
Complete path, as requested by the client, without the env's PATH_INFO. This is the path to whatever is “handling” the request.
Recent discussions on how PATH_INFO must be decoded leads me to think this might not work if the path had any URL encoded characters in it.
# File lib/vpim/agent/base.rb, line 46 def script_path request_path.sub(/#{env["PATH_INFO"]}$/, "") end
script_url()
click to toggle source
URL to the script
# File lib/vpim/agent/base.rb, line 65 def script_url request.scheme + "://" + host_port + script_path end