Session middleware && multiple webservers

1 view
Skip to first unread message

Davide Marquês

unread,
Sep 8, 2009, 11:47:58 AM9/8/09
to ew...@googlegroups.com
Hi all,

I've picked up smak_auth_cookie and beepbeep_session_server and used them
as base for ewgi_session: a generic session middleware.

Usage examples:
 - using the cookie storage:
    SessionStore = {ewgi_session_cookie_store, ["cookie_session_id", <<"ABCDEFGHIJKLMNOP">>, [{secure, false}]]},
    ewgi_session:run(Ctx, [MiddlewareError, NoSession, Session, ?INCLUDE_IP, ?SESSION_TIMEOUT, SessionStore]);
 - using the server (ets) storage:
    SessionStore = {ewgi_session_server_store, [?SESSION_SERVER_REF, "server_session_id", false]},
    ewgi_session:run(Ctx, [MiddlewareError, NoSession, Session, ?INCLUDE_IP, ?SESSION_TIMEOUT, SessionStore]);

NoSession is the app that will receive control if no previous session existed for the given request (login form?).
SessionApp is the app that receives control if a session is found.
MiddlewareError is the app that will receive control in case errors occurs - right before passing control to NoSession.

For now there's only the cookie and ets (centralized :\) storage but we can easily add others (mnesia, memcached via merl, etc).

Another thing I did was rework the booting process so that we can chose among the various webservers directly from the command line.

All the examples are working the same with mochiweb, inets and yaws (NOTICE: ewgi_post returns some funky results with mochiweb,
can someone using it in production care to take a look? I don't want to break it for you guys. :)).

Also, some updates on the smak and ewi projects are needed for this to work.

Enjoy!
Davide :)

Dmitrii Dimandt

unread,
Sep 9, 2009, 9:06:29 AM9/9/09
to ew...@googlegroups.com
All I can say is: wow!

Davide Marquês

unread,
Sep 10, 2009, 1:02:37 PM9/10/09
to ew...@googlegroups.com
Always happy to wow someone! ;)
Reply all
Reply to author
Forward
0 new messages