Re: question about CL-HTTP

Thomas Russ <[email protected]> Tue, 27 Jan 2004 08:30:22 -0800
Newsgroups gmane.lisp.cl-http
Message-ID <[email protected]>
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.