Class: ActionController::CgiRequest
Overview
Constant Summary
collapse
- DEFAULT_SESSION_OPTIONS =
{ :database_manager => CGI::Session::PStore, :prefix => "ruby_sess.", :session_path => "/" }
Instance Attribute Summary collapse
Instance Method Summary
collapse
#delete?, #domain, #get?, #head?, #host_with_port, #method, #parameters, #path, #port, #port_string, #post?, #protocol, #put?, #raw_post, #remote_ip, #request_uri, #ssl?, #subdomains
Constructor Details
#initialize(cgi, session_options = {}) ⇒ CgiRequest
Returns a new instance of CgiRequest.
43
44
45
46
47
|
# File 'lib/action_controller/cgi_process.rb', line 43
def initialize(cgi, session_options = {})
@cgi = cgi
@session_options = session_options
super()
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_id, *arguments) ⇒ Object
91
92
93
|
# File 'lib/action_controller/cgi_process.rb', line 91
def method_missing(method_id, *arguments)
@cgi.send(method_id, *arguments) rescue super
end
|
Instance Attribute Details
Returns the value of attribute cgi.
38
39
40
|
# File 'lib/action_controller/cgi_process.rb', line 38
def cgi
@cgi
end
|
Instance Method Details
61
62
63
|
# File 'lib/action_controller/cgi_process.rb', line 61
def cookies
@cgi.cookies.freeze
end
|
57
58
59
|
# File 'lib/action_controller/cgi_process.rb', line 57
def env
@cgi.send(:env_table)
end
|
65
66
67
|
# File 'lib/action_controller/cgi_process.rb', line 65
def host
env["HTTP_X_FORWARDED_HOST"] || @cgi.host.to_s.split(":").first
end
|
#query_parameters ⇒ Object
49
50
51
|
# File 'lib/action_controller/cgi_process.rb', line 49
def query_parameters
@cgi.query_string ? CGIMethods.parse_query_parameters(@cgi.query_string) : {}
end
|
#reset_session ⇒ Object
86
87
88
89
|
# File 'lib/action_controller/cgi_process.rb', line 86
def reset_session
@session.delete
@session = (@session_options == false ? {} : new_session)
end
|
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/action_controller/cgi_process.rb', line 69
def session
return @session unless @session.nil?
begin
@session = (@session_options == false ? {} : CGI::Session.new(@cgi, session_options_with_string_keys))
@session["__valid_session"]
return @session
rescue ArgumentError => e
@session.delete if @session
raise(
ActionController::SessionRestoreError,
"Session contained objects where the class definition wasn't available. " +
"Remember to require classes for all objects kept in the session. " +
"The session has been deleted."
)
end
end
|