Edge: Session Cookie Fix Causing Issues for Legacy App

I love the idea of the cookie fix for session storage. But… I’ve gone
round
and round to get edge working with a legacy app and wonder if anyone has
any
pointers. Here’s what’s happening. I fresh-installed:

rails foo
cd foo
rake rails:freeze:edge
rake rails:update
– add secret to environment.rb –

All good, passing tests, no problems with session cookies. Then I cp -r
my
application tree over, preserving environment.rb. After that copy, I
get:

ArgumentError (`name’ required):

/vendor/rails/actionpack/lib/action_controller/cgi_ext/cookie_performance_fix.rb:44:in
`initialize’

/vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb:129:in
`new’

/vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb:129:in
`write_cookie’

/vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb:87:in
close' /opt/local/lib/ruby/1.8/cgi/session.rb:324:in close’
/vendor/rails/actionpack/lib/action_controller/base.rb:1209:in
`close_session’

I’ve verified that the cookie name is coming in as empty and the
ArgumentError is being raised for a reason. I just don’t see why that
would
be.

Does anyone have any thoughts about this?

Here’s more about the environment:

About your application’s environment
Ruby version 1.8.5 (i686-darwin8.8.1)
RubyGems version 0.9.1
Rails version 1.2.0
Active Record version 1.14.4
Action Pack version 1.12.5
Action Web Service version 1.1.6
Action Mailer version 1.2.5
Active Support version 1.3.1
Edge Rails revision 6414
Application root /Users/sxross/rails/amu_edge
Environment development
Database adapter mysql
Database schema version 0

Plugins:

exception_notification
file_column
haml
<two that I wrote that don’t hack rails>

View this message in context:
http://www.nabble.com/Edge%3A-Session-Cookie-Fix-Causing-Issues-for-Legacy-App-tf3397581.html#a9460095
Sent from the RubyOnRails Users mailing list archive at Nabble.com.

On 3/13/07, s.ross [email protected] wrote:

I love the idea of the cookie fix for session storage. But… I’ve gone round
and round to get edge working with a legacy app and wonder if anyone has any
pointers. Here’s what’s happening. I fresh-installed:

You need to provide :session_key and :secret session options in
environment.rb. It’s generated for you in new apps.
config.action_controller.session = { :session_key =>
‘_myapp_session’, :secret => ‘ssh! be quiet’ }
Note that it’s moving from application.rb to the environment.

I added an explicit ArgumentError rather than letting it fall through
to an empty cookie name.
http://dev.rubyonrails.org/changeset/6415

jeremy

Thanks so much. Cookie-based sessions should be an amazing help.

steve

Jeremy K. wrote:

environment.rb. It’s generated for you in new apps.


View this message in context:
http://www.nabble.com/Edge%3A-Session-Cookie-Fix-Causing-Issues-for-Legacy-App-tf3397581.html#a9463144
Sent from the RubyOnRails Users mailing list archive at Nabble.com.

On 3/15/07, s.ross [email protected] wrote:

Here’s a follow-up question. Are session_id values guaranteed to
remain the same between calls? I know you aren’t relying on the
session_id to identify the information anymore.

The session cookie now contains data rather than an id.

I only ask because I’ve been looking at Simple Captcha, which uses
the session_id as part of the hash that identifies the captcha answer
in pstore. Oddly, the session_id works perfectly with this when using
AR session store, but not with the new cookie-based session store.

You can store an id in the session data instead.

Rick O.'s CSRF-prevention plugin takes this approach.

jeremy

Here’s a follow-up question. Are session_id values guaranteed to
remain the same between calls? I know you aren’t relying on the
session_id to identify the information anymore.

I only ask because I’ve been looking at Simple Captcha, which uses
the session_id as part of the hash that identifies the captcha answer
in pstore. Oddly, the session_id works perfectly with this when using
AR session store, but not with the new cookie-based session store.

Thoughts?

Thx