diff options
author | Joshua Peek <josh@joshpeek.com> | 2008-12-15 16:33:31 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-12-15 16:33:31 -0600 |
commit | ed708307137c811d14e5fd2cb4ea550add381a82 (patch) | |
tree | 31cb7df0a489bb4bbb0a9bc9edb24a70a869a0d1 /actionpack/lib/action_controller/cgi_ext/session.rb | |
parent | e8c1915416579a3840573ca2c80822d96cb31823 (diff) | |
download | rails-ed708307137c811d14e5fd2cb4ea550add381a82.tar.gz rails-ed708307137c811d14e5fd2cb4ea550add381a82.tar.bz2 rails-ed708307137c811d14e5fd2cb4ea550add381a82.zip |
Switch to Rack based session stores.
Diffstat (limited to 'actionpack/lib/action_controller/cgi_ext/session.rb')
-rw-r--r-- | actionpack/lib/action_controller/cgi_ext/session.rb | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/actionpack/lib/action_controller/cgi_ext/session.rb b/actionpack/lib/action_controller/cgi_ext/session.rb deleted file mode 100644 index d3f85e3705..0000000000 --- a/actionpack/lib/action_controller/cgi_ext/session.rb +++ /dev/null @@ -1,53 +0,0 @@ -require 'digest/md5' -require 'cgi/session' -require 'cgi/session/pstore' - -class CGI #:nodoc: - # * Expose the CGI instance to session stores. - # * Don't require 'digest/md5' whenever a new session id is generated. - class Session #:nodoc: - def self.generate_unique_id(constant = nil) - ActiveSupport::SecureRandom.hex(16) - end - - # Make the CGI instance available to session stores. - attr_reader :cgi - attr_reader :dbman - alias_method :initialize_without_cgi_reader, :initialize - def initialize(cgi, options = {}) - @cgi = cgi - initialize_without_cgi_reader(cgi, options) - end - - private - # Create a new session id. - def create_new_id - @new_session = true - self.class.generate_unique_id - end - - # * Don't require 'digest/md5' whenever a new session is started. - class PStore #:nodoc: - def initialize(session, option={}) - dir = option['tmpdir'] || Dir::tmpdir - prefix = option['prefix'] || '' - id = session.session_id - md5 = Digest::MD5.hexdigest(id)[0,16] - path = dir+"/"+prefix+md5 - path.untaint - if File::exist?(path) - @hash = nil - else - unless session.new_session - raise CGI::Session::NoSession, "uninitialized session" - end - @hash = {} - end - @p = ::PStore.new(path) - @p.transaction do |p| - File.chmod(0600, p.path) - end - end - end - end -end |