Re: question about CL-HTTP

"John C. Mallery" <[email protected]> Tue, 27 Jan 2004 18:47:11 -0500
Newsgroups gmane.lisp.cl-http
Message-ID <p0601022cbc3ca862b60e@[10.0.1.3]>
At 8:30 AM -0800 1/27/04, Thomas Russ wrote:
>On Jan 27, 2004, at 2:48 AM, Cristina Gema Muñoz Maya wrote:
>
>>Hello!!
>>
>>       I'm doing an application (Criminal law Course) in CL-HTTP under LispWork of Harlequin, but i've a problem. I'm going to show you part of the code. I 've a html page, siidepe.html
>>...........
>><FORM ACTION="curso.html" METHOD="POST">
>>user<INPUT TYPE="text" NAME="NOMBRE" SIZE="10" VALUE="">
>>password<INPUT TYPE="passwd" NAME="NOMBRE" SIZE="10" VALUE="">
>>......
>>
>>
>>        And when i submitted this form, the response function read from a file which contain information of the user that do the course (the last page visited, what they know about each topic,the pages that are known for them), and this information is saved in global variables (usuario,clave,pagnum,pagin,tema1,..).And i think this don't work when there are 2 o more users using the course. So, can you advice me how can i do what i want?.
>
>As you have noted, you can't really use global variables to hold this information, since even with a single thread, the interactions of multiple users can be interleaved.  What you need to do instead is to make sure you can associate a particular user with the various sessions.  Then, you will need to store a table, probably using hash-tables, which links the user name to the information you want to keep persistent across HTTP accesses.
>
>I think the simplest way to do this is to use the basic authentication services that are provided by CL-HTTP.  Then you can get the user associated with each request and use that as an index into the global table that keeps your state information.

Or, you can hang information for a user off the user-object property list, which is
easily accessed in the response function (user-object *server*). This eliminates hashing into another data-structure. Or, you can mix your own class into the user class ....