Page 1 of 1

Hunchentoot sessions

Posted: Sun Sep 25, 2011 2:31 am
by pseudo-cat
Hello, I have'nt problems with hunchentoot's session mechanism on this code:

Code: Select all

(let ((s (hunchentoot:start-session))
	       (cookie (hunchentoot:cookie-out "hunchentoot-session")))
	   (setf (hunchentoot:session-max-time s) 172800)
	   (setf (hunchentoot:session-value 'user s) user)
	   (setf (hunchentoot:session-value 'pass s) pass)
BUT if I'll adding this line:

Code: Select all

	 
(let ((s (hunchentoot:start-session))
	       (cookie (hunchentoot:cookie-out "hunchentoot-session")))
	   (setf (hunchentoot:session-max-time s) 172800)
	   (setf (hunchentoot:session-value 'user s) user)
	   (setf (hunchentoot:session-value 'pass s) pass)
	   (format cl-user::*std-out* "cookie: ~a" cookie)
	   (when cookie
	     (setf (hunchentoot:cookie-expires
		       (hunchentoot:cookie-out "hunchentoot-session"))
		   172800)
	   
then cookies are unused. So get-parameters used instead

Re: Hunchentoot sessions

Posted: Mon Sep 26, 2011 12:30 pm
by Kompottkin
pseudo-cat wrote:

Code: Select all

	     (setf (hunchentoot:cookie-expires
		       (hunchentoot:cookie-out "hunchentoot-session"))
		   172800)
You're setting the expiration date of the cookie to 172800, which is sometime on January 3rd in the year 1900. Try something like (+ (get-universal-time) 172800) instead.

Re: Hunchentoot sessions

Posted: Wed Sep 28, 2011 1:38 pm
by pseudo-cat
Kompottkin wrote:
pseudo-cat wrote:

Code: Select all

	     (setf (hunchentoot:cookie-expires
		       (hunchentoot:cookie-out "hunchentoot-session"))
		   172800)
You're setting the expiration date of the cookie to 172800, which is sometime on January 3rd in the year 1900. Try something like (+ (get-universal-time) 172800) instead.
Exactly, thanks)