Davide Marquês
unread,Sep 8, 2009, 11:47:58 AM9/8/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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 :)