CGI::Session not sending cookie

Z

zak.wilson

I'm using mod_ruby, eruby and CGI::Session in an application. It seems
that the cookie is never being sent, and I have no idea why. Here's a
simple rhtml file illustrating the problem:

% require 'cgi'
% require 'cgi/session'
% require 'cgi/session/pstore'
% cgi=CGI.new()
% sess=CGI::Session.new(cgi, 'database_manager' =>
CGI::Session::pStore, 'session_key' => 'hello_session')
<% sess['visits'] ||= 0 %>
<%= sess.session_id %>
<%= sess['visits'] %> visits
<% sess['visits'] += 1
sess.close%>

Each time this is loaded, no cookie is set, so no session ID is sent
back to the page on reload and a new session is started each time.
This behavior does not match any of the documentation I've been able
to find, but it does match what's described in
http://groups.google.com/group/comp.lang.ruby/browse_frm/thread/84a1bddd046a9b66/d6d7e7340a5a3bb1

The above poster solved his problem by passing around the session ID
as a query parameter, but that seems to miss the point of using
CGI::Session. Am I missing something obvious here?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top