Sha256: eec57fd4a8738e9da542debdb16ed8126bdc913c0c41a1a31fa340e0b68f1728

Contents?: true

Size: 938 Bytes

Versions: 19

Compression:

Stored size: 938 Bytes

Contents

# CGI::Session#create_new_id requires 'digest/md5' on every call.  This makes
# sense when spawning processes per request, but is unnecessarily expensive
# when serving requests from a long-lived process.
#
# http://railsexpress.de/blog/articles/2005/11/22/speeding-up-the-creation-of-new-sessions
require 'cgi/session'
require 'digest/md5'

class CGI
  class Session #:nodoc:
    private
      # Create a new session id.
      #
      # The session id is an MD5 hash based upon the time,
      # a random number, and a constant string.  This routine
      # is used internally for automatically generated
      # session ids.
      def create_new_id
        md5 = Digest::MD5::new
        now = Time::now
        md5.update(now.to_s)
        md5.update(String(now.usec))
        md5.update(String(rand(0)))
        md5.update(String($$))
        md5.update('foobar')
        @new_session = true
        md5.hexdigest
      end
  end
end

Version data entries

19 entries across 19 versions & 4 rubygems

Version Path
jstorimer-deep-test-2.0.0 sample_rails_project/vendor/rails/actionpack/lib/action_controller/cgi_ext/session_performance_fix.rb
jstorimer-deep-test-1.4.0 sample_rails_project/vendor/rails/actionpack/lib/action_controller/cgi_ext/session_performance_fix.rb
jstorimer-deep-test-1.3.0 sample_rails_project/vendor/rails/actionpack/lib/action_controller/cgi_ext/session_performance_fix.rb
jstorimer-deep-test-1.2.0 sample_rails_project/vendor/rails/actionpack/lib/action_controller/cgi_ext/session_performance_fix.rb
jstorimer-deep-test-1.1.0 sample_rails_project/vendor/rails/actionpack/lib/action_controller/cgi_ext/session_performance_fix.rb
jstorimer-deep-test-1.0.0 sample_rails_project/vendor/rails/actionpack/lib/action_controller/cgi_ext/session_performance_fix.rb
jstorimer-deep-test-0.2.0 sample_rails_project/vendor/rails/actionpack/lib/action_controller/cgi_ext/session_performance_fix.rb
jstorimer-deep-test-0.1.0 sample_rails_project/vendor/rails/actionpack/lib/action_controller/cgi_ext/session_performance_fix.rb
actionpack-1.13.5 lib/action_controller/cgi_ext/session_performance_fix.rb
actionpack-1.13.6 lib/action_controller/cgi_ext/session_performance_fix.rb
actionpack-1.13.3 lib/action_controller/cgi_ext/session_performance_fix.rb
actionpack-1.13.4 lib/action_controller/cgi_ext/session_performance_fix.rb
radiant-0.6.1 vendor/rails/actionpack/lib/action_controller/cgi_ext/session_performance_fix.rb
radiant-0.6.0 vendor/rails/actionpack/lib/action_controller/cgi_ext/session_performance_fix.rb
radiant-0.6.2 vendor/rails/actionpack/lib/action_controller/cgi_ext/session_performance_fix.rb
radiant-0.6.3 vendor/rails/actionpack/lib/action_controller/cgi_ext/session_performance_fix.rb
radiant-0.6.4 vendor/rails/actionpack/lib/action_controller/cgi_ext/session_performance_fix.rb
rq-3.3.0 rails/vendor/rails/actionpack/lib/action_controller/cgi_ext/session_performance_fix.rb
rq-3.4.0 rails/vendor/rails/actionpack/lib/action_controller/cgi_ext/session_performance_fix.rb