This project is archived and is in readonly mode.
ActionController::Flash::InstanceMethods::flash triggers the lazy sessions
Reported by runa | April 7th, 2009 @ 11:25 PM | in 2.3.9
I've just updated to rails 2.3 and I found that calling flash from the view triggers the lazy sessions. I think this is not the expected behavior.
See the patch attached
Comments and changes to this ticket
-
runa April 8th, 2009 @ 03:00 PM
- Tag set to 2.3.2, flash, lazy, sessions
-
Stefan Botzenhart September 23rd, 2009 @ 08:36 AM
Any comments on this ticket? I realized the same thing when trying to cache my application with varnish. As flash triggers the session and sets the "Set-Cookie" header although the session is empty varnish is not willing to cache the page.
-
Urban Hafner January 29th, 2010 @ 03:15 PM
- Tag changed from 2.3.2, flash, lazy, sessions to 2.3.2, 2.3.x, flash, lazy, sessions
Check out this plugin: http://github.com/msales/smart_cookie_store
It enhances the default
CookieStore
by preventingSet-Cookie
headers for empty sessions. -
Jeremy Kemper January 29th, 2010 @ 11:51 PM
- Milestone changed from 2.x to 2.3.6
- State changed from new to open
- Assigned user set to josh
-
josh February 2nd, 2010 @ 02:56 PM
- State changed from open to resolved
I think this is related to:
https://rails.lighthouseapp.com/projects/8994/tickets/3811-empty-se...
-
Urban Hafner February 2nd, 2010 @ 03:00 PM
It is related. How did you fix it? The fix for #3811 isn't enough.
-
Urban Hafner February 5th, 2010 @ 10:02 AM
- Tag changed from 2.3.2, 2.3.x, flash, lazy, sessions to 2-3-stable, 2.3.2, 2.3.x, 3, 3.0, flash, lazy, sessions
I had a look and it's not fixed in the latest 2-3-stable. Attached is a diff that contains a test and possible fix (but the fix breaks the reset session functionality). To recap, the problem is that even when you only try to access something in the session (like for example a
flash[:notice]
in the layout) a session cookie gets set. Even if it is empty and there's no need for it.I'm not quite sure about Rails 3, but the bug seems to be present there, too.
-
Urban Hafner February 26th, 2010 @ 01:41 PM
- Tag changed from 2-3-stable, 2.3.2, 2.3.x, 3, 3.0, flash, lazy, sessions to 2-3-stable, 2.3.2, 2.3.x, 3, 3.0, 3.0pre, flash, lazy, sessions
I just tested it and the bug is still present in Rails 2.3 (latest version of the branch) and in master. However in master my fix doesn't work (even after the obvious changes necessary to have a look).
-
Jeremy Kemper June 18th, 2010 @ 11:24 PM
- Milestone changed from 2.3.6 to 2.3.9
- State changed from resolved to open
-
José Valim June 26th, 2010 @ 09:12 AM
- State changed from open to duplicate
- Importance changed from to
Fixed on master. When #4938 is backported, this will be fixed as well.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 4938 [PATCH] Session fixes: sessions should not be created until written to; and session data should be destroyed on session reset https://rails.lighthouseapp.com/projects/8994/tickets/24...