Sinatra's sessions use cookies by default Here's my test app: require 'sinatra' enable :sessions get '/foo' do session'm' = ' ' redirect '/bar' end get '/bar' do Inspect} ENDRESPONSE end And here it is in action: phrogz$ curl --cookie-jar cookies. Txt -L localhost:4567/foo" rel="nofollow">localhost:4567/foo Ruby: 1.9.2 Rack: 1, 1 Sinatra: 1.2.3 " " phrogz$ curl -L localhost:4567/foo" rel="nofollow">localhost:4567/foo Ruby: 1.9.2 Rack: 1, 1 Sinatra: 1.2.3 nil phrogz$ cat cookies. Txt # Netscape HTTP Cookie File # http://curl.haxx.se/rfc/cookie_spec.html # This file was generated by libcurl!
Edit at your own risk. Localhost FALSE / FALSE 0 rack. Session BAh7BkkiBm0GOgZFRkkiEUhl Without cookies, your redirect will work but it will be as though it's a brand new session after the redirect, with the session starting from scratch.
Sinatra's sessions use cookies by default. Here's my test app: require 'sinatra' enable :sessions get '/foo' do session'm' = '' redirect '/bar' end get '/bar' do Inspect} ENDRESPONSE end And here it is in action: phrogz$ curl --cookie-jar cookies. Txt -L localhost:4567/foo" rel="nofollow">localhost:4567/foo Ruby: 1.9.2 Rack: 1, 1 Sinatra: 1.2.3 "" phrogz$ curl -L localhost:4567/foo" rel="nofollow">localhost:4567/foo Ruby: 1.9.2 Rack: 1, 1 Sinatra: 1.2.3 nil phrogz$ cat cookies.
Txt # Netscape HTTP Cookie File # http://curl.haxx.se/rfc/cookie_spec.html # This file was generated by libcurl! Edit at your own risk. Localhost FALSE / FALSE 0 rack.
Session BAh7BkkiBm0GOgZFRkkiEUhl... Without cookies, your redirect will work but it will be as though it's a brand new session after the redirect, with the session starting from scratch.
Really thanks, your method is really cool. The cause is I use shotgun server. – chenge Apr 19 at 20:58 @chenge I'm glad this helped.
If you feel that this solved your problem, you should accept it as the answer (press the checkmark next to the answer). If @Konstantin's answer has solved your problem, mark it as accepted. – Phrogz Apr 19 at 21:36 helpful, but not the final solution.
– chenge Apr 20 at 3:15.
If so, do the following: configure(:development) { set :session_secret, "something" } This will no longer be necessary in Sinatra 1.3.
Thanks, yes I use shotgun. Could you give a guide with more details? – chenge Apr 19 at 21:02 I had the same issue using Shotgun, just upgraded to sinatra-1.2.6 and it works as expected with Shotgun.
– Tom May 15 at 0:18.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.