Skip to content

Commit

Permalink
revert conditionals to master
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Dec 17, 2019
1 parent d49aa81 commit 368effd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/rack/session/abstract/id.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
rescue LoadError
# We just won't get securerandom
end
require "digest/sha2"

module Rack

Expand Down Expand Up @@ -360,7 +361,7 @@ def commit_session(env, status, headers, body)

if options[:drop] || options[:renew]
session_id = destroy_session(env, session.id || generate_sid, options)
return if session_id.nil?
return unless session_id
end

return [status, headers, body] unless commit_session?(env, session, options)
Expand Down
2 changes: 1 addition & 1 deletion lib/rack/session/memcache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def generate_sid

def get_session(env, sid)
with_lock(env) do
unless !sid.nil? and session = @pool.get(sid.private_id)
unless sid and session = @pool.get(sid.private_id)
sid, session = generate_sid, {}
unless /^STORED/ =~ @pool.add(sid.private_id, session)
raise "Session collision on '#{sid.inspect}'"
Expand Down
2 changes: 1 addition & 1 deletion lib/rack/session/pool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def generate_sid

def get_session(env, sid)
with_lock(env) do
unless !sid.nil? and session = @pool[sid.private_id]
unless sid and session = @pool[sid.private_id]
sid, session = generate_sid, {}
@pool.store sid.private_id, session
end
Expand Down

0 comments on commit 368effd

Please sign in to comment.