X-Git-Url: http://git.kpe.io/?p=wol.git;a=blobdiff_plain;f=sessions.lisp;h=727ad4bfabaceb57512a9af446d0e8c90c5893fa;hp=39e2fe579efde1b469f7656f70de28ecbc96e667;hb=115593575b49ab252692a959380e94707e385de3;hpb=0c0d797b5e6c5afa9050b8021ea4729f4ab68aca diff --git a/sessions.lisp b/sessions.lisp index 39e2fe5..727ad4b 100644 --- a/sessions.lisp +++ b/sessions.lisp @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: July 2003 ;;;; -;;;; $Id: sessions.lisp,v 1.4 2003/08/08 23:40:13 kevin Exp $ +;;;; $Id$ ;;;; ;;;; This file and Wol are Copyright (c) 2003 by Kevin M. Rosenberg ;;;; ************************************************************************* @@ -15,12 +15,6 @@ (in-package #:wol) -#|| -(awhen (and session-id (find-websession session-id ent)) - (setf (websession-from-req req) it) - (setf (websession-method it) :url)) -||# - (defun find-websession (key ent) (let ((sessions (sessions (session-master (entity-project ent))))) (maphash @@ -51,24 +45,21 @@ sess))) -(defun compute-session (req ent) +(defun compute-session (req ent url-session-id) (when (is-session-enabled ent) - (let ((key (cookie-session-key ent (request-cookies req))) - (has-cookie-key nil) - (has-url-key nil)) - (if key - (setq has-cookie-key t) - (when (setq key (url-session-key (request-raw-uri req))) - (setq has-url-key t))) - (let* ((found-session (when key (find-websession key ent))) - (session (aif found-session it (make-websession req ent)))) - (setf (websession-from-req req) session) - (when found-session - (if has-cookie-key - (setf (websession-method session) :cookies) - (when has-url-key - (setf (websession-method session) :url)))) - session)))) + (let* ((cookie-session-id (cookie-session-key ent (request-cookies req))) + (session-id (or url-session-id cookie-session-id)) + (found-session (when session-id + (find-websession session-id ent))) + (session (aif found-session + it + (make-websession req ent)))) + (cond + (cookie-session-id + (setf (websession-method session) :cookies)) + (url-session-id + (setf (websession-method session) :url))) + (setf (websession-from-req req) session)))) ;;; Reap expired sessions