From: "Ara.T.Howard" Date: 2005-09-14T14:35:50+09:00 Subject: Re: [BUG/PATCH] cgi/session.rb On Wed, 14 Sep 2005, Yukihiro Matsumoto wrote: > Can you explain how it fails? "the way it is" version seems to work for me. > Perhaps you have expected something different from me. hmmm. it seems there is more to it than i thought, if i browse this script: [ahoward@localhost ~]$ cat /var/www/html/acgi/acgi-0.0.0/a.cgi #! /usr/local/bin/ruby require 'cgi' require 'cgi/session' require 'cgi/session/pstore' cgi = CGI::new content = '' database_manager = CGI::Session::PStore this_time = Time::now begin session = CGI::Session::new cgi, 'database_manager' => database_manager last_time = session['last_time'] || this_time session['last_time'] = this_time session.close content << "THIS_TIME : #{ this_time }\n" content << "LAST_TIME : #{ last_time }\n" content << "SCRIPT_FILENAME : #{ ENV['SCRIPT_FILENAME'] }\n" content << "SESSION_ID : #{ session.session_id }\n" rescue Exception => e m, c, b = e.message, e.class, e.backtrace.join("\n") content << "#{ m } (#{ c })\n#{ b }" end cgi.out('type' => 'text/plain'){ content } from, for example: http://localhost/acgi/acgi-0.0.0/a.cgi i get something like: THIS_TIME : Tue Sep 13 23:22:41 MDT 2005 LAST_TIME : Tue Sep 13 23:22:41 MDT 2005 SCRIPT_FILENAME : /var/www/html/acgi/acgi-0.0.0/a.cgi SESSION_ID : 63cdc2ee2c075a914d6943947951b19b and then refreshing: THIS_TIME : Tue Sep 13 23:22:59 MDT 2005 LAST_TIME : Tue Sep 13 23:22:59 MDT 2005 SCRIPT_FILENAME : /var/www/html/acgi/acgi-0.0.0/a.cgi SESSION_ID : c7d7588139a5270da345ee54c89ed88b but from: http://fortytwo.merseine.nu/acgi/acgi-0.0.0/a.cgi i will get: THIS_TIME : Tue Sep 13 23:23:29 MDT 2005 LAST_TIME : Tue Sep 13 23:22:17 MDT 2005 SCRIPT_FILENAME : /var/www/html/acgi/acgi-0.0.0/a.cgi SESSION_ID : 814ca3261d52515d3e1d9d608dc80a16 followed by: THIS_TIME : Tue Sep 13 23:23:50 MDT 2005 LAST_TIME : Tue Sep 13 23:23:29 MDT 2005 SCRIPT_FILENAME : /var/www/html/acgi/acgi-0.0.0/a.cgi SESSION_ID : 814ca3261d52515d3e1d9d608dc80a16 so in the first the session is re-created each time and in the second not. so the bug only appears from localhost? or is this not a bug but expected behaviour? i'm very tired so perhaps it is ;-( is HTTP_COOKIE handled differently for localhost or something? i looked in the source both nothing jumped out at me. adding HTTP_COOKIE info i see, from http://localhost/acgi/acgi-0.0.0/a.cgi THIS_TIME : Tue Sep 13 23:32:26 MDT 2005 LAST_TIME : Tue Sep 13 23:32:26 MDT 2005 SCRIPT_FILENAME : /var/www/html/acgi/acgi-0.0.0/a.cgi SESSION_ID : 05d50f3762602883a9a00678495757f5 HTTP_COOKIE : _session_id=5437f16e1ee85101db5a049a8a4a883c; _session_id=d3e4867caa8ea724c6023e91031a2374; _session_id=e17d91c033811031d235e34c1404d188 and from http://fortytwo.merseine.nu/acgi/acgi-0.0.0/a.cgi THIS_TIME : Tue Sep 13 23:33:36 MDT 2005 LAST_TIME : Tue Sep 13 23:32:22 MDT 2005 SCRIPT_FILENAME : /var/www/html/acgi/acgi-0.0.0/a.cgi SESSION_ID : 814ca3261d52515d3e1d9d608dc80a16 HTTP_COOKIE : _session_id=814ca3261d52515d3e1d9d608dc80a16; _session_id=6058a54f8ca5d206f7c8c35b0800a406 sorry if this ends up being noise - this simply isn't making sense attm. btw. i've run this [ahoward@localhost tmp]$ ls|egrep '^\w{16}$'|xargs -n1 sudo rm -f out of /tmp many time to clean up old sessions - results are always the same. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | Your life dwells amoung the causes of death | Like a lamp standing in a strong breeze. --Nagarjuna ===============================================================================