Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8176

Show
Ignore:
Timestamp:
11/21/07 04:28:59 (1 year ago)
Author:
nzkoz
Message:

Refactor cookie_only option to survive multiple requests and add regression tests. References #10048. [theflow]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/cgi_process.rb

    r8088 r8176  
    3434 
    3535  class CgiRequest < AbstractRequest #:nodoc: 
    36     attr_accessor :cgi, :session_options, :cookie_only 
     36    attr_accessor :cgi, :session_options 
    3737    class SessionFixationAttempt < StandardError; end #:nodoc: 
    3838 
     
    4141      :prefix           => "ruby_sess.",    # prefix session file names 
    4242      :session_path     => "/",             # available to all paths in app 
     43      :session_key      => "_session_id", 
    4344      :cookie_only      => true 
    4445    } unless const_defined?(:DEFAULT_SESSION_OPTIONS) 
     
    4849      @session_options = session_options 
    4950      @env = @cgi.send!(:env_table) 
    50       @cookie_only = session_options.delete :cookie_only 
    5151      super() 
    5252    end 
     
    113113        else 
    114114          stale_session_check! do 
    115             if @cookie_only && request_parameters[session_options_with_string_keys['session_key']] 
     115            if cookie_only? && query_parameters[session_options_with_string_keys['session_key']] 
    116116              raise SessionFixationAttempt 
    117117            end 
     
    159159      end 
    160160 
     161      def cookie_only? 
     162        session_options_with_string_keys['cookie_only'] 
     163      end 
     164 
    161165      def stale_session_check! 
    162166        yield