On Sat, 01 Dec 2012 11:51:25 +0100
Sönke Ludwig sludwig@rejectedsoftware.com wrote:

Am 30.11.2012 21:04, schrieb Nick Sabalausky:

I'm using vibe.d's sessions for the first time, but having trouble
getting them to work.

When I set up my HttpServerSettings, I include this:

settings.sessionStore = new MemorySessionStore();

And then in my request handler, I have this:

writeln(req.session is null);
if(req.session is null)
    req.session = res.startSession();

I have cookies enabled in my browser, and I can verify that my
browser is properly sending back the correct cookie the server gave
it. But then 'req.session' is still null and a new session gets
created.

Hm, never had problems with this, except when the browser actually
didn't send back the cookie.

Can you try to insert a log message in MemorySessionStore.open and
inside the if statement in http/server.d around line 1086 ("lookup
the session") to see what actually gets detected? There are not many
places where something can go wrong, so this should hopefully be
quick to track down.

The correct id is being pulled out of the cookie and getting passed
to MemorySessionStore.open. However, inside MemorySessionStore.open
it looks like msessions is *always* null. Additionally,
MemorySessionStore.set is never getting called, so I assume that's why
m
sessions is always null.

(FWIW, I also put a trace in MemorySessionStore.this and I am indeed
only ever creating one instance of MemorySessionStore.)