Hi all,

oops, sorry! Forget what I wrote:

> A ".html" file will
> be directly sent to the client, without any forking. And also ".l" files
> do not automatically cause the fork, but only if (app) is called during
> their execution.

This was wrong. The 'server' function in "lib/http.l" will always fork
when a connection request arrives. It is just that the child process
immediately terminates after serving the connection (unless (app) was
called).


BTW, as a matter of an example, the 'server' function in "lib/http.l"
*does* implement a non-forking server, but only in the child process
once the initial connect from a client has created a session:

   ...
   (loop                         # Main loop in the parent process
      (setq *Sock (listen P))    # Wait for a request
      (NIL (fork) (close P))     # The child closes 'P' and exits the loop
      (close *Sock) )            # The parent closes the new connection and 
continues
   (task *Sock (http @))         # The child installs a task on that socket
   (http *Sock)                  # and serves the first page
   (or *SesId (bye))             # If (app) was not called, terminate
   (task *Sock                   # Else install a task for the new session 
socket
      (when (accept *Sock)          # Accept requests on that socket
         (task @ (http @))          # without forking
         (http @) ) ) )


Note: This uses in two places a construct of the form

   (task <socket> (http <socket>))
   (http <socket>)

The reason for that is that for HTTP/1.1 more than one transaction may
be done before the connection is closed.

Hope this helps.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Reply via email to