[hunchentoot-devel] Newbie question - how to examine session object?

I'm a lisp newbie, but I am very determined to quickly learn it. I'm using most recent SBCL with Weblocks. I'm connecting to my SBCL using slime. I'm intrested in examining the ession objects - what's the most effective way of examining the session object? Here is what I have tried, but obviously I am doing something wrong: ------------------- CL-USER> (weblocks:active-sessions) (#<HUNCHENTOOT::SESSION {100245E011}>) CL-USER> (hunchentoot:session-value :remote-addr (#<HUNCHENTOOT::SESSION {100245E011}>) ) ; in: LAMBDA NIL ; (#<HUNCHENTOOT::SESSION {100245E011}>) ; ; caught ERROR: ; illegal function call ; ; compilation unit finished ; caught 1 ERROR condition ------------------- ... at which point I get into the debugger... What am I doing wrong? Any help would be greatly appreciated. Thanks, Yarek

On Mon, May 05, 2008 at 11:58:50AM -0700, Yarek Kowalik wrote:
I'm a lisp newbie, but I am very determined to quickly learn it.
I'm using most recent SBCL with Weblocks. I'm connecting to my SBCL using slime. I'm intrested in examining the ession objects - what's the most effective way of examining the session object?
Here is what I have tried, but obviously I am doing something wrong:
------------------- CL-USER> (weblocks:active-sessions) (#<HUNCHENTOOT::SESSION {100245E011}>) CL-USER> (hunchentoot:session-value :remote-addr (#<HUNCHENTOOT::SESSION {100245E011}>) ) ; in: LAMBDA NIL ; (#<HUNCHENTOOT::SESSION {100245E011}>) ; ; caught ERROR: ; illegal function call ; ; compilation unit finished ; caught 1 ERROR condition -------------------
... at which point I get into the debugger... What am I doing wrong?
Using too many parentheses for the second argument, and using unreadable object syntax. Here's something that might work instead: (hunchentoot:session-value :remote-addr (first (weblocks:active-sessions))) Zach

Hi Zach, Thanks for your help!!! For the second argument I'm using what SLIME gives me for object representation (copied object using middle mouse button). If I want to use the REPL object representation, what would I need to do? For the command you recommended, I get this: ---- CL-USER> (hunchentoot:session-value :remote-addr (first (weblocks:active-sessions))) NIL NIL ---- Is that OK? I'm getting the same values from both the local host and a remote Windows box -- I was expecting two different IP addresses for each of the sessions I have now (first and second in the active session list). Yarek On Mon, May 5, 2008 at 12:03 PM, Zach Beane <xach@xach.com> wrote:
On Mon, May 05, 2008 at 11:58:50AM -0700, Yarek Kowalik wrote:
I'm a lisp newbie, but I am very determined to quickly learn it.
I'm using most recent SBCL with Weblocks. I'm connecting to my SBCL using slime. I'm intrested in examining the ession objects - what's the most effective way of examining the session object?
Here is what I have tried, but obviously I am doing something wrong:
------------------- CL-USER> (weblocks:active-sessions) (#<HUNCHENTOOT::SESSION {100245E011}>) CL-USER> (hunchentoot:session-value :remote-addr (#<HUNCHENTOOT::SESSION {100245E011}>) ) ; in: LAMBDA NIL ; (#<HUNCHENTOOT::SESSION {100245E011}>) ; ; caught ERROR: ; illegal function call ; ; compilation unit finished ; caught 1 ERROR condition -------------------
... at which point I get into the debugger... What am I doing wrong?
Using too many parentheses for the second argument, and using unreadable object syntax.
Here's something that might work instead:
(hunchentoot:session-value :remote-addr (first (weblocks:active-sessions)))
Zach _______________________________________________ tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel

Ok, I get the part about the extra paranthesis and how repl works. I can do this now: ---- CL-USER> (second (weblocks:active-sessions)) #<HUNCHENTOOT::SESSION {10025C0001}> CL-USER> (hunchentoot:session-value :remote-ip-addr #<HUNCHENTOOT::SESSION {10025C0001}> ) NIL NIL ---- Cool! But that still leaves the question about why I'm getting 'NIL' value for an IP address (or for that matter, any session object slot -- I tried session-id, session-string, user-agent, remote-addr, session-start, session-date)? Thanks, Yarek On Mon, May 5, 2008 at 12:13 PM, Yarek Kowalik <yarek.kowalik@gmail.com> wrote:
Hi Zach,
Thanks for your help!!!
For the second argument I'm using what SLIME gives me for object representation (copied object using middle mouse button). If I want to use the REPL object representation, what would I need to do?
For the command you recommended, I get this:
---- CL-USER> (hunchentoot:session-value :remote-addr (first (weblocks:active-sessions))) NIL NIL ----
Is that OK? I'm getting the same values from both the local host and a remote Windows box -- I was expecting two different IP addresses for each of the sessions I have now (first and second in the active session list).
Yarek
On Mon, May 5, 2008 at 12:03 PM, Zach Beane <xach@xach.com> wrote:
On Mon, May 05, 2008 at 11:58:50AM -0700, Yarek Kowalik wrote:
I'm a lisp newbie, but I am very determined to quickly learn it.
I'm using most recent SBCL with Weblocks. I'm connecting to my SBCL using slime. I'm intrested in examining the ession objects - what's the most effective way of examining the session object?
Here is what I have tried, but obviously I am doing something wrong:
------------------- CL-USER> (weblocks:active-sessions) (#<HUNCHENTOOT::SESSION {100245E011}>) CL-USER> (hunchentoot:session-value :remote-addr (#<HUNCHENTOOT::SESSION {100245E011}>) ) ; in: LAMBDA NIL ; (#<HUNCHENTOOT::SESSION {100245E011}>) ; ; caught ERROR: ; illegal function call ; ; compilation unit finished ; caught 1 ERROR condition -------------------
... at which point I get into the debugger... What am I doing wrong?
Using too many parentheses for the second argument, and using unreadable object syntax.
Here's something that might work instead:
(hunchentoot:session-value :remote-addr (first (weblocks:active-sessions)))
Zach _______________________________________________ tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel

On Mon, May 05, 2008 at 12:13:29PM -0700, Yarek Kowalik wrote:
Is that OK? I'm getting the same values from both the local host and a remote Windows box -- I was expecting two different IP addresses for each of the sessions I have now (first and second in the active session list).
Sorry, I have no idea about sessions. I've never used them with hunchentoot. Zach

On Mon, 5 May 2008 12:13:29 -0700, "Yarek Kowalik" <yarek.kowalik@gmail.com> wrote:
---- CL-USER> (hunchentoot:session-value :remote-addr (first (weblocks:active-sessions))) NIL NIL ----
Is that OK? I'm getting the same values from both the local host and a remote Windows box -- I was expecting two different IP addresses for each of the sessions I have now (first and second in the active session list).
SESSION-VALUE should return whatever (SETF SESSION-VALUE) put there. So, the question actually is whether someone wrote a session value :REMOTE-ADDR to this session. Did you do that? Did Weblocks do that? What do you get if you inspect the corresponding session objects? (The session object maintains an alist of session values in the SESSION-DATA slot.) Edi.

I'm guessing that's not being set anywhere... I'm checking Weblocks now. Thanks for the feedback. Cheeers, Yarek On Mon, May 5, 2008 at 3:22 PM, Edi Weitz <edi@agharta.de> wrote:
On Mon, 5 May 2008 12:13:29 -0700, "Yarek Kowalik" <yarek.kowalik@gmail.com> wrote:
---- CL-USER> (hunchentoot:session-value :remote-addr (first (weblocks:active-sessions))) NIL NIL ----
Is that OK? I'm getting the same values from both the local host and a remote Windows box -- I was expecting two different IP addresses for each of the sessions I have now (first and second in the active session list).
SESSION-VALUE should return whatever (SETF SESSION-VALUE) put there. So, the question actually is whether someone wrote a session value :REMOTE-ADDR to this session. Did you do that? Did Weblocks do that? What do you get if you inspect the corresponding session objects? (The session object maintains an alist of session values in the SESSION-DATA slot.)
Edi.
_______________________________________________ tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel
participants (3)
-
Edi Weitz
-
Yarek Kowalik
-
Zach Beane