<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Hello Campers!</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: 12.0px Helvetica">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.</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: 12.0px Helvetica">After the second request (even if I fail auth or load a page that does not require it beforehand) everything is fine and dandy.</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; ">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</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; ">in the session</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><div><br class="webkit-block-placeholder"></div><div>def service(*a)</div><div> begin</div><div> return super(*a)</div><div> rescue PleaseLogin</div><div> redirect R(Pasaporte::Controllers::Signon, @nickname)</div><div> return self</div><div> end</div><div> self</div><div>end</div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; ">And this version works in all cases:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><div><br class="webkit-block-placeholder"></div><div>def service(*a)</div><div> begin</div><div> return super(*a)</div><div> rescue PleaseLogin</div><div><div> @headers['Set-Cookie'] = 'camping_sid=%s; path=/' % @cookies.camping_sid </div></div><div> redirect R(Pasaporte::Controllers::Signon, @nickname)</div><div> return self</div><div> end</div><div> self</div><div>end</div><div><br class="webkit-block-placeholder"></div><div>Of course the service is included before Camping::Session so the session service should wrap.</div></div><br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; ">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")?</div> <br><div> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div>-- </div><div>Julian 'Julik' Tarkhanov</div><div>please send all personal mail to <a href="mailto:me@julik.nl">me@julik.nl</a></div><div><br class="khtml-block-placeholder"></div><br class="Apple-interchange-newline"></span> </div><br></body></html>