Ruby cgi session expiration

For those, who also feel that the ruby cgi session expiration mechanism
does not work as expected:
The session is always created from afresh, that is, if you specify a
session expiration date of a week ahead, the next time you kill the
browser your session expires, as opposed to expiring in a week from now.

the following patch corrects this behaviour.
I have applied this patch on fedora 20 to ruby-2.0.0.353-16.fc20.x86_64
and on Centos 7 to ruby-2.0.0.353-20.el7.x86_64 and both work.

*** /usr/share/ruby/cgi/session.rb 2014-12-05 12:05:06.710565398 +0100 *************** *** 280,285 **** --- 280,286 ---- @new_session=true retry end + if option ['new_session'] then request.instance_eval do @output_hidden = {session_key => session_id} unless option['no_hidden'] @output_cookies = [ *************** *** 298,303 **** --- 299,305 ---- end) ] unless option['no_cookies'] end + end @dbprot = [@dbman] ObjectSpace::define_finalizer(self, Session::callback(@dbprot)) end

I applied the patch like this:

patch /usr/share/ruby/cgi/session.rb ruby.2.0.session.patch

where ruby.2.0.session.patch is the file containing the above patch.

suomi