Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sessions prefix - still problem - v3.0.0.rc3 #1296

Closed
xmen4u opened this issue Aug 20, 2012 · 2 comments
Closed

sessions prefix - still problem - v3.0.0.rc3 #1296

xmen4u opened this issue Aug 20, 2012 · 2 comments

Comments

@xmen4u
Copy link

xmen4u commented Aug 20, 2012

I'm sorry if it's a dupliacate to my last comment @ #1286 , but i saw that issue is closed. Yet i seem to have that issue using the latest version, despite it's supposed to be fixed.

I've updated express (both for the local project and globaly),
I'm still having the prefix bug: my code https://gist.github.com/3397357

express v: 3.0.0rc3
node 0.8.7

some more info, with DEBUG=connect:redis
connect:redis SETEX "sess:IdsW2EYeX0AZIowXELobsZeT" ttl:{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"}} %s +0ms

connect:redis SETEX complete +4ms

printing the handshake data (console.log(handshakeData.headers);)
gives: { host: 'local .... '
....
"cookie":"connect.sid=s%3AIdsW2EYeX0AZIowXELobsZeT.ZgA%2FNixR6ZRMnHS8gga2kSYS%2FYhOAupTtQKUAxXP%2BbM"}

and then when a get from redis happends (it looks for "sess:s:.... instead of sess:Id...")
connect:redis GET "sess:s:IdsW2EYeX0AZIowXELobsZeT.ZgA/NixR6ZRMnHS8gga2kSYS/YhOAupTtQKUAxXP+bM" +5s

keys in redis:

  1. "sess:IdsW2EYeX0AZIowXELobsZeT"

Thank you and sorry for duplicating post.

@tnydwrds
Copy link
Contributor

Hi xmen4u,

I think this is behaving properly and is due to you passing an unparsed signed cookie to sessionStore.get.

On line 9 of your gist, it looks like you parse req_cookie['connect.sid'] and store it in req_session, but on line 11 you pass the unparsed cookie req_cookie['connect.sid'] instead.

Regards,
Tony

@xmen4u
Copy link
Author

xmen4u commented Aug 21, 2012

Hi tnydwrds,

Thanks for your help (i was playing with it so much i must have missed it..) .
One tip to give:
sessionStore.get('' + req_session, function(err, session) {

else error will occur.

One more thing if you (or anyone else) , will
From the moment redis found your key (thus active session), how do you tell express, yes we have here a session:
as you can see i've tried various thing (line 13-34), one place i did: handshakeData.session = new Session(data, session);
the other: session = new express.session.Session(req, session); (is this synchronous? )
what's the best practiced way to use the new express ?

Thank you very much

@tj tj closed this as completed Sep 27, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants