# File lib/action_controller/session/abstract_store.rb, line 150 def initialize(app, options = {}) # Process legacy CGI options options = options.symbolize_keys if options.has_key?(:session_path) ActiveSupport::Deprecation.warn "Giving :session_path to SessionStore is deprecated, " << "please use :path instead", caller options[:path] = options.delete(:session_path) end if options.has_key?(:session_key) ActiveSupport::Deprecation.warn "Giving :session_key to SessionStore is deprecated, " << "please use :key instead", caller options[:key] = options.delete(:session_key) end if options.has_key?(:session_http_only) ActiveSupport::Deprecation.warn "Giving :session_http_only to SessionStore is deprecated, " << "please use :httponly instead", caller options[:httponly] = options.delete(:session_http_only) end @app = app @default_options = DEFAULT_OPTIONS.merge(options) @key = @default_options[:key] @cookie_only = @default_options[:cookie_only] end
# File lib/action_controller/session/abstract_store.rb, line 175 def call(env) prepare!(env) response = @app.call(env) session_data = env[ENV_SESSION_KEY] options = env[ENV_SESSION_OPTIONS_KEY] if !session_data.is_a?(AbstractStore::SessionHash) || session_data.loaded? || options[:expire_after] request = ActionController::Request.new(env) return response if (options[:secure] && !request.ssl?) session_data.send(:load!) if session_data.is_a?(AbstractStore::SessionHash) && !session_data.loaded? sid = options[:id] || generate_sid unless set_session(env, sid, session_data.to_hash) return response end request_cookies = env["rack.request.cookie_hash"] if (request_cookies.nil? || request_cookies[@key] != sid) || options[:expire_after] cookie = {:value => sid} cookie[:expires] = Time.now + options[:expire_after] if options[:expire_after] Rack::Utils.set_cookie_header!(response[1], @key, cookie.merge(options)) end end response end
Generated with the Darkfish Rdoc Generator 2.