fukamachi / clack

Web server abstraction layer for Common Lisp
MIT License
1.04k stars 87 forks source link

Expiring of sessions in clack.middleware.session #47

Open h11r opened 12 years ago

h11r commented 12 years ago

When trying to expire a session by setting the :expire keyword in the hash map :clack.session.options the <clack-session-state-cookie> middleware raises a type miss-match. This is because <clack-middleware-session> calls clack.session.state:expire with the options hash-table converted to a plist while <clack-session-state-cookie> expects the original hash-table:

;;; from core/middleware/session.lisp
(defmethod expire ((this <clack-middleware-session>) id res env)
  (state:expire
   (state this)
   id res
   (hash-table-plist (getf env :clack.session.options))))

;;; from core/middleware/state/cookie.lisp
(defmethod expire ((this <clack-session-state-cookie>)
                              id res &optional options)
  (setf (gethash :expires options) 0) ;; here is the problem
  (finalize this id res options))
wnortje commented 8 years ago

I have the same problem. Is there a workaround for expiring a session?

gibsonf1 commented 7 years ago

I would also be very happy to have an answer for this. For now, I hacked in my expire time to finalize-state in lack/src/middleware/session/state/cookie.lisp .