Hello Campers!

Is it just me or does Camping init the session twice on a redirect? If I have an app and when the user visits it for the first time, a session is generated. Afterwards I redirect the user in a service (that basically does auth) and he gets bounced to the login page - but when I arrive at the login page my SID somehow has changed :-( so there is a stale session dangling in the store and and empty @state. After the second request (even if I fail auth or load a page that does not require it beforehand) everything is fine and dandy.

Herre is the service in question - if I do it like this the session is regenerated when the user lands on the signon page And the page he is redirected from was his first one
in the session

def service(*a)
      begin
        return super(*a)
      rescue PleaseLogin
        redirect R(Pasaporte::Controllers::Signon, @nickname)
        return self
      end
      self
end

And this version works in all cases:

def service(*a)
      begin
        return super(*a)
      rescue PleaseLogin
@headers['Set-Cookie'] = 'camping_sid=%s; path=/' % @cookies.camping_sid
        redirect R(Pasaporte::Controllers::Signon, @nickname)
        return self
      end
      self
end

Of course the service is included before Camping::Session so the session service should wrap.

Has someone observed this behavior? Why is it needed to manually set the session cookie? Is it that the same as the workaround that mod_perl and mod_python use (as in "error headers" versus "normal headers")?

--
Julian 'Julik' Tarkhanov
please send all personal mail to [EMAIL PROTECTED]



_______________________________________________
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to