Configuring Allegro CL 5.0.1 cl-http


Before building cl-http be sure to check the list of patches in the acl501 read me file and install them if necessary.

There are three principle ways of using cl-http within acl:

  1. As a developer of cl-http who may be modifying cl-http soure code as well as his own code
  2. Loading cl-http into an existing application.
  3. Using cl-http as a standalone web server.

We'll describe ways of building cl-http that is best for each case above.

 

1. cl-http developer

The simplest way to get cl-http up and running is to start lisp, change to the acl501 directory of the cl-http source and load start.lisp

user(1): :cd /import/cl-http-70-16-rel/acl501
user(2): :ld start

This will compile (if necessary) and load in the compiled version of the cl-http source, then start the server on port 8000 and then load in the sample cl-http pages.   Starting the server may fail for a few reasons:

  1. The port 8000 is already in use by another process
  2. The dns name of the machine can't be determined.   This port of cl-http tries to automatically determine the dns name of the machine on which it's running.  This is usually successful but it can fail if the dns libraries on the machine are written in a certain way. 

If the server fails to start the error message will tell you what caused it to fail.   You'll have to start the server manually using the http:start function.  See the steps below for how that it done.   You may want to create your own version of the start.lisp file that passes the necessary arguments to http:start so that it will startup on your machine.

Another way to load and start cl-http is to:

user(1): :cd /import/cl-http-70-16-rel/acl501
user(2): :ld load
user(3): (build-cl-http)
user(4): (http:start)
user(5): (load-test)

This is very similar to what start.lisp does. 

The http:start function takes a number of keyword arguments, the most important being:

:port The port on which the server should listen for connections.   On Unix a process must be run as root to listen to ports less than 1024.    The default value for this parameter is 80.
:host The dns name of this host.   Generally it's best to not specify this value and let cl-http figure it out, however if it can't then you must supply the value

 

The (load-test) step above loads in the sample cl-http pages that describe cl-http itself.   These pages can only be loaded after the server has been started.

 

2. Using cl-http in an application

If you want to add cl-http to an existing application then it's best to compile all of the cl-http files into one large file: cl-http.fasl.    This is done by

user(1): :cd /import/cl-http-70-16-rel/acl501
user(2): :ld load
user(3): (build-cl-http :create-fasl t)

The last step creates cl-http.fasl that you can then load into your application.

 

3. Using cl-http as a standalone application

We've included in load.lisp an example of how to create a standalone cl-http application.   This example is meant as a template.  Our sample server doesn't serve anything. 

The first step in creating the standalone application is creating cl-http.fasl as described in step 2.   We'll assume that you haven't done that and show that in the steps below:

user(1): :cd /import/cl-http-70-16-rel/acl501
user(2): :ld load
user(3): (build-cl-http :create-fasl t)
user(4): (makeapp)

The makeapp function is defined in load.lisp and you'll want to study this function and alter it to create your own standalone application.   The result of the makeapp function will be a set of files in the acl501/cl-http-app directory.    These files contain an executable and support files that when run will start up a cl-http server.