Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix renew feature on cookies.

  • Loading branch information...
commit afc3ccf74cbb6c3d495558e934ced1c006dacda8 1 parent 6b79463
@josevalim josevalim authored
View
2  actionpack/lib/action_dispatch/middleware/session/cookie_store.rb
@@ -59,7 +59,7 @@ def unpacked_cookie_data(env)
end
def set_session(env, sid, session_data, options)
- persistent_session_id!(session_data, sid)
+ session_data.merge("session_id" => sid)
end
def set_cookie(env, session_id, cookie)
View
16 actionpack/test/dispatch/session/cookie_store_test.rb
@@ -50,6 +50,11 @@ def change_session_id
get_session_id
end
+ def renew_session_id
+ request.session_options[:renew] = true
+ head :ok
+ end
+
def rescue_action(e) raise end
end
@@ -102,6 +107,17 @@ def test_does_not_set_secure_cookies_over_http
end
end
+ def test_properly_renew_cookies
+ with_test_route_set do
+ get '/set_session_value'
+ get '/persistent_session_id'
+ session_id = response.body
+ get '/renew_session_id'
+ get '/persistent_session_id'
+ assert_not_equal response.body, session_id
+ end
+ end
+
def test_does_set_secure_cookies_over_https
with_test_route_set(:secure => true) do
get '/set_session_value', nil, 'HTTPS' => 'on'
Please sign in to comment.
Something went wrong with that request. Please try again.