1.3.1
[hunchentoot.git] / docs / index.html
blob56002734aec1adbf81929e41fe53ca885920f672
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
2 <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta><title>Hunchentoot - The Common Lisp web server formerly known as TBNL</title><meta name="description" content="
3 A full-featured web server written in Common Lisp offering things
4 like HTTP/1.1 chunking, persistent connections, and SSL. Includes
5 a framework for building dynamic websites interactively.
6 "></meta><style type="text/css">
7 body { background-color: #ffffff }
8 pre { padding:5px; background-color:#e0e0e0 }
9 pre.none { padding:5px; background-color:#ffffff }
10 h3, h4, h5 { text-decoration: underline; }
11 .entry-type { padding-left: 1em; font-size: 60%; font-style: italic }
12 a { text-decoration: none; padding: 1px 2px 1px 2px; }
13 a:visited { text-decoration: none; padding: 1px 2px 1px 2px; }
14 a:hover { text-decoration: none; padding: 1px 1px 1px 1px; border: 1px solid #000000; }
15 a:focus { text-decoration: none; padding: 1px 2px 1px 2px; border: none; }
16 a.none { text-decoration: none; padding: 0; }
17 a.none:visited { text-decoration: none; padding: 0; }
18 a.none:hover { text-decoration: none; border: none; padding: 0; }
19 a.none:focus { text-decoration: none; border: none; padding: 0; }
20 a.noborder { text-decoration: none; padding: 0; }
21 a.noborder:visited { text-decoration: none; padding: 0; }
22 a.noborder:hover { text-decoration: none; border: none; padding: 0; }
23 a.noborder:focus { text-decoration: none; border: none; padding: 0; }
24 </style></head><body>
28 <h2>
29 <a href="http://www.htg1.de/hunchentoot/hunchentoot.html" title="Click here for the Hunchentoot logo" class="noborder">
30 <img align="top" width="93" height="45" border="0" src="hunchentoot.gif"></img>
31 </a>
32 Hunchentoot - The Common Lisp web server formerly known as TBNL
33 </h2>
35 <blockquote>
36 <h3 xmlns=""><a class="none" name="abstract">Abstract</a></h3>
37 <p>
38 Hunchentoot is a web server written in Common Lisp and at the
39 same time a toolkit for building dynamic websites. As a
40 stand-alone web server, Hunchentoot is capable of HTTP/1.1
41 chunking (both directions), persistent connections
42 (keep-alive), and SSL.
43 </p>
44 <p>
45 Hunchentoot provides facilities like automatic session
46 handling (with and without cookies), logging, customizable
47 error handling, and easy access to GET and POST parameters
48 sent by the client. It does <em>not</em> include functionality
49 to programmatically generate HTML output. For this task you
50 can use any library you like, e.g. (shameless self-plug)
51 <a href="http://weitz.de/cl-who/">CL-WHO</a> or
52 <a href="http://weitz.de/html-template/">HTML-TEMPLATE</a>.
53 </p>
54 <p>
55 Hunchentoot talks with its front-end or with the client over
56 TCP/IP sockets and optionally uses multiprocessing to handle
57 several requests at the same time. Therefore, it cannot be
58 implemented completely in <a href="http://www.lispworks.com/documentation/HyperSpec/Front/index.htm">portable
59 Common Lisp</a>. It currently works with <a href="http://www.lispworks.com/">LispWorks</a> and all Lisps
60 which are supported by the compatibility layers <a href="http://common-lisp.net/project/usocket/">usocket</a> and
61 <a href="http://common-lisp.net/project/bordeaux-threads/">Bordeaux
62 Threads</a>.
63 </p>
64 <p>
65 Hunchentoot comes with a
66 <a href="http://www.opensource.org/licenses/bsd-license.php">BSD-style
67 license</a> so you can basically do with it whatever you want.
68 </p>
70 </blockquote>
72 <h3 xmlns=""><a class="none" name="contents">Contents</a></h3>
73 <ol xmlns="">
74 <li><a href="#abstract">Abstract</a></li>
75 <li><a href="#contents">Contents</a></li>
76 <li>
77 <a href="#install">Download and installation</a><ol>
78 <li><a href="#port80">Running Hunchentoot on port 80</a></li>
79 <li><a href="#proxy">Hunchentoot behind a proxy</a></li>
80 </ol>
81 </li>
82 <li><a href="#support">Support</a></li>
83 <li><a href="#teen-age">Your own webserver (the easy teen-age New York version)</a></li>
84 <li><a href="#extras">Third party documentation and add-ons</a></li>
85 <li>
86 <a href="#reference">Function and variable reference</a><ol>
87 <li><a href="#acceptors">Acceptors</a></li>
88 <li><a href="#acceptor-behaviour">Customizing acceptor behaviour</a></li>
89 <li><a href="#subclassing-acceptors">An example of how to subclass ACCEPTOR</a></li>
90 <li><a href="#taskmasters">Taskmasters</a></li>
91 <li><a href="#request-dispatch">Request dispatch and handling</a></li>
92 <li><a href="#easy-handlers">Using the easy-handler framework</a></li>
93 <li><a href="#requests">Request objects</a></li>
94 <li><a href="#replies">Reply objects</a></li>
95 <li><a href="#sessions">Sessions</a></li>
96 <li><a href="#session-behaviour">Customizing session behaviour</a></li>
97 <li><a href="#cookies">Cookies</a></li>
98 <li><a href="#logging">Logging</a></li>
99 <li><a href="#conditions">Conditions and error handling</a></li>
100 <li><a href="#misc">Miscellaneous</a></li>
101 </ol>
102 </li>
103 <li><a href="#testing">Testing</a></li>
104 <li><a href="#debugging">Debugging</a></li>
105 <li><a href="#history">History</a></li>
106 <li><a href="#index">Symbol index</a></li>
107 <li><a href="#ack">Acknowledgements</a></li>
108 </ol>
110 <h3 xmlns=""><a class="none" name="install">Download and installation</a></h3>
111 Hunchentoot depends on a couple of other Lisp libraries which you'll need
112 to install first:
113 <ul>
114 <li>Pierre R. Mai's <a href="http://www.cliki.net/md5">MD5</a>,</li>
115 <li>Kevin Rosenberg's <a href="http://www.cliki.net/cl-base64">CL-BASE64</a>,</li>
116 <li>Janis Dzerins' <a href="http://common-lisp.net/project/rfc2388/">RFC2388</a>,</li>
117 <li>Peter Seibel's <a href="http://weitz.de/cl-fad/">CL-FAD</a>,</li>
118 <li>Gary King's <a href="http://common-lisp.net/project/trivial-backtrace/">trivial-backtrace</a>,</li>
119 <li>Erik Huelsmann's <a href="http://common-lisp.net/project/usocket">usocket</a> (unless you're using LispWorks),</li>
120 <li>Greg Pfeil's <a href="http://common-lisp.net/project/bordeaux-threads/">Bordeaux Threads</a> (unless you're using LispWorks),
121 </li>
122 <li>
123 David Lichteblau's <a href="http://common-lisp.net/project/cl-plus-ssl/">CL+SSL</a>
124 (unless you're using LispWorks),
125 </li>
126 <li>
127 and my own <a href="http://weitz.de/flexi-streams/">FLEXI-STREAMS</a> (0.12.0 or higher),
128 <a href="http://weitz.de/chunga/">Chunga</a> (1.0.0 or
129 higher), and <a href="http://weitz.de/cl-ppcre/">
130 CL-PPCRE</a> (plus
131 <a href="http://weitz.de/cl-who/">CL-WHO</a> for the <a href="#teen-age">example code</a>
132 and <a href="http://weitz.de/drakma/">Drakma</a> for the <a href="#testing">tests</a>).
133 </li>
134 </ul>
136 Make sure to use the <em>newest</em> versions of all of these
137 libraries (which might themselves depend on other libraries) - try
138 the repository versions if you're in doubt. Note: You can compile
139 Hunchentoot without SSL support - and thus without the need to
140 have CL+SSL - if you add <code>:HUNCHENTOOT-NO-SSL</code> to
141 <a href="http://www.lispworks.com/documentation/HyperSpec/Body/v_featur.htm">
142 <code>*FEATURES*</code></a> <em>before</em> you compile it.
144 Hunchentoot will only work with Lisps where
145 the <a href="http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_c.htm#character_code">character
146 codes</a> of
147 all <a href="http://en.wikipedia.org/wiki/ISO/IEC_8859-1">Latin-1</a>
148 characters coincide with their
149 Unicode <a href="http://en.wikipedia.org/wiki/Code_point">code
150 points</a> (which is the case for all current implementations I
151 know).
152 </p>
154 Hunchentoot itself together with this documentation can be
155 downloaded from
156 <a href="https://github.com/edicl/hunchentoot/archive/v1.3.1.tar.gz">https://github.com/edicl/hunchentoot/archive/v1.3.1.tar.gz</a>.
157 The current version is 1.3.1.
158 </p>
160 The preferred method to compile and load Hunchentoot is via <a href="http://www.cliki.net/asdf">ASDF</a>. If you want to avoid
161 downloading and installing all the dependencies manually, give
162 Zach Beane's excellent <a href="http://www.quicklisp.org/">Quicklisp</a> system a try.
163 </p>
165 The current development version of Hunchentoot can be found
166 at <a href="https://github.com/edicl/hunchentoot">https://github.com/edicl/hunchentoot</a>.
167 If you want to send patches, please fork the github repository and send pull requests.
168 </p>
170 <h4 xmlns=""><a name="port80">Running Hunchentoot on port 80</a></h4>
172 Hunchentoot does not come with code to help with running it on a
173 privileged port (i.e. port 80 or 443) on Unix-like operating
174 systems. Modern Unix-like systems have specific, non-portable
175 ways to allow non-root users to listen to privileged ports, so
176 including such functionality in Hunchentoot was considered
177 unnecessary. Please refer to online resources for help. At the
178 time of this writing, the YAWS documentation has a <a href="http://yaws.hyber.org/privbind.yaws">comprehensive
179 writeup</a> on the topic.
182 <h4 xmlns=""><a name="proxy">Hunchentoot behind a proxy</a></h4>
184 If you're feeling unsecure about exposing Hunchentoot to the wild,
185 wild Internet or if your Lisp web application is part of a larger
186 website, you can hide it behind a
187 <a href="http://en.wikipedia.org/wiki/Proxy_server">proxy server</a>.
188 One approach that I have used several times is to employ Apache's
189 <a href="http://httpd.apache.org/docs/current/mod/mod_proxy.html">mod_proxy</a>
190 module with a configuration that looks like this:
192 <pre><a href="http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass" class="noborder">ProxyPass</a> /hunchentoot http://127.0.0.1:3000/hunchentoot
193 <a href="http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypassreverse" class="noborder">ProxyPassReverse</a> /hunchentoot http://127.0.0.1:3000/hunchentoot</pre>
195 This will tunnel all requests where the URI path begins with
196 <code>"/hunchentoot"</code> to a (Hunchentoot) server listening on
197 port 3000 on the same machine.
200 Of course, there are
201 <a href="http://www.red-bean.com/pipermail/lispweb/2006-October/001342.html">several
202 other</a> (more lightweight) web proxies that you could use
203 instead of Apache.
204 </p>
208 <h3 xmlns=""><a class="none" name="support">Support</a></h3>
210 The development version of Hunchentoot can be found <a href="https://github.com/edicl/hunchentoot" target="_new">on
211 github</a>. Please use the github issue tracking system to
212 submit bug reports. Patches are welcome, please use <a href="https://github.com/edicl/hunchentoot/pulls">GitHub pull
213 requests</a>.
214 </p>
217 <h3 xmlns=""><a class="none" name="teen-age">Your own webserver (the easy teen-age New York version)</a></h3>
218 Starting your own web server is pretty easy. Do something like this:
219 <pre>(hunchentoot:<a class="noborder" href="#teen-age">start</a> (make-instance 'hunchentoot:<a class="noborder" href="#acceptor">easy-acceptor</a> :port 4242))</pre>
220 That's it. Now you should be able to enter the address
221 "<a href="http://127.0.0.1:4242/"><code>http://127.0.0.1:4242/</code></a>" in
222 your browser and see something, albeit nothing very interesting
223 for now.
226 By default, Hunchentoot serves the files from the
227 <code><i>www/</i></code> directory in its source tree. In the
228 distribution, that directory contains a HTML version of the
229 documentation as well as the error templates. The location of
230 the document root directory can be specified when creating a new
231 <code xmlns=""><a href="#acceptor">ACCEPTOR</a></code> instance by the way of the
232 <code xmlns=""><a href="#acceptor-document-root">ACCEPTOR-DOCUMENT-ROOT</a></code>. Likewise, the
233 location of the error template directory can be specified by the
234 <code xmlns=""><a href="#acceptor-error-template-directory">ACCEPTOR-ERROR-TEMPLATE-DIRECTORY</a></code>. Both
235 <code xmlns=""><a href="#acceptor-document-root">ACCEPTOR-DOCUMENT-ROOT</a></code> and
236 <code xmlns=""><a href="#acceptor-error-template-directory">ACCEPTOR-ERROR-TEMPLATE-DIRECTORY</a></code> can be
237 specified using a logical pathname, which will be translated
238 once when the <code xmlns=""><a href="#acceptor">ACCEPTOR</a></code> is instantiated.
239 </p>
242 The <code xmlns=""><a href="#easy-acceptor">EASY-ACCEPTOR</a></code> class implements a
243 framework for developing web applications. Handlers are defined
244 using the <code xmlns=""><a href="#define-easy-handler">DEFINE-EASY-HANDLER</a></code> macro.
245 Request dispatching is performed according to the list of
246 dispatch functions in <code xmlns=""><a href="#*dispatch-table*">*DISPATCH-TABLE*</a></code>.
247 Each of the functions on that list is called to determine
248 whether it wants to handle the request, provided as single
249 argument. If a dispatcher function wants to handle the request,
250 it returns another function to actually create the desired page.
251 </p>
254 <code xmlns=""><a href="#define-easy-handler">DEFINE-EASY-HANDLER</a></code> is accompanied by a set
255 of dispatcher creation functions that can be used to create
256 dispatchers for standard tasks. These are documented in the <a class="noborder" href="#easy-handlers">subchapter on easy
257 handlers</a>
258 </p>
261 Now be a bit more adventurous, try this
262 <pre>(hunchentoot:<a class="noborder" href="#define-easy-handler">define-easy-handler</a> (say-yo :uri "/yo") (name)
263 (setf (hunchentoot:<a class="noborder" href="#content-type*">content-type*</a>) "text/plain")
264 (format nil "Hey~@[ ~A~]!" name))</pre>
265 and see what happens at "<a href="http://127.0.0.1:4242/yo"><code>http://127.0.0.1:4242/yo</code></a>" or
266 "<a href="http://127.0.0.1:4242/yo?name=Dude"><code>http://127.0.0.1:4242/yo?name=Dude</code></a>" .
267 </p>
269 <h3 xmlns=""><a class="none" name="extras">Third party documentation and add-ons</a></h3>
271 Adam Petersen has written a book called <a href="http://www.adampetersen.se/articles/lispweb.htm">"Lisp for
272 the Web"</a> which explains how Hunchentoot and some other
273 libraries can be used to build web sites.
274 </p>
276 Here is some software which extends Hunchentoot or is based on it:
277 </p>
278 <ul>
279 <li>
280 <a href="https://github.com/fukamachi/clack">Clack</a> is a
281 web server abstraction layer, defaulting to Hunchentoot.
282 </li>
283 <li>
284 <a href="https://github.com/slyrus/hunchentoot-cgi">hunchentoot-cgi</a>
285 (by Cyrus Harmon) provides
286 <a href="http://en.wikipedia.org/wiki/Common_Gateway_Interface">CGI</a>
287 handlers for Hunchentoot.
288 </li>
289 <li>
290 <a href="http://weitz.de/cl-webdav/">CL-WEBDAV</a> is a <a href="http://webdav.org/">WebDAV</a>
291 server based on Hunchentoot.
292 </li>
293 <li>
294 <a href="http://restas.lisper.ru/">RESTAS</a> is a web
295 framework based on Hunchentoot.
296 <a href="https://github.com/fukamachi/caveman">Caveman</a>, <a href="https://github.com/Shirakumo/radiance">Radiance</a>, <a href="https://github.com/joaotavora/snooze">Snooze</a>
297 or again <a href="http://40ants.com/weblocks/">Weblocks</a>
298 are frameworks compatible with it.
300 </li>
302 </ul>
305 <h3 xmlns=""><a class="none" name="reference">Function and variable reference</a></h3>
307 <h4 xmlns=""><a name="acceptors">Acceptors</a></h4>
309 If you want Hunchentoot to actually do something, you have to create and
310 <a href="#teen-age">start</a> an <a href="#acceptor">acceptor</a>.
311 You can also run several acceptors in one image, each one
312 listening on a different different port.
314 <p xmlns=""><a class="none" name="acceptor"></a>
315 [Standard class]
316 <br><b>acceptor</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
317 To create a Hunchentoot webserver, you make an instance of
318 this class or one of its subclasses and use the generic
319 function <code><a href="#start">START</a></code> to start it (and
320 <code><a href="#stop">STOP</a></code> to stop it). Use the
321 <code xmlns="http://www.w3.org/1999/xhtml">:port</code> initarg if you don't want to listen
322 on the default http port 80. If 0 is specified for the
323 port, the system chooses a random port to listen on. The
324 port number choosen can be retrieved using the
325 <code><a href="#acceptor-port">ACCEPTOR-PORT</a></code> accessor. The port
326 number chosen is retained across stopping and starting the
327 acceptor.
328 <p xmlns="http://www.w3.org/1999/xhtml">
329 There are other initargs most of which you probably
330 won't need very often. They are explained in detail
331 in the docstrings of the slot definitions.
332 </p>
333 <p xmlns="http://www.w3.org/1999/xhtml">
334 Unless you are in a Lisp without MP capabilities, you can
335 have several active instances of
336 <code xmlns=""><a href="#acceptor">ACCEPTOR</a></code> (listening on different
337 ports) at the same time.
338 </p>
339 </clix:description></blockquote></p>
341 <p xmlns=""><a class="none" name="ssl-acceptor"></a>
342 [Standard class]
343 <br><b>ssl-acceptor</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">Create and <code><a href="#start">START</a></code> an instance of this class
344 (instead of <code><a href="#acceptor">ACCEPTOR</a></code>) if you want an https server. There are two
345 required initargs, <code xmlns="http://www.w3.org/1999/xhtml">:SSL-CERTIFICATE-FILE</code> and <code xmlns="http://www.w3.org/1999/xhtml">:SSL-PRIVATEKEY-FILE</code>, for
346 pathname designators denoting the certificate file and the key file in
347 PEM format. On LispWorks, you can have both in one file in which case
348 the second initarg is optional. You can also use the
349 <code xmlns="http://www.w3.org/1999/xhtml">:SSL-PRIVATEKEY-PASSWORD</code> initarg to provide a password
350 (as a string) for the key file (or <code xmlns="http://www.w3.org/1999/xhtml">NIL</code>, the default, for
351 no password).
352 <p xmlns="http://www.w3.org/1999/xhtml">
353 The default port for <code xmlns=""><a href="#ssl-acceptor">SSL-ACCEPTOR</a></code> instances is 443 instead of 80
354 </p>
355 </clix:description></blockquote></p>
357 <p xmlns=""><a class="none" name="start"></a>
358 [Generic function]
359 <br><b>start</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
360 </clix:lambda-list></i>
361 =&gt;
362 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">acceptor
363 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">Starts <code><i>acceptor</i></code> so that it begins accepting
364 connections. Returns the acceptor.
365 </clix:description></blockquote></p>
367 <p xmlns=""><a class="none" name="stop"></a>
368 [Generic function]
369 <br><b>stop</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor &amp;key soft</clix:lambda-list></i>
370 =&gt;
371 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">acceptor
372 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">Stops the <code><i>acceptor</i></code> so
373 that it no longer accepts requests. If
374 <code><i>soft</i></code> is true, and there are any requests
375 in progress, wait until all requests are fully processed, but
376 meanwhile do not accept new requests. Note that
377 <code><i>soft</i></code> must not be set when calling
378 <code><a href="#stop">stop</a></code> from within a request handler, as
379 that will deadlock.
380 </clix:description></blockquote></p>
382 <p xmlns=""><a class="none" name="started-p"></a>
383 [Generic function]
384 <br><b>started-p</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
385 </clix:lambda-list></i>
386 =&gt;
387 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">generalized-boolean
388 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">Tells if <code><i>acceptor</i></code> has been started.
389 The default implementation simply queries <code><i>acceptor</i></code>
390 for its listening status, so if T is returned to the calling thread,
391 then some thread has called <code><a href="#start">start</a></code> or
392 some thread's call to <code><a href="#stop">stop</a></code> hasn't
393 finished. If NIL is returned either some thread has called
394 <code><a href="#stop">stop</a></code>, or some thread's call to
395 <code><a href="#start">start</a></code> hasn't finished or
396 <code><a href="#start">start</a></code> was never called at all for
397 <code><i>acceptor</i></code>.
398 </clix:description></blockquote></p>
400 <p xmlns=""><a class="none" name="*acceptor*"></a>
401 [Special variable]
402 <br><b>*acceptor*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">The current ACCEPTOR object in the context of a request.
403 </clix:description></blockquote></p>
405 <p xmlns=""><a class="none" name="acceptor-listen-backlog"></a>
406 [Generic function]
407 <br><b>acceptor-listen-backlog</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">listen-backlog
408 </clix:lambda-list></i>
409 =&gt;
410 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">number-of-pending-connections
411 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
412 Number of pending connections allowed in the listen socket
413 before the kernel rejects further incoming connections.
414 Non-LispWorks only.
415 </clix:description></blockquote></p>
417 <p xmlns="">
418 [Generic readers]<br><a class="none" name="acceptor-address"></a><b>acceptor-address</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
419 </clix:lambda-list></i>
420 =&gt;
421 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">address
422 </clix:returns></i><br><a class="none" name="acceptor-port"></a><b>acceptor-port</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
423 </clix:lambda-list></i>
424 =&gt;
425 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">port
426 </clix:returns></i><br><a class="none" name="acceptor-read-timeout"></a><b>acceptor-read-timeout</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
427 </clix:lambda-list></i>
428 =&gt;
429 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">read-timeout
430 </clix:returns></i><br><a class="none" name="acceptor-ssl-certificate-file"></a><b>acceptor-ssl-certificate-file</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">ssl-acceptor
431 </clix:lambda-list></i>
432 =&gt;
433 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">ssl-certificate-file
434 </clix:returns></i><br><a class="none" name="acceptor-ssl-privatekey-file"></a><b>acceptor-ssl-privatekey-file</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">ssl-acceptor
435 </clix:lambda-list></i>
436 =&gt;
437 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">ssl-privatekey-file
438 </clix:returns></i><br><a class="none" name="acceptor-ssl-privatekey-password"></a><b>acceptor-ssl-privatekey-password</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">ssl-acceptor
439 </clix:lambda-list></i>
440 =&gt;
441 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">ssl-privatekey-password
442 </clix:returns></i><br><a class="none" name="acceptor-write-timeout"></a><b>acceptor-write-timeout</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
443 </clix:lambda-list></i>
444 =&gt;
445 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">write-timeout
446 </clix:returns></i><br><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
447 These are readers for various slots of <code><a href="#acceptor">ACCEPTOR</a></code>
448 objects (and some of them obviously only make sense
449 for <code><a href="#ssl-acceptor">SSL-ACCEPTOR</a></code> objects). See the docstrings of
450 these slots for more information and note that there are corresponding
451 initargs for all of them.
452 </clix:description></blockquote></p>
454 <p xmlns="">
455 [Generic accessors]<br><a class="none" name="acceptor-access-log-destination"></a><b>acceptor-access-log-destination</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
456 </clix:lambda-list></i>
457 =&gt;
458 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">(or pathname null)
459 </clix:returns></i><br><tt>(setf (</tt><b>acceptor-access-log-destination</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
460 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><br><a class="none" name="acceptor-document-root"></a><b>acceptor-document-root</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
461 </clix:lambda-list></i>
462 =&gt;
463 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">(or pathname null)
464 </clix:returns></i><br><tt>(setf (</tt><b>acceptor-document-root</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
465 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><br><a class="none" name="acceptor-error-template-directory"></a><b>acceptor-error-template-directory</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
466 </clix:lambda-list></i>
467 =&gt;
468 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">(or pathname null)
469 </clix:returns></i><br><tt>(setf (</tt><b>acceptor-error-template-directory</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
470 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><br><a class="none" name="acceptor-input-chunking-p"></a><b>acceptor-input-chunking-p</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
471 </clix:lambda-list></i>
472 =&gt;
473 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">input-chunking-p
474 </clix:returns></i><br><tt>(setf (</tt><b>acceptor-input-chunking-p</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
475 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><br><a class="none" name="acceptor-message-log-destination"></a><b>acceptor-message-log-destination</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
476 </clix:lambda-list></i>
477 =&gt;
478 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">(or pathname null)
479 </clix:returns></i><br><tt>(setf (</tt><b>acceptor-message-log-destination</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
480 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><br><a class="none" name="acceptor-name"></a><b>acceptor-name</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
481 </clix:lambda-list></i>
482 =&gt;
483 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">name
484 </clix:returns></i><br><tt>(setf (</tt><b>acceptor-name</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
485 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><br><a class="none" name="acceptor-output-chunking-p"></a><b>acceptor-output-chunking-p</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
486 </clix:lambda-list></i>
487 =&gt;
488 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">output-chunking-p
489 </clix:returns></i><br><tt>(setf (</tt><b>acceptor-output-chunking-p</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
490 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><br><a class="none" name="acceptor-persistent-connections-p"></a><b>acceptor-persistent-connections-p</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
491 </clix:lambda-list></i>
492 =&gt;
493 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">persistent-connections-p
494 </clix:returns></i><br><tt>(setf (</tt><b>acceptor-persistent-connections-p</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
495 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><br><a class="none" name="acceptor-reply-class"></a><b>acceptor-reply-class</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
496 </clix:lambda-list></i>
497 =&gt;
498 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">reply-class
499 </clix:returns></i><br><tt>(setf (</tt><b>acceptor-reply-class</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
500 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><br><a class="none" name="acceptor-request-class"></a><b>acceptor-request-class</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
501 </clix:lambda-list></i>
502 =&gt;
503 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">request-class
504 </clix:returns></i><br><tt>(setf (</tt><b>acceptor-request-class</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
505 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><br><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
506 These are accessors for various slots of <code><a href="#acceptor">ACCEPTOR</a></code>
507 objects. See the docstrings of these slots for more information and
508 note that there are corresponding initargs for all of them.
509 </clix:description></blockquote></p>
511 <p xmlns=""><a class="none" name="acceptor-ssl-p"></a>
512 [Generic function]
513 <br><b>acceptor-ssl-p</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
514 </clix:lambda-list></i>
515 =&gt;
516 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">generalized-boolean
517 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">Returns a true value if <code><i>acceptor</i></code> uses SSL
518 connections. The default is to unconditionally return <code xmlns="http://www.w3.org/1999/xhtml">NIL</code> and
519 subclasses of <code><a href="#acceptor">ACCEPTOR</a></code> must specialize this method to signal that
520 they're using secure connections - see the <code><a href="#ssl-acceptor">SSL-ACCEPTOR</a></code> class.
521 </clix:description></blockquote></p>
523 <p xmlns=""><a class="none" name="*default-connection-timeout*"></a>
524 [Special variable]
525 <br><b>*default-connection-timeout*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">The default connection timeout used when an
526 acceptor is reading from and writing to a socket stream. Note that
527 some Lisps allow you to set different timeouts for reading and writing
528 and you can specify both values via initargs when you create
529 an <a xmlns="http://www.w3.org/1999/xhtml" href="#acceptors">acceptor</a>.
530 </clix:description></blockquote></p>
532 <p xmlns=""><a class="none" name="acceptor-remove-session"></a>
533 [Generic function]
534 <br><b>acceptor-remove-session</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor session
535 </clix:lambda-list></i>
536 =&gt;
537 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">|
538 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
539 This function is called whenever a session in
540 <code><a href="#acceptor">ACCEPTOR</a></code> is being destroyed because of
541 a session timout or an explicit
542 <code><a href="#remove-session">REMOVE-SESSION</a></code> call.
543 </clix:description></blockquote></p>
547 <h4 xmlns=""><a name="acceptor-behaviour">Customizing acceptor behaviour</a></h4>
549 If you want to modify what acceptors do, you should subclass
550 <code xmlns=""><a href="#acceptor">ACCEPTOR</a></code> (or <code xmlns=""><a href="#ssl-acceptor">SSL-ACCEPTOR</a></code>) and
551 specialize the generic functions that constitute their behaviour (see
552 example below). The life of an acceptor looks like this: It is started
553 with the function <code xmlns=""><a href="#start">START</a></code> which immediately calls
554 <code xmlns=""><a href="#start-listening">START-LISTENING</a></code> and then applies the function
555 <code xmlns=""><a href="#execute-acceptor">EXECUTE-ACCEPTOR</a></code> to its <a href="#taskmasters">taskmaster</a>. This function will eventually call
556 <code xmlns=""><a href="#accept-connections">ACCEPT-CONNECTIONS</a></code> which is responsible for setting
557 things up to wait for clients to connect. For each incoming connection
558 which comes in, <code xmlns=""><a href="#handle-incoming-connection">HANDLE-INCOMING-CONNECTION</a></code> is applied
559 to the taskmaster which will either call
560 <code xmlns=""><a href="#process-connection">PROCESS-CONNECTION</a></code> directly, or will create a thread
561 to call it. <code xmlns=""><a href="#process-connection">PROCESS-CONNECTION</a></code> calls
562 <code xmlns=""><a href="#initialize-connection-stream">INITIALIZE-CONNECTION-STREAM</a></code> before it does anything
563 else, then it selects and calls a function which handles the <a href="#requests">request</a>, and finally it sends the <a href="#replies">reply</a> to the client before it calls
564 <code xmlns=""><a href="#reset-connection-stream">RESET-CONNECTION-STREAM</a></code>. If the connection is
565 persistent, this procedure is repeated (except for the intialization step)
566 in a loop until the connection is closed. The acceptor is stopped with
567 <code xmlns=""><a href="#stop">STOP</a></code>.
570 If you just want to use the standard acceptors that come with
571 Hunchentoot, you don't need to know anything about the functions
572 listed in this section.
573 </p>
575 <p xmlns=""><a class="none" name="start-listening"></a>
576 [Generic function]
577 <br><b>start-listening</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
578 </clix:lambda-list></i>
579 =&gt;
580 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">|
581 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">Sets up a listen socket for the given acceptor and
582 enables it to listen to incoming connections. This function is called
583 from the thread that starts the acceptor initially and may return
584 errors resulting from the listening operation (like 'address in use'
585 or similar).
586 </clix:description></blockquote></p>
588 <p xmlns=""><a class="none" name="accept-connections"></a>
589 [Generic function]
590 <br><b>accept-connections</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
591 </clix:lambda-list></i>
592 =&gt;
593 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">nil
594 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">In a loop, accepts a connection and hands it over
595 to the acceptor's taskmaster for processing using
596 <code><a href="#handle-incoming-connection">HANDLE-INCOMING-CONNECTION</a></code>. On LispWorks, this
597 function returns immediately, on other Lisps it returns only once the
598 acceptor has been stopped.
599 </clix:description></blockquote></p>
601 <p xmlns=""><a class="none" name="process-connection"></a>
602 [Generic function]
603 <br><b>process-connection</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor socket
604 </clix:lambda-list></i>
605 =&gt;
606 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">nil
607 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
608 This function is called by the taskmaster when a new client
609 connection has been established. Its arguments are the
610 <code><a href="#acceptor">ACCEPTOR</a></code> object and a LispWorks socket
611 handle or a usocket socket stream object in
612 <code><i>socket</i></code>. It reads the request headers,
613 sets up the <a xmlns="http://www.w3.org/1999/xhtml" href="#requests">request</a> and <a xmlns="http://www.w3.org/1999/xhtml" href="#replies">reply</a> objects, and hands over to
614 <code><a href="#process-request">PROCESS-REQUEST</a></code> which calls
615 <code><a href="#handle-request">HANDLE-REQUEST</a></code> to select and call a
616 handler for the request and sends its reply to the client.
617 This is done in a loop until the stream has to be closed or
618 until a connection timeout occurs. It is probably not a
619 good idea to re-implement this method until you really,
620 really know what you're doing.
621 <p xmlns="http://www.w3.org/1999/xhtml">
622 Handlers may call to the
623 <code xmlns=""><a href="#detach-socket">DETACH-SOCKET</a></code> generic function to
624 indicate that no further requests should be handled on
625 the connection by Hunchentoot, and that responsibility for
626 the socket is assumed by third-party software. This can
627 be used by specialized handlers that wish to hand over
628 connection polling or processing to functions outside of
629 Hunchentoot, i.e. for connection multiplexing or
630 implementing specialized client protocols. Hunchentoot
631 will finish processing the request and the
632 <code xmlns=""><a href="#process-connection">PROCESS-CONNECTION</a></code> function will
633 return without closing the connection. At that point,
634 the acceptor may interact with the socket in whatever
635 fashion required.
636 </p>
637 </clix:description></blockquote></p>
639 <p xmlns=""><a class="none" name="detach-socket"></a>
640 [Generic function]
641 <br><b>detach-socket</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
642 </clix:lambda-list></i>
643 =&gt;
644 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">nil
645 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
646 Indicate to Hunchentoot that it should stop serving requests
647 on the current request's socket. Hunchentoot will finish
648 processing the current request and then return from
649 <code><a href="#process-connection">PROCESS-CONNECTION</a></code> without closing the
650 connection to the client.
651 <code><a href="#detach-socket">DETACH-SOCKET</a></code> can only be called from
652 within a request handler function.
653 </clix:description></blockquote></p>
655 <p xmlns=""><a class="none" name="initialize-connection-stream"></a>
656 [Generic function]
657 <br><b>initialize-connection-stream</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor stream
658 </clix:lambda-list></i>
659 =&gt;
660 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">stream
661 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
662 Can be used to modify the stream which is used to
663 communicate between client and server before the request is
664 read. The default method of <code><a href="#acceptor">ACCEPTOR</a></code>
665 does nothing, but see for example the method defined for
666 <code><a href="#ssl-acceptor">SSL-ACCEPTOR</a></code>. All methods of this
667 generic function <em xmlns="http://www.w3.org/1999/xhtml">must</em> return the stream to use.
668 </clix:description></blockquote></p>
670 <p xmlns=""><a class="none" name="reset-connection-stream"></a>
671 [Generic function]
672 <br><b>reset-connection-stream</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor stream
673 </clix:lambda-list></i>
674 =&gt;
675 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">stream
676 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
677 Resets the stream which is used to communicate
678 between client and server after one request has been served so that it
679 can be used to process the next request. This generic function is
680 called after a request has been processed and <em xmlns="http://www.w3.org/1999/xhtml">must</em> return the
681 stream.
682 </clix:description></blockquote></p>
684 <p xmlns=""><a class="none" name="acceptor-log-access"></a>
685 [Generic function]
686 <br><b>acceptor-log-access</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor &amp;key return-code</clix:lambda-list></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
687 Function to call to log access to the acceptor. The
688 <code><i>return-code</i></code> keyword argument contains additional
689 information about the request to log. In addition, it can use the
690 standard request and reply accessor functions that are available to
691 handler functions to find out more information about the request.
692 </clix:description></blockquote></p>
694 <p xmlns=""><a class="none" name="acceptor-log-message"></a>
695 [Generic function]
696 <br><b>acceptor-log-message</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor log-level format-string &amp;rest format-arguments</clix:lambda-list></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
697 Function to call to log messages by the <code><i>acceptor</i></code>. It must accept
698 a severity level for the message, which will be one of :ERROR, :INFO,
699 or :WARNING, a format string and an arbitary number of formatting
700 arguments.
701 </clix:description></blockquote></p>
703 <p xmlns=""><a class="none" name="acceptor-status-message"></a>
704 [Generic function]
705 <br><b>acceptor-status-message</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor http-return-code &amp;key &amp;allow-other-keys</clix:lambda-list></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
706 This function is called when a request's handler has been
707 called but failed to provide content to send back to the
708 client. It converts the
709 <code><i>HTTP-STATUS-CODE</i></code> to some request
710 contents, typically a human readable description of the
711 status code to be displayed to the user.
713 If an ERROR-TEMPLATE-DIRECTORY is set in the current
714 acceptor and the directory contains a file corresponding to
715 HTTP-STATUS-CODE named &lt;code&gt;.html, that file is sent
716 to the client after variable substitution. Variables are
717 referenced by ${&lt;variable-name&gt;}.
719 Additional keyword arguments may be provided which are made
720 available to the templating logic as substitution variables.
721 These variables can be interpolated into error message
722 templates in, which contains the current URL relative to the
723 server and without GET parameters.
725 In addition to the variables corresponding to keyword
726 arguments, the script-name, lisp-implementation-type,
727 lisp-implementation-version and hunchentoot-version
728 variables are available.
729 </clix:description></blockquote></p>
732 <h4 xmlns=""><a name="subclassing-acceptors">An example of how to subclass ACCEPTOR</a></h4>
734 This example shows how to subclass <code xmlns=""><a href="#acceptor">ACCEPTOR</a></code> in order to
735 provide Hunchentoot with basic virtual host support.  It assumes
736 Hunchentoot is sitting behind an Internet-facing reverse-proxy web server
737 that maps the host (or domain) part of incoming HTTP requests to unique
738 localhost ports.
740 <pre>(asdf:load-system "hunchentoot")
741 (asdf:load-system "drakma")
743 ;;; Subclass ACCEPTOR
744 (defclass vhost (hunchentoot:acceptor)
745 ;; slots
746 ((dispatch-table
747 :initform '()
748 :accessor dispatch-table
749 :documentation "List of dispatch functions"))
750 ;; options
751 (:default-initargs ; default-initargs must be used
752 :address "127.0.0.1")) ; because ACCEPTOR uses it
754 ;;; Specialise ACCEPTOR-DISPATCH-REQUEST for VHOSTs
755 (defmethod hunchentoot:acceptor-dispatch-request ((vhost vhost) request)
756 ;; try REQUEST on each dispatcher in turn
757 (mapc (lambda (dispatcher)
758 (let ((handler (funcall dispatcher request)))
759 (when handler ; Handler found. FUNCALL it and return result
760 (return-from hunchentoot:acceptor-dispatch-request (funcall handler)))))
761 (dispatch-table vhost))
762 (call-next-method))
764 ;;; ======================================================================
765 ;;; Now all we need to do is test it
767 ;;; Instantiate VHOSTs
768 (defvar vhost1 (make-instance 'vhost :port 50001))
769 (defvar vhost2 (make-instance 'vhost :port 50002))
771 ;;; Populate each dispatch table
772 (push
773 (hunchentoot:create-prefix-dispatcher "/foo" 'foo1)
774 (dispatch-table vhost1))
775 (push
776 (hunchentoot:create-prefix-dispatcher "/foo" 'foo2)
777 (dispatch-table vhost2))
779 ;;; Define handlers
780 (defun foo1 () "Hello")
781 (defun foo2 () "Goodbye")
783 ;;; Start VHOSTs
784 (hunchentoot:start vhost1)
785 (hunchentoot:start vhost2)
787 ;;; Make some requests
788 (drakma:http-request "http://127.0.0.1:50001/foo")
789 ;;; =|
790 ;;; 127.0.0.1 - [2012-06-08 14:30:39] "GET /foo HTTP/1.1" 200 5 "-" "Drakma/1.2.6 (SBCL 1.0.56; Linux; 2.6.32-5-686; http://weitz.de/drakma/)"
791 ;;; =&gt;
792 ;;; "Hello"
793 ;;; 200
794 ;;; ((:CONTENT-LENGTH . "5") (:DATE . "Fri, 08 Jun 2012 14:30:39 GMT")
795 ;;; (:SERVER . "Hunchentoot 1.2.3") (:CONNECTION . "Close")
796 ;;; (:CONTENT-TYPE . "text/html; charset=utf-8"))
797 ;;; #&lt;PURI:URI http://127.0.0.1:50001/foo&gt;
798 ;;; #&lt;FLEXI-STREAMS:FLEXI-IO-STREAM {CA90059}&gt;
799 ;;; T
800 ;;; "OK"
801 (drakma:http-request "http://127.0.0.1:50002/foo")
802 ;;; =|
803 ;;; 127.0.0.1 - [2012-06-08 14:30:47] "GET /foo HTTP/1.1" 200 7 "-" "Drakma/1.2.6 (SBCL 1.0.56; Linux; 2.6.32-5-686; http://weitz.de/drakma/)"
804 ;;; =&gt;
805 ;;; "Goodbye"
806 ;;; 200
807 ;;; ((:CONTENT-LENGTH . "7") (:DATE . "Fri, 08 Jun 2012 14:30:47 GMT")
808 ;;; (:SERVER . "Hunchentoot 1.2.3") (:CONNECTION . "Close")
809 ;;; (:CONTENT-TYPE . "text/html; charset=utf-8"))
810 ;;; #&lt;PURI:URI http://127.0.0.1:50002/foo&gt;
811 ;;; #&lt;FLEXI-STREAMS:FLEXI-IO-STREAM {CAE8059}&gt;
812 ;;; T
813 ;;; "OK"</pre>
815 How to make each VHOST write to separate access log streams (or files) is
816 left as an exercise to the reader.
820 <h4 xmlns=""><a name="taskmasters">Taskmasters</a></h4>
821 As a "normal" Hunchentoot user, you can completely ignore
822 taskmasters and skip this section. But if you're still reading,
823 here are the dirty details: Each <a href="#acceptors">acceptor</a> has a taskmaster associated with
824 it at creation time. It is the taskmaster's job to distribute
825 the work of accepting and handling incoming connections. The
826 acceptor calls the taskmaster if appropriate and the taskmaster
827 calls back into the acceptor. This is done using the generic
828 functions described in this and the <a href="#acceptor-behaviour">previous</a> section. Hunchentoot
829 comes with two standard taskmaster implementations - one (which
830 is the default used on multi-threaded Lisps) which starts a new
831 thread for each incoming connection and one which handles all
832 requests sequentially. It should for example be relatively
833 straightforward to create a taskmaster which allocates threads
834 from a fixed pool instead of creating a new one for each
835 connection.
838 You can control the resources consumed by a threaded taskmaster via
839 two initargs. <code>:max-thread-count</code> lets you set the maximum
840 number of request threads that can be processes simultaneously. If
841 this is <code>nil</code>, the is no thread limit imposed.
843 <code>:max-accept-count</code> lets you set the maximum number of requests
844 that can be outstanding (i.e. being processed or queued for processing).
846 If <code>:max-thread-count</code> is supplied and <code>:max-accept-count</code>
847 is <code>NIL</code>, then a <code xmlns=""><a href="#+http-service-unavailable+">+HTTP-SERVICE-UNAVAILABLE+</a></code>
848 error will be generated if there are more than the max-thread-count
849 threads processing requests. If both <code>:max-thread-count</code>
850 and <code>:max-accept-count</code> are supplied, then max-thread-count
851 must be less than max-accept-count; if more than max-thread-count
852 requests are being processed, then requests up to max-accept-count
853 will be queued until a thread becomes available. If more than
854 max-accept-count requests are outstanding, then a <code xmlns=""><a href="#+http-service-unavailable+">+HTTP-SERVICE-UNAVAILABLE+</a></code>
855 error will be generated.
857 In a load-balanced environment with multiple Hunchentoot servers, it's
858 reasonable to provide <code>:max-thread-count</code> but leave
859 <code>:max-accept-count</code> null. This will immediately result
860 in <code xmlns=""><a href="#+http-service-unavailable+">+HTTP-SERVICE-UNAVAILABLE+</a></code> when one server is
861 out of resources, so the load balancer can try to find another server.
863 In an environment with a single Hunchentoot server, it's reasonable
864 to provide both <code>:max-thread-count</code> and a somewhat larger value
865 for <code>:max-accept-count</code>. This will cause a server that's almost
866 out of resources to wait a bit; if the server is completely out of resources,
867 then the reply will be <code xmlns=""><a href="#+http-service-unavailable+">+HTTP-SERVICE-UNAVAILABLE+</a></code>.
868 The default for these values is 100 and 120, respectively.
869 </p>
872 If you want to implement your own taskmasters, you should subclass
873 <code xmlns=""><a href="#taskmaster">TASKMASTER</a></code> or one of its subclasses,
874 <code xmlns=""><a href="#single-threaded-taskmaster">SINGLE-THREADED-TASKMASTER</a></code> or
875 <code xmlns=""><a href="#one-thread-per-connection-taskmaster">ONE-THREAD-PER-CONNECTION-TASKMASTER</a></code>, and
876 specialize the generic functions in this section.
877 </p>
879 <p xmlns=""><a class="none" name="taskmaster"></a>
880 [Standard class]
881 <br><b>taskmaster</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
882 An instance of this class is responsible for distributing
883 the work of handling requests for its acceptor. This is an
884 "abstract" class in the sense that usually only instances of
885 subclasses of <code><a href="#taskmaster">TASKMASTER</a></code> will be used.
886 </clix:description></blockquote></p>
888 <p xmlns=""><a class="none" name="one-thread-per-connection-taskmaster"></a>
889 [Standard class]
890 <br><b>one-thread-per-connection-taskmaster</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
891 A taskmaster that starts one thread for listening to
892 incoming requests and one thread for each incoming
893 connection.
894 <p xmlns="http://www.w3.org/1999/xhtml">
895 This is the default taskmaster implementation for multi-threaded Lisp
896 implementations.
897 </p>
898 </clix:description></blockquote></p>
900 <p xmlns=""><a class="none" name="single-threaded-taskmaster"></a>
901 [Standard class]
902 <br><b>single-threaded-taskmaster</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
903 A taskmaster that runs synchronously in the
904 thread where the <code><a href="#start">START</a></code> function was invoked (or
905 in the case of LispWorks in the thread started
906 by <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.lispworks.com/documentation/lw51/LWRM/html/lwref-61.htm#marker-910861"><code>COMM:START-UP-SERVER</code></a>).
907 This is the simplest possible taskmaster implementation in that its
908 methods do nothing but calling their acceptor "sister"
909 methods - <code><a href="#execute-acceptor">EXECUTE-ACCEPTOR</a></code> calls <code><a href="#accept-connections">ACCEPT-CONNECTIONS</a></code>,
910 <code><a href="#handle-incoming-connection">HANDLE-INCOMING-CONNECTION</a></code> calls <code><a href="#process-connection">PROCESS-CONNECTION</a></code>.
911 </clix:description></blockquote></p>
913 <p xmlns=""><a class="none" name="multi-threaded-taskmaster"></a>
914 [Standard class]
915 <br><b>multi-threaded-taskmaster</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
916 This is an abstract class for taskmasters that use multiple threads;
917 it is not a concrete class and you should not instantiate it with
918 <code xmlns="http://www.w3.org/1999/xhtml">MAKE-INSTANCE</code>.
919 Instead, you should instantiate its subclass
920 <code><a href="#one-thread-per-connection-taskmaster">ONE-THREAD-PER-CONNECTION-TASKMASTER</a></code> described above.
921 <code><a href="#multi-threaded-taskmaster">MULTI-THREADED-TASKMASTER</a></code>
922 is intended to be inherited from by extensions to Hunchentoot,
923 such as <a xmlns="http://www.w3.org/1999/xhtml" href="http://common-lisp.net/project/qitab/">quux-hunchentoot</a>'s
924 <code xmlns="http://www.w3.org/1999/xhtml">THREAD-POOLING-TASKMASTER</code>,
925 though at the moment, doing so only inherits one slot and one method,
926 on <code><a href="#execute-acceptor">EXECUTE-ACCEPTOR</a></code>,
927 to have it start a new thread for the acceptor,
928 then saved in said slot.
929 </clix:description></blockquote></p>
931 <p xmlns=""><a class="none" name="execute-acceptor"></a>
932 [Generic function]
933 <br><b>execute-acceptor</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">taskmaster
934 </clix:lambda-list></i>
935 =&gt;
936 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">result
937 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">This is a callback called by the acceptor once it
938 has performed all initial processing to start listening for incoming
939 connections (see <code><a href="#start-listening">START-LISTENING</a></code>). It usually calls the
940 <code><a href="#accept-connections">ACCEPT-CONNECTIONS</a></code> method of the acceptor, but depending on the
941 taskmaster instance the method might be called from a new thread.
942 </clix:description></blockquote></p>
944 <p xmlns=""><a class="none" name="handle-incoming-connection"></a>
945 [Generic function]
946 <br><b>handle-incoming-connection</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">taskmaster socket
947 </clix:lambda-list></i>
948 =&gt;
949 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">result
950 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
951 This function is called by the acceptor to start
952 processing of requests on a new incoming connection. <code><i>socket</i></code> is the
953 usocket instance that represents the new connection (or a socket
954 handle on LispWorks). The taskmaster starts processing requests on
955 the incoming connection by calling the <code><a href="#process-connection">PROCESS-CONNECTION</a></code>
956 method of the acceptor instance. The <code><i>socket</i></code> argument is passed to
957 <code><a href="#process-connection">PROCESS-CONNECTION</a></code> as an argument.
959 If the taskmaster is a multi-threaded taskmaster, <code><a href="#handle-incoming-thread">HANDLE-INCOMING-THREAD</a></code>
960 will call <code><a href="#create-request-handler-thread">CREATE-REQUEST-HANDLER-THREAD</a></code>, which will call
961 <code><a href="#process-connection">PROCESS-CONNECTION</a></code> in a new thread.
962 <code><a href="#handle-incoming-thread">HANDLE-INCOMING-THREAD</a></code> might issue a
963 <code><a href="#+http-service-unavailable+">+HTTP-SERVICE-UNAVAILABLE+</a></code> error
964 if there are too many request threads or it might block waiting for a
965 request thread to finish.
966 </clix:description></blockquote></p>
968 <p xmlns=""><a class="none" name="start-thread"></a>
969 [Generic function]
970 <br><b>start-thread</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">taskmaster thunk &amp;key
971 </clix:lambda-list></i>
972 =&gt;
973 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">thread
974 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">This function is a callback that
975 starts a new thread that will call the given <code><i>thunk</i></code>
976 in the context of the proper <code><i>taskmaster</i></code>,
977 with appropriate context-dependent keyword arguments.
978 <code><a href="#one-thread-per-connection-taskmaster">ONE-THREAD-PER-CONNECTION-TASKMASTER</a></code> uses it in
979 <code><a href="#execute-acceptor">EXECUTE-ACCEPTOR</a></code>
980 and <code><a href="#create-request-handler-thread">CREATE-REQUEST-HANDLER-THREAD</a></code>,
981 but specialized taskmasters may define more functions that use it.
982 By default, it just creates a thread calling the thunk
983 with a specified <code><i>name</i></code> keyword argument.
984 Specialized taskmasters may wrap special bindings and condition handlers
985 around the thunk call, register the thread in a management table, etc.
986 </clix:description></blockquote></p>
988 <p xmlns=""><a class="none" name="create-request-handler-thread"></a>
989 [Generic function]
990 <br><b>create-request-handler-thread</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">taskmaster socket
991 </clix:lambda-list></i>
992 =&gt;
993 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">thread
994 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">This function is called by <code><a href="#handle-incoming-thread">HANDLE-INCOMING-THREAD</a></code>
995 to create a new thread which calls <code><a href="#process-connection">PROCESS-CONNECTION</a></code>.
996 If you specialize this function, you must be careful to have the thread
997 call <code><a href="#decrement-taskmaster-request-count">DECREMENT-TASKMASTER-REQUEST-COUNT</a></code> before
998 it exits. A typical method will look like this:
1000 <pre xmlns="http://www.w3.org/1999/xhtml">(defmethod create-request-handler-thread ((taskmaster monitor-taskmaster) socket)
1001 (bt:make-thread
1002 (lambda ()
1003 (with-monitor-error-handlers
1004 (unwind-protect
1005 (with-monitor-variable-bindings
1006 (process-connection (taskmaster-acceptor taskmaster) socket))
1007 (decrement-taskmaster-request-count taskmaster))))))</pre>
1015 </clix:description></blockquote></p>
1017 <p xmlns=""><a class="none" name="shutdown"></a>
1018 [Generic function]
1019 <br><b>shutdown</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">taskmaster
1020 </clix:lambda-list></i>
1021 =&gt;
1022 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">taskmaster
1023 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">Shuts down the taskmaster, i.e. frees all resources
1024 that were set up by it. For example, a multi-threaded taskmaster
1025 might terminate all threads that are currently associated with it.
1026 This function is called by the acceptor's <code><a href="#stop">STOP</a></code> method.
1027 </clix:description></blockquote></p>
1029 <p xmlns=""><a class="none" name="taskmaster-acceptor"></a>
1030 [Generic accessor]
1031 <br><b>taskmaster-acceptor</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">taskmaster
1032 </clix:lambda-list></i>
1033 =&gt;
1034 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">acceptor
1035 </clix:returns></i><br><tt>(setf (</tt><b>taskmaster-acceptor</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">taskmaster
1036 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1037 This is an accessor for the slot of a <code><a href="#taskmaster">TASKMASTER</a></code>
1038 object that links back to the <a xmlns="http://www.w3.org/1999/xhtml" href="#acceptors">acceptor</a> it is
1039 associated with.
1040 </clix:description></blockquote></p>
1044 <h4 xmlns=""><a name="request-dispatch">Request dispatch and handling</a></h4>
1046 The main job of <code xmlns=""><a href="#handle-request">HANDLE-REQUEST</a></code> is to select
1047 and call a function which handles the request, i.e. which looks
1048 at the data the client has sent and prepares an appropriate
1049 reply to send back. This is by default implemented as follows:
1051 The ACCEPTOR class defines a
1052 <code xmlns=""><a href="#acceptor-dispatch-request">ACCEPTOR-DISPATCH-REQUEST</a></code> generic
1053 function which is used to actually dispatch the request. This
1054 function is called by the default method of
1055 <code xmlns=""><a href="#handle-request">HANDLE-REQUEST</a></code>. Each
1056 <code xmlns=""><a href="#acceptor-dispatch-request">ACCEPTOR-DISPATCH-REQUEST</a></code> method looks at
1057 the request object and depending on its contents decides to
1058 either handle the request or call the next method.
1059 </p>
1061 In order to dispatch a request, Hunchentoot calls the
1062 <code xmlns=""><a href="#acceptor-dispatch-request">ACCEPTOR-DISPATCH-REQUEST</a></code> generic
1063 functions. The method for <code xmlns=""><a href="#acceptor">ACCEPTOR</a></code> tries
1064 to serve a static file relative to it's
1065 <code xmlns=""><a href="#acceptor-document-root">ACCEPTOR-DOCUMENT-ROOT</a></code>. Application
1066 specific acceptor subclasses will typically perform URL
1067 parsing and dispatching according to the policy that is
1068 required.
1069 </p>
1071 The default method of <code xmlns=""><a href="#handle-request">HANDLE-REQUEST</a></code> sets
1072 up <a href="#logging">standard logging and error handling</a>
1073 before it calls the acceptor's request dispatcher.
1074 </p>
1076 Request handlers do their work by modifying
1077 the <a href="#replies">reply object</a> if necessary and by eventually
1078 returning the response body in the form of a string or a binary
1079 sequence. As an alternative, they can also
1080 call <code xmlns=""><a href="#send-headers">SEND-HEADERS</a></code> and write directly to a stream.
1081 </p>
1084 <h4 xmlns=""><a name="easy-handlers">Using the easy-handler framework</a></h4>
1086 The <code xmlns=""><a href="#easy-acceptor">EASY-ACCEPTOR</a></code> class defines a method
1087 for <code xmlns=""><a href="#acceptor-dispatch-request">ACCEPTOR-DISPATCH-REQUEST</a></code> that walks
1088 through the list <code xmlns=""><a href="#*dispatch-table*">*DISPATCH-TABLE*</a></code> which
1089 consists of <em>dispatch functions</em>. Each of these
1090 functions accepts the request object as its only argument and
1091 either returns a request handler to handle the request or
1092 <code>NIL</code> which means that the next dispatcher in the
1093 list will be tried. A <em>request handler</em> is a function
1094 of zero arguments which relies on the special variable
1095 <code xmlns=""><a href="#*request*">*REQUEST*</a></code> to access the request instance
1096 being serviced. If all dispatch functions return
1097 <code>NIL</code>, the next
1098 <code xmlns=""><a href="#acceptor-dispatch-request">ACCEPTOR-DISPATCH-REQUEST</a></code> will be called.
1099 </p>
1101 <strong>N.B.</strong> All functions and variables in this
1102 section are related to the easy request dispatch mechanism and
1103 are meaningless if you're using your own request dispatcher.
1104 </p>
1106 <p xmlns=""><a class="none" name="easy-acceptor"></a>
1107 [Standard class]
1108 <br><b>easy-acceptor</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1109 This class defines no additional slots with respect to
1110 <code><a href="#acceptor">ACCEPTOR</a></code>. It only serves as an
1111 additional type for dispatching calls to
1112 <code><a href="#acceptor-dispatch-request">ACCEPTOR-DISPATCH-REQUEST</a></code>. In order to
1113 use the easy handler framework, acceptors of this class or
1114 one of its subclasses must be used.
1115 </clix:description></blockquote></p>
1117 <p xmlns=""><a class="none" name="easy-ssl-acceptor"></a>
1118 [Standard class]
1119 <br><b>easy-ssl-acceptor</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1120 This class mixes the <code><a href="#ssl-acceptor">SSL-ACCEPTOR</a></code> and
1121 the <code><a href="#easy-acceptor">EASY-ACCEPTOR</a></code> classes. It is used
1122 when both ssl and the easy handler framework are required.
1123 </clix:description></blockquote></p>
1125 <p xmlns=""><a class="none" name="*dispatch-table*"></a>
1126 [Special variable]
1127 <br><b>*dispatch-table*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1128 A global list of dispatch functions. The initial value is a
1129 list consisting of the symbol
1130 <code><a href="#dispatch-easy-handlers">DISPATCH-EASY-HANDLERS</a></code>.
1131 </clix:description></blockquote></p>
1133 <p xmlns=""><a class="none" name="create-prefix-dispatcher"></a>
1134 [Function]
1135 <br><b>create-prefix-dispatcher</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">prefix handler</clix:lambda-list></i>
1136 =&gt;
1137 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">dispatch-fn</clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1138 A convenience function which will return a dispatcher that
1139 returns <code><i>handler</i></code> whenever the path part of
1140 the request URI starts with the
1141 string <code><i>prefix</i></code>.
1142 </clix:description></blockquote></p>
1144 <p xmlns=""><a class="none" name="create-regex-dispatcher"></a>
1145 [Function]
1146 <br><b>create-regex-dispatcher</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">regex handler</clix:lambda-list></i>
1147 =&gt;
1148 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">dispatch-fn</clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1149 A convenience function which will return a dispatcher that
1150 returns <code><i>handler</i></code> whenever the path part of
1151 the request URI matches
1152 the <a xmlns="http://www.w3.org/1999/xhtml" href="http://weitz.de/cl-ppcre/">CL-PPCRE</a> regular
1153 expression <code><i>regex</i></code> (which can be a string, an
1154 s-expression, or a scanner).
1155 </clix:description></blockquote></p>
1157 <p xmlns=""><a class="none" name="create-folder-dispatcher-and-handler"></a>
1158 [Function]
1159 <br><b>create-folder-dispatcher-and-handler</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">uri-prefix base-path <tt>&amp;optional</tt> content-type callback</clix:lambda-list></i>
1160 =&gt;
1161 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">dispatch-fn</clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1162 Creates and returns a dispatch function which will dispatch to
1163 a handler function which emits the file relative
1164 to <code><i>base-path</i></code> that is denoted by the URI of
1165 the request relative
1166 to <code><i>uri-prefix</i></code>. <code><i>uri-prefix</i></code>
1167 must be a string ending with a
1168 slash, <code><i>base-path</i></code> must be a pathname
1169 designator for an existing directory.
1170 Uses <code><a href="#handle-static-file">HANDLE-STATIC-FILE</a></code> internally.
1171 <p xmlns="http://www.w3.org/1999/xhtml">
1172 If <code xmlns=""><i>content-type</i></code> is <em>not</em>
1173 <code>NIL</code>, it will be used as a the content type for
1174 all files in the folder. Otherwise (which is the default)
1175 the content type of each file will be
1176 determined <a href="#handle-static-file">as usual</a>.
1177 </p>
1178 <p xmlns="http://www.w3.org/1999/xhtml">
1179 The <code xmlns=""><i>callback</i></code> is passed on to
1180 <code xmlns=""><a href="#handle-static-file">HANDLE-STATIC-FILE</a></code>.
1181 </p>
1182 </clix:description></blockquote></p>
1184 <p xmlns=""><a class="none" name="create-static-file-dispatcher-and-handler"></a>
1185 [Function]
1186 <br><b>create-static-file-dispatcher-and-handler</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">uri path
1187 <tt>&amp;optional
1188 </tt> content-type callback
1189 </clix:lambda-list></i>
1190 =&gt;
1191 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">result
1192 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1193 Creates and returns a request dispatch function which will
1194 dispatch to a handler function which emits the file denoted
1195 by the pathname designator PATH with content type
1196 CONTENT-TYPE if the SCRIPT-NAME of the request matches the
1197 string URI. If CONTENT-TYPE is NIL, tries to determine the
1198 content type via the file's suffix.
1199 <p xmlns="http://www.w3.org/1999/xhtml">
1200 The <code xmlns=""><i>callback</i></code> is passed on to
1201 <code xmlns=""><a href="#handle-static-file">HANDLE-STATIC-FILE</a></code>.
1202 </p>
1203 </clix:description></blockquote></p>
1205 <p xmlns=""><a class="none" name="define-easy-handler"></a>
1206 [Macro]
1207 <br><b>define-easy-handler</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">description lambda-list [[declaration* | documentation]] form*</clix:lambda-list></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1208 Defines a handler as if
1209 by <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.lispworks.com/documentation/HyperSpec/Body/m_defun.htm">
1210 <code>DEFUN</code></a> and optionally registers it with a
1211 URI so that it will be found
1212 by <code><a href="#dispatch-easy-handlers">DISPATCH-EASY-HANDLERS</a></code>.
1213 <p xmlns="http://www.w3.org/1999/xhtml">
1214 <code xmlns=""><i>description</i></code> is either a
1215 symbol <code xmlns=""><i>name</i></code> or a list matching the
1216 <a href="http://www.lispworks.com/documentation/HyperSpec/Body/03_de.htm">destructuring
1217 lambda list</a>
1218 </p>
1219 <pre xmlns="http://www.w3.org/1999/xhtml">(name &amp;key uri host acceptor-names default-parameter-type default-request-type).</pre>
1220 <code><i>lambda-list</i></code> is a list the elements of which
1221 are either a symbol <code><i>var</i></code> or a list matching
1222 the destructuring lambda list
1223 <pre xmlns="http://www.w3.org/1999/xhtml">(var &amp;key real-name parameter-type init-form request-type).</pre>
1224 The resulting handler will be a Lisp function with the
1225 name <code><i>name</i></code> and keyword parameters named by
1226 the <code><i>var</i></code> symbols.
1227 Each <code><i>var</i></code> will be bound to the value of the
1228 GET or POST parameter called <code><i>real-name</i></code> (a
1229 string) before the body of the function is executed.
1230 If <code><i>real-name</i></code> is not provided, it will be
1231 computed
1232 by <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_stg_up.htm#string-downcase">downcasing</a>
1233 the symbol name of <code><i>var</i></code>.
1234 <p xmlns="http://www.w3.org/1999/xhtml">
1235 If <code xmlns=""><i>uri</i></code> (which is evaluated) is provided,
1236 then it must be a string or
1237 a <a href="http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_f.htm#function_designator">function
1238 designator</a> for a unary function. In this case, the
1239 handler will be returned
1240 by <code xmlns=""><a href="#dispatch-easy-handlers">DISPATCH-EASY-HANDLERS</a></code>,
1241 if <code xmlns=""><i>uri</i></code> is a string and
1242 the <a href="#script-name">script name</a> of the current
1243 request is <code xmlns=""><i>uri</i></code>, or
1244 if <code xmlns=""><i>uri</i></code> designates a function and applying
1245 this function to
1246 the <a href="#*request*">current <code>REQUEST</code>
1247 object</a> returns a true value.
1248 </p>
1249 <p xmlns="http://www.w3.org/1999/xhtml">If <code xmlns=""><i>host</i></code> is passed in, it is compared
1250 (via <code>STRING=</code>) to the host of the
1251 current request, and acts as another dispatch filter. Please note
1252 that the HTTP header sent from the browser might include the
1253 port number, resp. will include it for ports other than 80 and 443,
1254 so you will need to write something like
1255 <code>"common-lisp.net:8080"</code>.
1256 </p>
1257 <p xmlns="http://www.w3.org/1999/xhtml">
1258 <code xmlns=""><i>acceptor-names</i></code> (which is evaluated) can be a
1259 list of symbols which means that the handler will only be
1260 returned by <code xmlns=""><a href="#dispatch-easy-handlers">DISPATCH-EASY-HANDLERS</a></code> in
1261 acceptors which have one of these names
1262 (see <code xmlns=""><a href="#acceptor-name">ACCEPTOR-NAME</a></code>). <code xmlns=""><i>acceptor-names</i></code> can also be the
1263 symbol <code>T</code> which means that the handler will be
1264 returned by <code xmlns=""><a href="#dispatch-easy-handlers">DISPATCH-EASY-HANDLERS</a></code>
1265 in <em>every</em> acceptor.
1266 </p>
1267 <p xmlns="http://www.w3.org/1999/xhtml">
1268 Whether the GET or POST parameter (or both) will be taken into
1269 consideration, depends on <code xmlns=""><i>request-type</i></code>
1270 which can
1271 be <code>:GET</code>, <code>:POST</code>, <code>:BOTH</code>,
1272 or <code>NIL</code>. In the last case, the value of
1273 <code xmlns=""><i>default-request-type</i></code> (the default of which
1274 is <code>:BOTH</code>) will be used.
1275 </p>
1276 <p xmlns="http://www.w3.org/1999/xhtml">
1277 The value of <code xmlns=""><i>var</i></code> will usually be a string
1278 (unless it resulted from a <a href="#upload">file upload</a>
1279 in which case it won't be converted at all), but
1280 if <code xmlns=""><i>parameter-type</i></code> (which is evaluated) is
1281 provided, the string will be converted to another Lisp type by
1282 the following rules:
1283 </p>
1284 <p xmlns="http://www.w3.org/1999/xhtml">
1285 If the corresponding GET or POST parameter wasn't provided by
1286 the client, <code xmlns=""><i>var</i></code>'s value will
1287 be <code>NIL</code>. If <code xmlns=""><i>parameter-type</i></code>
1288 is <code>'STRING</code>,
1289 <code xmlns=""><i>var</i></code>'s value remains as is.
1290 If <code xmlns=""><i>parameter-type</i></code> is <code>'INTEGER</code>
1291 and the parameter string consists solely of decimal
1292 digits, <code xmlns=""><i>var</i></code>'s value will be the
1293 corresponding integer, otherwise <code>NIL</code>.
1294 If <code xmlns=""><i>parameter-type</i></code> is
1295 <code>'KEYWORD</code>, <code xmlns=""><i>var</i></code>'s value will be
1296 the keyword obtained
1297 by <a href="http://www.lispworks.com/documentation/HyperSpec/Body/f_intern.htm">interning</a>
1298 the <a href="http://www.lispworks.com/documentation/HyperSpec/Body/f_stg_up.htm#string-upcase">upcased</a>
1299 parameter string into
1300 the <a href="http://www.lispworks.com/documentation/HyperSpec/Body/11_abc.htm">keyword
1301 package</a>. If <code xmlns=""><i>parameter-type</i></code>
1302 is <code>'CHARACTER</code> and the parameter string is of
1303 length one, <code xmlns=""><i>var</i></code>'s value will be the single
1304 character of this string, otherwise <code>NIL</code>.
1305 If <code xmlns=""><i>parameter-type</i></code>
1306 is <code>'BOOLEAN</code>, <code xmlns=""><i>var</i></code>'s value will
1307 always be <code>T</code> (unless it is <code>NIL</code> by the
1308 first rule above, of course).
1309 If <code xmlns=""><i>parameter-type</i></code> is any other atom, it is
1310 supposed to be
1311 a <a href="http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_f.htm#function_designator">function
1312 designator</a> for a unary function which will be called to
1313 convert the string to something else.
1314 </p>
1315 <p xmlns="http://www.w3.org/1999/xhtml">
1316 Those were the rules for <em>simple</em> parameter types, but
1317 <code xmlns=""><i>parameter-type</i></code> can also be a list starting
1318 with one of the symbols
1319 <code>LIST</code>, <code>ARRAY</code>,
1320 or <code>HASH-TABLE</code>. The second value of the list must
1321 always be a simple parameter type as in the last paragraph -
1322 we'll call it the <em>inner type</em> below.
1323 </p>
1324 <p xmlns="http://www.w3.org/1999/xhtml">
1325 In the case of <code>'LIST</code>, all GET/POST parameters
1326 called <code xmlns=""><i>real-name</i></code> will be collected,
1327 converted to the inner type as by the rules above, and
1328 assembled into a list which will be the value of
1329 <code xmlns=""><i>var</i></code>.
1330 </p>
1331 <p xmlns="http://www.w3.org/1999/xhtml">
1332 In the case of <code>'ARRAY</code>, all GET/POST parameters
1333 which have a name like the result of
1334 </p>
1335 <pre xmlns="http://www.w3.org/1999/xhtml">(format nil "~A[~A]" real-name n)</pre>
1336 where <code><i>n</i></code> is a non-negative integer, will be
1337 assembled into an array where the <code><i>n</i></code>th element
1338 will be set accordingly, after conversion to the inner type.
1339 The array, which will become the value
1340 of <code><i>var</i></code>, will be big enough to hold all
1341 matching parameters, but not bigger. Array elements not set as
1342 described above will be <code xmlns="http://www.w3.org/1999/xhtml">NIL</code>. Note
1343 that <code xmlns="http://www.w3.org/1999/xhtml">VAR</code> will always be bound to an array, which
1344 may be empty, so it will never be <code xmlns="http://www.w3.org/1999/xhtml">NIL</code>, even if no
1345 appropriate GET/POST parameters are found.
1346 <p xmlns="http://www.w3.org/1999/xhtml">
1347 The full form of a <code>'HASH-TABLE</code> parameter type is
1348 </p>
1349 <pre xmlns="http://www.w3.org/1999/xhtml">(hash-table inner-type key-type test-function)</pre>
1350 but <code><i>key-type</i></code>
1351 and <code><i>test-function</i></code> can be left out in which
1352 case they default to <code xmlns="http://www.w3.org/1999/xhtml">'STRING</code>
1353 and <code xmlns="http://www.w3.org/1999/xhtml">'EQUAL</code>, respectively. For this parameter type,
1354 all GET/POST parameters which have a name like the result of
1355 <pre xmlns="http://www.w3.org/1999/xhtml">(format nil "~A{~A}" real-name key)</pre>
1356 (where <code><i>key</i></code> is a string that doesn't contain
1357 curly brackets) will become the values (after conversion
1358 to <code><i>inner-type</i></code>) of a hash table with test
1359 function <code><i>test-function</i></code>
1360 where <code><i>key</i></code> (after conversion
1361 to <code><i>key-type</i></code>) will be the corresponding key.
1362 Note that <code><i>var</i></code> will always be bound to a hash
1363 table, which may be empty, so it will never be <code xmlns="http://www.w3.org/1999/xhtml">NIL</code>,
1364 even if no appropriate GET/POST parameters are found.
1365 <p xmlns="http://www.w3.org/1999/xhtml">
1366 To make matters even more complicated, the three compound
1367 parameter types also have an abbreviated form - just one of
1368 the symbols <code>LIST</code>, <code>ARRAY</code>,
1369 or <code>HASH-TABLE</code>. In this case, the inner type will
1370 default to <code>'STRING</code>.
1371 </p>
1372 <p xmlns="http://www.w3.org/1999/xhtml">
1373 If <code xmlns=""><i>parameter-type</i></code> is not provided
1374 or <code>NIL</code>, <code xmlns=""><i>default-parameter-type</i></code>
1375 (the default of which is <code>'STRING</code>) will be used
1376 instead.
1377 </p>
1378 <p xmlns="http://www.w3.org/1999/xhtml">
1379 If the result of the computations above would be
1380 that <code xmlns=""><i>var</i></code> would be bound
1381 to <code>NIL</code>, then <code xmlns=""><i>init-form</i></code> (if
1382 provided) will be evaluated instead,
1383 and <code xmlns=""><i>var</i></code> will be bound to the result of this
1384 evaluation.
1385 </p>
1386 <p xmlns="http://www.w3.org/1999/xhtml">
1387 Handlers built with this macro are constructed in such a way
1388 that the resulting Lisp function is useful even outside of
1389 Hunchentoot. Specifically, all the parameter computations
1390 above will only happen if <code xmlns=""><a href="#*request*">*REQUEST*</a></code> is
1391 bound, i.e. if we're within a Hunchentoot request.
1392 Otherwise, <code xmlns=""><i>var</i></code> will always be bound to the
1393 result of evaluating <code xmlns=""><i>init-form</i></code> unless a
1394 corresponding keyword argument is provided.
1395 </p>
1396 <p xmlns="http://www.w3.org/1999/xhtml">
1397 The <a href="#example">example code</a> that comes with
1398 Hunchentoot contains an example which demonstrates some of the
1399 features of <code xmlns=""><a href="#define-easy-handler">DEFINE-EASY-HANDLER</a></code>.
1400 </p>
1401 </clix:description></blockquote></p>
1403 <p xmlns=""><a class="none" name="dispatch-easy-handlers"></a>
1404 [Function]
1405 <br><b>dispatch-easy-handlers</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">request
1406 </clix:lambda-list></i>
1407 =&gt;
1408 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">result
1409 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">This is a dispatcher which returns the appropriate handler
1410 defined with <code><a href="#define-easy-handler">DEFINE-EASY-HANDLER</a></code>, if there is one.
1411 </clix:description></blockquote></p>
1413 <h4 xmlns=""><a name="requests">Request objects</a></h4>
1415 For each incoming request, the <a href="#acceptors">acceptor</a> (in
1416 <code xmlns=""><a href="#process-connection">PROCESS-CONNECTION</a></code>) creates a
1417 <code xmlns=""><a href="#request">REQUEST</a></code> object and makes it available to <a href="#request-dispatch">handlers</a> via the special variable
1418 <code xmlns=""><a href="#*request*">*REQUEST*</a></code>. This object contains all relevant
1419 information about the request and this section collects the functions
1420 which can be used to query such an object. In all function where
1421 <code xmlns=""><i>request</i></code> is an optional or keyword parameter, the
1422 default is <code xmlns=""><a href="#*request*">*REQUEST*</a></code>.
1425 If you need more fine-grained control over the behaviour of request
1426 objects, you can subclass <code xmlns=""><a href="#request">REQUEST</a></code> and initialize
1427 the <a href="#acceptor-request-class"><code>REQUEST-CLASS</code></a>
1428 slot of the <code xmlns=""><a href="#acceptor">ACCEPTOR</a></code> class accordingly. The
1429 acceptor will generate request objects of the class named by this
1430 slot.
1431 </p>
1433 <p xmlns=""><a class="none" name="request"></a>
1434 [Standard class]
1435 <br><b>request</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1436 Objects of this class hold all the information
1437 about an incoming request. They are created automatically by
1438 acceptors and can be accessed by the
1439 corresponding <a xmlns="http://www.w3.org/1999/xhtml" href="#request-dispatch">handler</a>.
1441 You should not mess with the slots of these objects directly, but you
1442 can subclass <code><a href="#request">REQUEST</a></code> in order to implement your
1443 own behaviour. See
1444 the <a xmlns="http://www.w3.org/1999/xhtml" href="#acceptor-request-class"><code>REQUEST-CLASS</code></a>
1445 slot of the <code><a href="#acceptor">ACCEPTOR</a></code> class.
1446 </clix:description></blockquote></p>
1448 <p xmlns=""><a class="none" name="*request*"></a>
1449 [Special variable]
1450 <br><b>*request*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">The current REQUEST object while in the context of a request.
1451 </clix:description></blockquote></p>
1453 <p xmlns=""><a class="none" name="real-remote-addr"></a>
1454 [Function]
1455 <br><b>real-remote-addr</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
1456 <tt>&amp;optional
1457 </tt> request
1458 </clix:lambda-list></i>
1459 =&gt;
1460 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">string{, list}
1461 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1462 Returns the '<code xmlns="http://www.w3.org/1999/xhtml">X-Forwarded-For</code>' incoming http header as the
1463 second value in the form of a list of IP addresses and the first
1464 element of this list as the first value if this header exists.
1465 Otherwise returns the value of <code><a href="#remote-addr">REMOTE-ADDR</a></code> as the only value.
1466 </clix:description></blockquote></p>
1468 <p xmlns=""><a class="none" name="parameter"></a>
1469 [Function]
1470 <br><b>parameter</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">name
1471 <tt>&amp;optional
1472 </tt> request
1473 </clix:lambda-list></i>
1474 =&gt;
1475 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">string
1476 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1477 Returns the GET or the POST parameter with name
1478 <code><i>name</i></code> (a string) - or <code xmlns="http://www.w3.org/1999/xhtml">NIL</code>
1479 if there is none. If both a GET and a POST parameter with
1480 the same name exist the GET parameter is returned. Search
1481 is case-sensitive. See also
1482 <code><a href="#get-parameter">GET-PARAMETER</a></code> and
1483 <code><a href="#post-parameter">POST-PARAMETER</a></code>.
1484 </clix:description></blockquote></p>
1486 <p xmlns=""><a class="none" name="get-parameter"></a>
1487 [Function]
1488 <br><b>get-parameter</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">name <tt>&amp;optional</tt> request</clix:lambda-list></i>
1489 =&gt;
1490 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">string</clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1491 Returns the value of the GET parameter (as provided via the
1492 request URI) named by the string <code><i>name</i></code> as a
1493 string (or <code xmlns="http://www.w3.org/1999/xhtml">NIL</code> if there ain't no GET parameter
1494 with this name). Note that only the first value will be
1495 returned if the client provided more than one GET parameter
1496 with the name <code><i>name</i></code>. See
1497 also <code><a href="#get-parameters*">GET-PARAMETERS*</a></code>.
1498 </clix:description></blockquote></p>
1500 <p xmlns=""><a class="none" name="post-parameter"></a>
1501 [Function]
1502 <br><b>post-parameter</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">name <tt>&amp;optional</tt> request</clix:lambda-list></i>
1503 =&gt;
1504 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">string</clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1505 Returns the value of the POST parameter (as provided in the
1506 request's body) named by the
1507 string <code><i>name</i></code>. Note that only the first value
1508 will be returned if the client provided more than one POST
1509 parameter with the name <code><i>name</i></code>. This value
1510 will usually be a string (or <code xmlns="http://www.w3.org/1999/xhtml">NIL</code> if there ain't
1511 no POST parameter with this name). If, however, the browser
1512 sent a <a xmlns="http://www.w3.org/1999/xhtml" class="none" name="upload">file</a> through
1513 a <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.faqs.org/rfcs/rfc2388.html">
1514 <code>multipart/form-data</code>
1515 </a> form, the value of this function is a three-element list
1516 <pre xmlns="http://www.w3.org/1999/xhtml">(path file-name content-type)</pre>
1517 where <code><i>path</i></code> is a pathname denoting the place
1518 were the uploaded file was
1519 stored, <code><i>file-name</i></code> (a string) is the file
1520 name sent by the browser, and <code><i>content-type</i></code>
1521 (also a string) is the content type sent by the browser. The
1522 file denoted by <code><i>path</i></code> will be deleted after
1523 the request has been handled - you have to move or copy it
1524 somewhere else if you want to keep it.
1525 <p xmlns="http://www.w3.org/1999/xhtml">
1526 POST parameters will only be computed if the content type of
1527 the request body was <code>multipart/form-data</code>
1528 or <code>application/x-www-form-urlencoded</code>. Although
1529 this function is called <code>POST-PARAMETER</code>, you can
1530 instruct Hunchentoot to compute these parameters for other
1531 request methods by
1532 setting <code xmlns=""><a href="#*methods-for-post-parameters*">*METHODS-FOR-POST-PARAMETERS*</a></code>.
1533 </p>
1534 <p xmlns="http://www.w3.org/1999/xhtml">
1535 See also <code xmlns=""><a href="#post-parameters">POST-PARAMETERS</a></code>
1536 and <code xmlns=""><a href="#*tmp-directory*">*TMP-DIRECTORY*</a></code>.
1537 </p>
1538 </clix:description></blockquote></p>
1540 <p xmlns=""><a class="none" name="get-parameters*"></a>
1541 [Function]
1542 <br><b>get-parameters*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc"><tt>&amp;optional</tt> request</clix:lambda-list></i>
1543 =&gt;
1544 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">alist</clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1545 Returns
1546 an <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_a.htm#alist">alist</a>
1547 of all GET parameters (as provided via the request
1548 URI). The <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_c.htm#car">car</a>
1549 of each element of this list is the parameter's name while
1550 the <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_c.htm#cdr">cdr</a>
1551 is its value (as a string). The elements of this list are in
1552 the same order as they were within the request URI. See
1553 also <code><a href="#get-parameter">GET-PARAMETER</a></code>.
1554 </clix:description></blockquote></p>
1556 <p xmlns=""><a class="none" name="post-parameters*"></a>
1557 [Function]
1558 <br><b>post-parameters*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc"><tt>&amp;optional</tt> request</clix:lambda-list></i>
1559 =&gt;
1560 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">alist</clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1561 Returns
1562 an <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_a.htm#alist">alist</a>
1563 of all POST parameters (as provided via the request's
1564 body). The <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_c.htm#car">car</a>
1565 of each element of this list is the parameter's name while
1566 the <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_c.htm#cdr">cdr</a>
1567 is its value. The elements of this list are in the same order
1568 as they were within the request's body.
1569 <p xmlns="http://www.w3.org/1999/xhtml">
1570 See also <code xmlns=""><a href="#post-parameter">POST-PARAMETER</a></code>.
1571 </p>
1572 </clix:description></blockquote></p>
1574 <p xmlns=""><a class="none" name="*methods-for-post-parameters*"></a>
1575 [Special variable]
1576 <br><b>*methods-for-post-parameters*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">A list of the request method types (as keywords) for which
1577 Hunchentoot will try to compute <code><i>post-parameters</i></code>.
1578 </clix:description></blockquote></p>
1580 <p xmlns=""><a class="none" name="cookie-in"></a>
1581 [Function]
1582 <br><b>cookie-in</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">name
1583 <tt>&amp;optional
1584 </tt> request
1585 </clix:lambda-list></i>
1586 =&gt;
1587 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">string
1588 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1589 Returns the cookie with the name <code><i>name</i></code> (a string) as sent by the
1590 browser - or <code xmlns="http://www.w3.org/1999/xhtml">NIL</code> if there is none.
1591 </clix:description></blockquote></p>
1593 <p xmlns=""><a class="none" name="cookies-in*"></a>
1594 [Function]
1595 <br><b>cookies-in*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
1596 <tt>&amp;optional
1597 </tt> request
1598 </clix:lambda-list></i>
1599 =&gt;
1600 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">alist
1601 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">Returns an alist of all cookies associated with the <code><a href="#request">REQUEST</a></code> object
1602 <code><i>request</i></code>.
1603 </clix:description></blockquote></p>
1605 <p xmlns=""><a class="none" name="host"></a>
1606 [Function]
1607 <br><b>host</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
1608 <tt>&amp;optional
1609 </tt> request
1610 </clix:lambda-list></i>
1611 =&gt;
1612 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">host
1613 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">Returns the 'Host' incoming http header value.
1614 </clix:description></blockquote></p>
1616 <p xmlns=""><a class="none" name="query-string*"></a>
1617 [Function]
1618 <br><b>query-string*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
1619 <tt>&amp;optional
1620 </tt> request
1621 </clix:lambda-list></i>
1622 =&gt;
1623 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">string
1624 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1625 Returns the query string of the <code><a href="#request">REQUEST</a></code> object <code><i>request</i></code>. That's
1626 the part behind the question mark (i.e. the GET parameters).
1627 </clix:description></blockquote></p>
1629 <p xmlns=""><a class="none" name="referer"></a>
1630 [Function]
1631 <br><b>referer</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
1632 <tt>&amp;optional
1633 </tt> request
1634 </clix:lambda-list></i>
1635 =&gt;
1636 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">result
1637 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1638 Returns the 'Referer' (sic!) http header.
1639 </clix:description></blockquote></p>
1641 <p xmlns=""><a class="none" name="request-method*"></a>
1642 [Function]
1643 <br><b>request-method*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
1644 <tt>&amp;optional
1645 </tt> request
1646 </clix:lambda-list></i>
1647 =&gt;
1648 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">keyword
1649 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1650 Returns the request method as a Lisp keyword.
1651 </clix:description></blockquote></p>
1653 <p xmlns=""><a class="none" name="request-uri*"></a>
1654 [Function]
1655 <br><b>request-uri*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
1656 <tt>&amp;optional
1657 </tt> request
1658 </clix:lambda-list></i>
1659 =&gt;
1660 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">uri
1661 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1662 Returns the request URI.
1663 </clix:description></blockquote></p>
1665 <p xmlns=""><a class="none" name="server-protocol*"></a>
1666 [Function]
1667 <br><b>server-protocol*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
1668 <tt>&amp;optional
1669 </tt> request
1670 </clix:lambda-list></i>
1671 =&gt;
1672 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">keyword
1673 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1674 Returns the request protocol as a Lisp keyword.
1675 </clix:description></blockquote></p>
1677 <p xmlns=""><a class="none" name="user-agent"></a>
1678 [Function]
1679 <br><b>user-agent</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
1680 <tt>&amp;optional
1681 </tt> request
1682 </clix:lambda-list></i>
1683 =&gt;
1684 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">result
1685 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1686 Returns the 'User-Agent' http header.
1687 </clix:description></blockquote></p>
1689 <p xmlns=""><a class="none" name="header-in*"></a>
1690 [Function]
1691 <br><b>header-in*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">name
1692 <tt>&amp;optional
1693 </tt> request
1694 </clix:lambda-list></i>
1695 =&gt;
1696 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">header
1697 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1698 Returns the incoming header with name
1699 <code><i>name</i></code>. <code><i>name</i></code> can be
1700 a keyword (recommended) or a string.
1701 </clix:description></blockquote></p>
1703 <p xmlns=""><a class="none" name="headers-in*"></a>
1704 [Function]
1705 <br><b>headers-in*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
1706 <tt>&amp;optional
1707 </tt> request
1708 </clix:lambda-list></i>
1709 =&gt;
1710 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">alist
1711 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1712 Returns an alist of the incoming headers associated with the
1713 <code><a href="#request">REQUEST</a></code> object
1714 <code><i>request</i></code>.
1715 </clix:description></blockquote></p>
1717 <p xmlns=""><a class="none" name="remote-addr*"></a>
1718 [Function]
1719 <br><b>remote-addr*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
1720 <tt>&amp;optional
1721 </tt> request
1722 </clix:lambda-list></i>
1723 =&gt;
1724 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">address
1725 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1726 Returns the address the current request originated from.
1727 </clix:description></blockquote></p>
1729 <p xmlns=""><a class="none" name="remote-port*"></a>
1730 [Function]
1731 <br><b>remote-port*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
1732 <tt>&amp;optional
1733 </tt> request
1734 </clix:lambda-list></i>
1735 =&gt;
1736 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">port
1737 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1738 Returns the port the current request originated from.
1739 </clix:description></blockquote></p>
1741 <p xmlns=""><a class="none" name="local-addr*"></a>
1742 [Function]
1743 <br><b>local-addr*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
1744 <tt>&amp;optional
1745 </tt> request
1746 </clix:lambda-list></i>
1747 =&gt;
1748 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">address
1749 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1750 The IP address of the local system that the client connected to.
1751 </clix:description></blockquote></p>
1753 <p xmlns=""><a class="none" name="local-port*"></a>
1754 [Function]
1755 <br><b>local-port*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
1756 <tt>&amp;optional
1757 </tt> request
1758 </clix:lambda-list></i>
1759 =&gt;
1760 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">port
1761 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1762 The TCP port number of the local system that the client connected to.
1763 </clix:description></blockquote></p>
1765 <p xmlns=""><a class="none" name="script-name*"></a>
1766 [Function]
1767 <br><b>script-name*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
1768 <tt>&amp;optional
1769 </tt> request
1770 </clix:lambda-list></i>
1771 =&gt;
1772 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">script-name
1773 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1774 Returns the file name of the <code><a href="#request">REQUEST</a></code>
1775 object <code><i>request</i></code>. That's the
1776 requested URI without the query string (i.e the GET
1777 parameters).
1778 </clix:description></blockquote></p>
1780 <p xmlns=""><a class="none" name="aux-request-value"></a>
1781 [Accessor]
1782 <br><b>aux-request-value</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">symbol
1783 <tt>&amp;optional
1784 </tt> request
1785 </clix:lambda-list></i>
1786 =&gt;
1787 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">value, present-p
1788 </clix:returns></i><br><tt>(setf (</tt><b>aux-request-value</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">symbol
1789 <tt>&amp;optional
1790 </tt> request
1791 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1792 This accessor can be used to associate arbitrary
1793 data with the the symbol <code><i>symbol</i></code> in the <code><a href="#request">REQUEST</a></code> object
1794 <code><i>request</i></code>. <code><i>present-p</i></code> is true if such data was found, otherwise <code xmlns="http://www.w3.org/1999/xhtml">NIL</code>.
1795 </clix:description></blockquote></p>
1797 <p xmlns=""><a class="none" name="delete-aux-request-value"></a>
1798 [Function]
1799 <br><b>delete-aux-request-value</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">symbol
1800 <tt>&amp;optional
1801 </tt> request
1802 </clix:lambda-list></i>
1803 =&gt;
1804 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">|
1805 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1806 Removes the value associated with <code><i>symbol</i></code> from the <code><a href="#request">REQUEST</a></code> object
1807 <code><i>request</i></code>.
1808 </clix:description></blockquote></p>
1810 <p xmlns=""><a class="none" name="authorization"></a>
1811 [Function]
1812 <br><b>authorization</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
1813 <tt>&amp;optional
1814 </tt> request
1815 </clix:lambda-list></i>
1816 =&gt;
1817 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">result
1818 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1819 Returns as two values the user and password (if any) as
1820 encoded in the 'AUTHORIZATION' header. Returns
1821 <code xmlns="http://www.w3.org/1999/xhtml">NIL</code> if there is no such header.
1822 </clix:description></blockquote></p>
1824 <p xmlns=""><a class="none" name="*hunchentoot-default-external-format*"></a>
1825 [Special variable]
1826 <br><b>*hunchentoot-default-external-format*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1827 The external format used to compute the <code><a href="#request">REQUEST</a></code> object.
1828 </clix:description></blockquote></p>
1830 <p xmlns=""><a class="none" name="*file-upload-hook*"></a>
1831 [Special variable]
1832 <br><b>*file-upload-hook*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1833 If this is not <code xmlns="http://www.w3.org/1999/xhtml">NIL</code>, it should be a unary
1834 function which will be called with a pathname for each file
1835 which is <a xmlns="http://www.w3.org/1999/xhtml" href="#upload">uploaded</a> to Hunchentoot. The
1836 pathname denotes the temporary file to which the uploaded
1837 file is written. The hook is called directly before the
1838 file is created. At this point,
1839 <code><a href="#*request*">*REQUEST*</a></code> is already bound to the
1840 current <code><a href="#request">REQUEST</a></code> object, but obviously
1841 you can't access the post parameters yet.
1842 </clix:description></blockquote></p>
1844 <p xmlns=""><a class="none" name="raw-post-data"></a>
1845 [Function]
1846 <br><b>raw-post-data</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
1847 <tt>&amp;key</tt>
1848 request external-format force-text force-binary want-stream
1849 </clix:lambda-list></i>
1850 =&gt;
1851 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">raw-body-or-stream</clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1852 Returns the content sent by the client in the request body if
1853 there was any (unless the content type
1854 was <code xmlns="http://www.w3.org/1999/xhtml">multipart/form-data</code> in which
1855 case <code xmlns="http://www.w3.org/1999/xhtml">NIL</code> is returned). By default, the result is
1856 a string if the type of the <code xmlns="http://www.w3.org/1999/xhtml">Content-Type</code>
1857 <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.faqs.org/rfcs/rfc1590.html">media type</a>
1858 is <code xmlns="http://www.w3.org/1999/xhtml">"text"</code>, and a vector of octets otherwise. In
1859 the case of a string, the external format to be used to decode
1860 the content will be determined from the <code xmlns="http://www.w3.org/1999/xhtml">charset</code>
1861 parameter sent by the client (or
1862 otherwise <code><a href="#*hunchentoot-default-external-format*">*HUNCHENTOOT-DEFAULT-EXTERNAL-FORMAT*</a></code>
1863 will be used).
1864 <p xmlns="http://www.w3.org/1999/xhtml">
1865 You can also provide an external format explicitly (through
1866 <code xmlns=""><i>external-format</i></code>) in which case the result
1867 will unconditionally be a string. Likewise, you can provide
1868 a true value for <code xmlns=""><i>force-text</i></code> which will
1869 force Hunchentoot to act as if the type of the media type
1870 had been <code>"text"</code>
1871 (with <code xmlns=""><i>external-format</i></code> taking precedence
1872 if provided). Or you can provide a true value
1873 for <code xmlns=""><i>force-binary</i></code> which means that you
1874 want a vector of octets at any rate. (If both
1875 <code xmlns=""><i>force-text</i></code>
1876 and <code xmlns=""><i>force-binary</i></code> are true, an error will
1877 be signaled.)
1878 </p>
1879 <p xmlns="http://www.w3.org/1999/xhtml">
1880 If, however, you provide a true value
1881 for <code xmlns=""><i>want-stream</i></code>, the other parameters are
1882 ignored and you'll get the content (flexi) stream to read
1883 from it yourself. It is then your responsibility to read
1884 the correct amount of data, because otherwise you won't be
1885 able to return a response to the client. The stream will
1886 have
1887 its <a href="http://weitz.de/flexi-streams/#flexi-streams">octet
1888 position</a> set to <code>0</code>. If the client provided
1889 a <code>Content-Length</code> header, the stream will also
1890 have a
1891 corresponding <a href="http://weitz.de/flexi-streams/#flexi-streams">bound</a>,
1892 so no matter whether the client used chunked encoding or
1893 not, you can always read until EOF.
1894 </p>
1895 <p xmlns="http://www.w3.org/1999/xhtml">
1896 If the content type of the request
1897 was <code>multipart/form-data</code>
1898 or <code>application/x-www-form-urlencoded</code>, the
1899 content has been read by Hunchentoot already and you can't
1900 read from the stream anymore.
1901 </p>
1902 <p xmlns="http://www.w3.org/1999/xhtml">
1903 You can call <code xmlns=""><a href="#raw-post-data">RAW-POST-DATA</a></code> more than once
1904 per request, but you can't mix calls which have different
1905 values for <code xmlns=""><i>want-stream</i></code>.
1906 </p>
1907 <p xmlns="http://www.w3.org/1999/xhtml">
1908 Note that this function is slightly misnamed because a
1909 client can send content even if the request method is not
1910 POST.
1911 </p>
1912 </clix:description></blockquote></p>
1915 <p xmlns=""><a class="none" name="recompute-request-parameters"></a>
1916 [Function]
1917 <br><b>recompute-request-parameters</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
1918 <tt>&amp;key
1919 </tt> request external-format
1920 </clix:lambda-list></i>
1921 =&gt;
1922 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">|
1923 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1924 Recomputes the GET and POST parameters for the <code><a href="#request">REQUEST</a></code> object
1925 <code><i>request</i></code>. This only makes sense if you're switching external formats
1926 during the request.
1927 </clix:description></blockquote></p>
1929 <p xmlns=""><a class="none" name="process-request"></a>
1930 [Generic function]
1931 <br><b>process-request</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">request
1932 </clix:lambda-list></i>
1933 =&gt;
1934 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">nil
1935 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1936 This function is called by <code><a href="#process-connection">PROCESS-CONNECTION</a></code>
1937 after the incoming headers have been read. It
1938 calls <code><a href="#handle-request">HANDLE-REQUEST</a></code> (and is more or less just a
1939 thin wrapper around it) to select and call a
1940 <a xmlns="http://www.w3.org/1999/xhtml" href="#request-dispatch">handler</a> and send the output of this handler to
1941 the client. Note that <code><a href="#process-connection">PROCESS-CONNECTION</a></code> is
1942 called once per connection and loops in case of a persistent
1943 connection while <code><a href="#process-request">PROCESS-REQUEST</a></code> is called anew
1944 for each request.
1945 <p xmlns="http://www.w3.org/1999/xhtml">
1946 The return value of this function is ignored.
1947 </p>
1948 <p xmlns="http://www.w3.org/1999/xhtml">
1949 Like <code xmlns=""><a href="#process-connection">PROCESS-CONNECTION</a></code>, this is another function
1950 the behaviour of which you should only modify if you really, really
1951 know what you're doing.
1952 </p>
1953 </clix:description></blockquote></p>
1955 <p xmlns=""><a class="none" name="handle-request"></a>
1956 [Generic function]
1957 <br><b>handle-request</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor request
1958 </clix:lambda-list></i>
1959 =&gt;
1960 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">content
1961 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1962 This function is called by <code><a href="#process-request">PROCESS-REQUEST</a></code> once
1963 the request has been read and a <code><a href="#request">REQUEST</a></code> object
1964 has been created. Its job is to actually handle the request, i.e. to
1965 return something to the client.
1966 <p xmlns="http://www.w3.org/1999/xhtml">
1967 The default method calls the
1968 acceptor's <a href="#request-dispatch">request dispatcher</a>, but you
1969 can of course implement a different behaviour. The default method
1970 also sets up <a href="#logging">standard error handling</a> for
1971 the <a href="#request-dispatch">handler</a>.
1972 </p>
1973 <p xmlns="http://www.w3.org/1999/xhtml">
1974 Might be a good place to bind or rebind special variables which can
1975 then be accessed by your <a href="#request-dispatch">handlers</a>.
1976 </p>
1977 </clix:description></blockquote></p>
1979 <p xmlns=""><a class="none" name="acceptor-dispatch-request"></a>
1980 [Generic function]
1981 <br><b>acceptor-dispatch-request</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor request
1982 </clix:lambda-list></i>
1983 =&gt;
1984 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">content
1985 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
1986 This function is called to actually dispatch the request
1987 once the standard logging and error handling has been set
1988 up. <code><a href="#acceptor">ACCEPTOR</a></code> subclasses implement
1989 methods for this function in order to perform their own
1990 request routing. If a method does not want to handle the
1991 request, it is supposed to invoke <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_call_n.htm">CALL-NEXT-METHOD</a>
1992 so that the next <code><a href="#acceptor">ACCEPTOR</a></code> in the
1993 inheritance chain gets a chance to handle the request.
1994 </clix:description></blockquote></p>
1996 <p xmlns="">
1997 [Generic readers]<br><a class="none" name="cookies-in"></a><b>cookies-in</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">request
1998 </clix:lambda-list></i>
1999 =&gt;
2000 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">cookies
2001 </clix:returns></i><br><a class="none" name="get-parameters"></a><b>get-parameters</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">request
2002 </clix:lambda-list></i>
2003 =&gt;
2004 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">get-parameters
2005 </clix:returns></i><br><a class="none" name="header-in"></a><b>header-in</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">name request
2006 </clix:lambda-list></i>
2007 =&gt;
2008 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">result
2009 </clix:returns></i><br><a class="none" name="headers-in"></a><b>headers-in</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">request
2010 </clix:lambda-list></i>
2011 =&gt;
2012 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">headers
2013 </clix:returns></i><br><a class="none" name="post-parameters"></a><b>post-parameters</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">request
2014 </clix:lambda-list></i>
2015 =&gt;
2016 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">post-parameters
2017 </clix:returns></i><br><a class="none" name="query-string"></a><b>query-string</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">request
2018 </clix:lambda-list></i>
2019 =&gt;
2020 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">query-string
2021 </clix:returns></i><br><a class="none" name="remote-addr"></a><b>remote-addr</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">request
2022 </clix:lambda-list></i>
2023 =&gt;
2024 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">address
2025 </clix:returns></i><br><a class="none" name="remote-port"></a><b>remote-port</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">request
2026 </clix:lambda-list></i>
2027 =&gt;
2028 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">port
2029 </clix:returns></i><br><a class="none" name="local-addr"></a><b>local-addr</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">request
2030 </clix:lambda-list></i>
2031 =&gt;
2032 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">address
2033 </clix:returns></i><br><a class="none" name="local-port"></a><b>local-port</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">request
2034 </clix:lambda-list></i>
2035 =&gt;
2036 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">port
2037 </clix:returns></i><br><a class="none" name="request-acceptor"></a><b>request-acceptor</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">request
2038 </clix:lambda-list></i>
2039 =&gt;
2040 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">acceptor
2041 </clix:returns></i><br><a class="none" name="request-method"></a><b>request-method</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">request
2042 </clix:lambda-list></i>
2043 =&gt;
2044 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">method
2045 </clix:returns></i><br><a class="none" name="request-uri"></a><b>request-uri</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">request
2046 </clix:lambda-list></i>
2047 =&gt;
2048 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">uri
2049 </clix:returns></i><br><a class="none" name="server-protocol"></a><b>server-protocol</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">request
2050 </clix:lambda-list></i>
2051 =&gt;
2052 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">protocol
2053 </clix:returns></i><br><a class="none" name="script-name"></a><b>script-name</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">request
2054 </clix:lambda-list></i>
2055 =&gt;
2056 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">result
2057 </clix:returns></i><br><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2058 These are various generic readers which are used
2059 to read information about a <code><a href="#request">REQUEST</a></code> object. If you are writing a
2060 <a xmlns="http://www.w3.org/1999/xhtml" href="#request-dispatch">handler</a>, you should <em xmlns="http://www.w3.org/1999/xhtml">not</em> use these readers but instead utilize the
2061 corresponding functions with an asterisk at the end of their name,
2062 also listed in this section. These generic readers are only
2063 exported for users who want to create their own subclasses of
2064 <code><a href="#request">REQUEST</a></code>.
2065 </clix:description></blockquote></p>
2069 <h4 xmlns=""><a name="replies">Reply objects</a></h4>
2071 For each incoming request, the <a href="#acceptors">acceptor</a>
2072 (in <code xmlns=""><a href="#process-connection">PROCESS-CONNECTION</a></code>) creates
2073 a <code xmlns=""><a href="#reply">REPLY</a></code> object and makes it available
2074 to <a href="#request-dispatch">handlers</a> via the special variable
2075 <code xmlns=""><a href="#*reply*">*REPLY*</a></code>. This object contains all relevant
2076 information (except for the content body) about the reply that will be
2077 sent to the client and this section collects the functions which can
2078 be used to query and modify such an object. In all function
2079 where <code xmlns=""><i>reply</i></code> is an optional or keyword parameter,
2080 the default is <code xmlns=""><a href="#*reply*">*REPLY*</a></code>.
2083 If you need more fine-grained control over the behaviour of reply
2084 objects, you can subclass <code xmlns=""><a href="#reply">REPLY</a></code> and initialize
2085 the <a href="#acceptor-reply-class"><code>REPLY-CLASS</code></a>
2086 slot of the <code xmlns=""><a href="#acceptor">ACCEPTOR</a></code> class accordingly. The
2087 acceptor will generate reply objects of the class named by this
2088 slot.
2089 </p>
2091 <p xmlns=""><a class="none" name="reply"></a>
2092 [Standard class]
2093 <br><b>reply</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2094 Objects of this class hold all the information about an
2095 outgoing reply. They are created automatically by
2096 Hunchentoot and can be accessed and modified by the
2097 corresponding <a xmlns="http://www.w3.org/1999/xhtml" href="#request-dispatch">handler</a>.
2098 <p xmlns="http://www.w3.org/1999/xhtml">
2099 You should not mess with the slots of these objects directly, but you
2100 can subclass <code xmlns=""><a href="#reply">REPLY</a></code> in order to implement your own behaviour. See the
2101 <a href="#acceptor-reply-class"><code>:reply-class</code></a> initarg
2102 of the <code xmlns=""><a href="#acceptor">ACCEPTOR</a></code> class.
2103 </p>
2104 </clix:description></blockquote></p>
2106 <p xmlns=""><a class="none" name="*reply*"></a>
2107 [Special variable]
2108 <br><b>*reply*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2109 The current <code><a href="#reply">REPLY</a></code> object in the context of a request.
2110 </clix:description></blockquote></p>
2112 <p xmlns=""><a class="none" name="header-out"></a>
2113 [Accessor]
2114 <br><b>header-out</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">name
2115 <tt>&amp;optional
2116 </tt> reply
2117 </clix:lambda-list></i>
2118 =&gt;
2119 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">string
2120 </clix:returns></i><br><tt>(setf (</tt><b>header-out</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">name
2121 <tt>&amp;optional
2122 </tt> reply
2123 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2124 <code><a href="#header-out">HEADER-OUT</a></code> returns the outgoing http
2125 header named by the keyword <code><i>name</i></code> if
2126 there is one, otherwise <code xmlns="http://www.w3.org/1999/xhtml">NIL</code>. <code xmlns="http://www.w3.org/1999/xhtml">SETF</code>
2127 of <code><a href="#header-out">HEADER-OUT</a></code> changes the current value
2128 of the header named <code><i>name</i></code>. If no header
2129 named <code><i>name</i></code> exists, it is created. For
2130 backwards compatibility, <code><i>name</i></code> can also
2131 be a string in which case the association between a header
2132 and its name is case-insensitive.
2133 <p xmlns="http://www.w3.org/1999/xhtml">
2134 Note that the header 'Set-Cookie' cannot be queried by
2135 <code xmlns=""><a href="#header-out">HEADER-OUT</a></code> and must not be set by
2136 <code>SETF</code> of <code xmlns=""><a href="#header-out">HEADER-OUT</a></code>. See
2137 also <code xmlns=""><a href="#headers-out*">HEADERS-OUT*</a></code>,
2138 <code xmlns=""><a href="#content-type*">CONTENT-TYPE*</a></code>,
2139 <code xmlns=""><a href="#content-length*">CONTENT-LENGTH*</a></code>,
2140 <code xmlns=""><a href="#cookies-out*">COOKIES-OUT*</a></code>, and
2141 <code xmlns=""><a href="#cookie-out">COOKIE-OUT</a></code>.
2142 </p>
2143 </clix:description></blockquote></p>
2145 <p xmlns=""><a class="none" name="headers-out*"></a>
2146 [Function]
2147 <br><b>headers-out*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
2148 <tt>&amp;optional
2149 </tt> reply
2150 </clix:lambda-list></i>
2151 =&gt;
2152 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">alist
2153 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">Returns an alist of the outgoing headers associated with the
2154 <code><a href="#reply">REPLY</a></code> object <code><i>reply</i></code>. See also <code><a href="#header-out">HEADER-OUT</a></code>.
2155 </clix:description></blockquote></p>
2157 <p xmlns=""><a class="none" name="content-length*"></a>
2158 [Accessor]
2159 <br><b>content-length*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
2160 <tt>&amp;optional
2161 </tt> reply
2162 </clix:lambda-list></i>
2163 =&gt;
2164 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">content-length
2165 </clix:returns></i><br><tt>(setf (</tt><b>content-length*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
2166 <tt>&amp;optional
2167 </tt> reply
2168 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2169 The outgoing 'Content-Length' http header of <code><i>reply</i></code>.
2170 </clix:description></blockquote></p>
2172 <p xmlns=""><a class="none" name="content-type*"></a>
2173 [Accessor]
2174 <br><b>content-type*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
2175 <tt>&amp;optional
2176 </tt> reply
2177 </clix:lambda-list></i>
2178 =&gt;
2179 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">content-type
2180 </clix:returns></i><br><tt>(setf (</tt><b>content-type*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
2181 <tt>&amp;optional
2182 </tt> reply
2183 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2184 The outgoing 'Content-Type' http header of <code><i>reply</i></code>.
2185 </clix:description></blockquote></p>
2187 <p xmlns=""><a class="none" name="cookie-out"></a>
2188 [Function]
2189 <br><b>cookie-out</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">name
2190 <tt>&amp;optional
2191 </tt> reply
2192 </clix:lambda-list></i>
2193 =&gt;
2194 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">result
2195 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2196 Returns the current value of the outgoing <a xmlns="http://www.w3.org/1999/xhtml" href="#cookies">cookie</a> named
2197 <code><i>name</i></code>. Search is case-sensitive.
2198 </clix:description></blockquote></p>
2200 <p xmlns=""><a class="none" name="cookies-out*"></a>
2201 [Accessor]
2202 <br><b>cookies-out*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
2203 <tt>&amp;optional
2204 </tt> reply
2205 </clix:lambda-list></i>
2206 =&gt;
2207 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">alist
2208 </clix:returns></i><br><tt>(setf (</tt><b>cookies-out*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
2209 <tt>&amp;optional
2210 </tt> reply
2211 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2212 Returns or sets an alist of the outgoing <a xmlns="http://www.w3.org/1999/xhtml" href="#cookies">cookies</a> associated with the
2213 <code><a href="#reply">REPLY</a></code> object
2214 <code><i>reply</i></code>.
2215 </clix:description></blockquote></p>
2217 <p xmlns=""><a class="none" name="return-code*"></a>
2218 [Accessor]
2219 <br><b>return-code*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
2220 <tt>&amp;optional
2221 </tt> reply
2222 </clix:lambda-list></i>
2223 =&gt;
2224 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">return-code
2225 </clix:returns></i><br><tt>(setf (</tt><b>return-code*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
2226 <tt>&amp;optional
2227 </tt> reply
2228 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2229 Gets or sets the http return code of
2230 <code><i>reply</i></code>. The return code of each
2231 <code><a href="#reply">REPLY</a></code> object is initially set to
2232 <code><a href="#+http-ok+">+HTTP-OK+</a></code>.
2233 </clix:description></blockquote></p>
2235 <p xmlns=""><a class="none" name="send-headers"></a>
2236 [Function]
2237 <br><b>send-headers</b> <i></i>
2238 =&gt;
2239 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">stream</clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2240 Sends the initial status line and all headers as determined
2241 by the <code><a href="#reply">REPLY</a></code>
2242 object <code><a href="#*reply*">*REPLY*</a></code>. Returns
2243 a <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_b.htm#binary">binary</a>
2244 stream to which the body of the reply can be written. Once
2245 this function has been called, further changes
2246 to <code><a href="#*reply*">*REPLY*</a></code> don't have any effect.
2247 Also, automatic handling of errors (i.e. sending the
2248 corresponding status code to the browser, etc.) is turned
2249 off for this request and functions
2250 like <code><a href="#redirect">REDIRECT</a></code> or
2251 to <code><a href="#abort-request-handler">ABORT-REQUEST-HANDLER</a></code> won't have the
2252 desired effect once the headers are sent.
2253 <p xmlns="http://www.w3.org/1999/xhtml">
2254 If your handlers return the full body as a string or as an
2255 array of octets, you should <em>not</em> call this function.
2256 If a handler calls <code xmlns=""><a href="#send-headers">SEND-HEADERS</a></code> , its
2257 return value is ignored.
2258 </p>
2259 </clix:description></blockquote></p>
2261 <p xmlns=""><a class="none" name="reply-external-format*"></a>
2262 [Accessor]
2263 <br><b>reply-external-format*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
2264 <tt>&amp;optional
2265 </tt> reply
2266 </clix:lambda-list></i>
2267 =&gt;
2268 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">external-format
2269 </clix:returns></i><br><tt>(setf (</tt><b>reply-external-format*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
2270 <tt>&amp;optional
2271 </tt> reply
2272 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2273 Gets or sets the external format of <code><i>reply</i></code> which is used for character output.
2274 </clix:description></blockquote></p>
2276 <p xmlns=""><a class="none" name="*default-content-type*"></a>
2277 [Special variable]
2278 <br><b>*default-content-type*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2279 The default content-type header which is returned to the client.
2280 </clix:description></blockquote></p>
2282 <p xmlns="">
2283 [Constants]<br><b>+http-continue+</b><br><b>+http-switching-protocols+</b><br><b>+http-ok+</b><br><b>+http-created+</b><br><b>+http-accepted+</b><br><b>+http-non-authoritative-information+</b><br><b>+http-no-content+</b><br><b>+http-reset-content+</b><br><b>+http-partial-content+</b><br><b>+http-multi-status+</b><br><b>+http-multiple-choices+</b><br><b>+http-moved-permanently+</b><br><b>+http-moved-temporarily+</b><br><b>+http-see-other+</b><br><b>+http-not-modified+</b><br><b>+http-use-proxy+</b><br><b>+http-temporary-redirect+</b><br><b>+http-bad-request+</b><br><b>+http-authorization-required+</b><br><b>+http-payment-required+</b><br><b>+http-forbidden+</b><br><b>+http-not-found+</b><br><b>+http-method-not-allowed+</b><br><b>+http-not-acceptable+</b><br><b>+http-proxy-authentication-required+</b><br><b>+http-request-time-out+</b><br><b>+http-conflict+</b><br><b>+http-gone+</b><br><b>+http-length-required+</b><br><b>+http-precondition-failed+</b><br><b>+http-request-entity-too-large+</b><br><b>+http-request-uri-too-large+</b><br><b>+http-unsupported-media-type+</b><br><b>+http-requested-range-not-satisfiable+</b><br><b>+http-expectation-failed+</b><br><b>+http-failed-dependency+</b><br><b>+http-internal-server-error+</b><br><b>+http-not-implemented+</b><br><b>+http-bad-gateway+</b><br><b>+http-service-unavailable+</b><br><b>+http-gateway-time-out+</b><br><b>+http-version-not-supported+</b><br><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2284 The values of these constants are 100, 101, 200, 201, 202,
2285 203, 204, 205, 206, 207, 300, 301, 302, 303, 304, 305, 307,
2286 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411,
2287 412, 413, 414, 415, 416, 417, 424, 500, 501, 502, 503, 504,
2288 and 505. See <code><a href="#return-code">RETURN-CODE</a></code>.
2289 </clix:description></blockquote></p>
2291 <p xmlns="">
2292 [Generic readers]<br><a class="none" name="content-length"></a><b>content-length</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">reply
2293 </clix:lambda-list></i>
2294 =&gt;
2295 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">content-length
2296 </clix:returns></i><br><a class="none" name="content-type"></a><b>content-type</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">reply
2297 </clix:lambda-list></i>
2298 =&gt;
2299 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">content-type
2300 </clix:returns></i><br><a class="none" name="headers-out"></a><b>headers-out</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">reply
2301 </clix:lambda-list></i>
2302 =&gt;
2303 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">headers-out
2304 </clix:returns></i><br><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2305 These are various generic readers which are used
2306 to read information about a <code><a href="#reply">REPLY</a></code> object. If you are writing a
2307 <a xmlns="http://www.w3.org/1999/xhtml" href="#request-dispatch">handler</a>, you should <em xmlns="http://www.w3.org/1999/xhtml">not</em> use these readers but instead utilize the
2308 corresponding functions with an asterisk at the end of their name,
2309 also listed in this section. These generic readers are only
2310 exported for users who want to create their own subclasses of
2311 <code><a href="#reply">REPLY</a></code>.
2312 </clix:description></blockquote></p>
2314 <p xmlns="">
2315 [Generic accessors]<br><a class="none" name="cookies-out"></a><b>cookies-out</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">reply
2316 </clix:lambda-list></i>
2317 =&gt;
2318 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">result
2319 </clix:returns></i><br><tt>(setf (</tt><b>cookies-out</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">reply
2320 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><br><a class="none" name="return-code"></a><b>return-code</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">reply
2321 </clix:lambda-list></i>
2322 =&gt;
2323 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">result
2324 </clix:returns></i><br><tt>(setf (</tt><b>return-code</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">reply
2325 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><br><a class="none" name="reply-external-format"></a><b>reply-external-format</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">reply
2326 </clix:lambda-list></i>
2327 =&gt;
2328 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">result
2329 </clix:returns></i><br><tt>(setf (</tt><b>reply-external-format</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">reply
2330 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><br><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2331 These are various generic accessors which are
2332 used to query and modify a <code><a href="#reply">REPLY</a></code> objects. If
2333 you are writing a
2334 <a xmlns="http://www.w3.org/1999/xhtml" href="#request-dispatch">handler</a>, you should <em xmlns="http://www.w3.org/1999/xhtml">not</em> use these
2335 accessors but instead utilize the corresponding functions with an
2336 asterisk at the end of their name, also listed in this section.
2337 These generic accessors are only exported for users who want to
2338 create their own subclasses of
2339 <code><a href="#reply">REPLY</a></code>.
2340 </clix:description></blockquote></p>
2345 <h4 xmlns=""><a name="sessions">Sessions</a></h4>
2346 Hunchentoot supports <em>sessions</em>: Once a <a href="#request-dispatch">request
2347 handler</a> has called <code xmlns=""><a href="#start-session">START-SESSION</a></code>, Hunchentoot
2348 uses either cookies or (if the client doesn't send the cookies
2349 back) <a href="#*rewrite-for-session-urls*">rewrites URLs</a> to keep
2350 track of this client, i.e. to provide a kind of 'state' for the
2351 stateless http protocol. The session associated with the client is a
2352 <a href="#session">CLOS object</a> which can be used
2353 to <a href="#session-value">store arbitrary data</a> between requests.
2355 Hunchentoot makes some reasonable effort to prevent eavesdroppers from
2356 hijacking sessions (see below), but this should not be considered
2357 really secure. Don't store sensitive data in sessions and rely solely
2358 on the session mechanism as a safeguard against malicious users who
2359 want to get at this data!
2360 </p>
2362 For each request there's one <code xmlns=""><a href="#session">SESSION</a></code> object which is accessible to the
2363 <a href="#handler">handler</a> via the special
2364 variable <code xmlns=""><a href="#*session*">*SESSION*</a></code>. This object holds all the
2365 information available about the session and can be accessed with the
2366 functions described in this chapter. Note that the internal structure
2367 of <code xmlns=""><a href="#session">SESSION</a></code> objects should be considered opaque
2368 and may change in future releases of Hunchentoot.
2369 </p>
2371 Sessions are automatically <a href="#session-verify">verified</a> for
2372 validity and age when the <code xmlns=""><a href="#request">REQUEST</a></code> object is
2373 instantiated, i.e. if <code xmlns=""><a href="#*session*">*SESSION*</a></code> is not NIL then
2374 this session is valid (as far as Hunchentoot is concerned) and
2375 not <a href="#session-too-old-p">too old</a>. Old sessions
2376 are <a href="#session-gc">automatically removed</a>.
2377 </p>
2379 Hunchentoot also provides a <code xmlns=""><a href="#regenerate-session-cookie-value">REGENERATE-SESSION-COOKIE-VALUE</a></code>
2380 function that creates a new cookie value. This helps to prevent against
2381 <a href="https://www.owasp.org/index.php/Session_fixation">session fixation
2382 attacks</a>, and should be used when a user logs in according to the application.
2383 </p>
2385 <p xmlns=""><a class="none" name="session"></a>
2386 [Standard class]
2387 <br><b>session</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2388 <code><a href="#session">SESSION</a></code> objects are
2389 automatically maintained by Hunchentoot. They should not be created
2390 explicitly with <code xmlns="http://www.w3.org/1999/xhtml">MAKE-INSTANCE</code> but implicitly
2391 with <code><a href="#start-session">START-SESSION</a></code> and they should be treated as
2392 opaque objects.
2393 <p xmlns="http://www.w3.org/1999/xhtml">
2394 You can ignore Hunchentoot's <code xmlns=""><a href="#session">SESSION</a></code> objects and
2395 <a href="#session-behaviour">implement your own sessions</a> if you provide corresponding methods for
2396 <code xmlns=""><a href="#session-cookie-value">SESSION-COOKIE-VALUE</a></code>
2397 and <code xmlns=""><a href="#session-verify">SESSION-VERIFY</a></code>.
2398 </p>
2399 </clix:description></blockquote></p>
2401 <p xmlns=""><a class="none" name="start-session"></a>
2402 [Function]
2403 <br><b>start-session</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
2404 </clix:lambda-list></i>
2405 =&gt;
2406 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">session
2407 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2408 Returns the current <code><a href="#session">SESSION</a></code>
2409 object. If there is no current session, creates one and updates the
2410 corresponding data structures. In this case the function will also
2411 send a session cookie to the browser.
2412 </clix:description></blockquote></p>
2414 <p xmlns=""><a class="none" name="session-value"></a>
2415 [Accessor]
2416 <br><b>session-value</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">symbol
2417 <tt>&amp;optional
2418 </tt> session
2419 </clix:lambda-list></i>
2420 =&gt;
2421 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">value, present-p
2422 </clix:returns></i><br><tt>(setf (</tt><b>session-value</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">symbol
2423 <tt>&amp;optional
2424 </tt> session
2425 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2426 This accessor can be used to associate arbitrary data with the the
2427 symbol <code><i>symbol</i></code> in the <code><a href="#session">SESSION</a></code>
2428 object <code><i>session</i></code>. <code><i>present-p</i></code> is
2429 true if such data was found, otherwise <code xmlns="http://www.w3.org/1999/xhtml">NIL</code>. The default
2430 value for <code><i>session</i></code> is
2431 <code><a href="#*session*">*SESSION*</a></code>.
2432 <p xmlns="http://www.w3.org/1999/xhtml">
2433 If <code>SETF</code> of <code xmlns=""><a href="#session-value">SESSION-VALUE</a></code> is called
2434 with <code xmlns=""><i>session</i></code> being <code>NIL</code> then a
2435 session is automatically instantiated
2436 with <code xmlns=""><a href="#start-session">START-SESSION</a></code>.
2437 </p>
2438 </clix:description></blockquote></p>
2440 <p xmlns=""><a class="none" name="delete-session-value"></a>
2441 [Function]
2442 <br><b>delete-session-value</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">symbol
2443 <tt>&amp;optional
2444 </tt> session
2445 </clix:lambda-list></i>
2446 =&gt;
2447 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">|
2448 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2449 Removes the value associated with
2450 <code><i>symbol</i></code> from
2451 <code><i>session</i></code> if there is one.
2452 </clix:description></blockquote></p>
2454 <p xmlns=""><a class="none" name="*session*"></a>
2455 [Special variable]
2456 <br><b>*session*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2457 The current session while in the context of a request, or
2458 <code xmlns="http://www.w3.org/1999/xhtml">NIL</code>.
2459 </clix:description></blockquote></p>
2461 <p xmlns=""><a class="none" name="remove-session"></a>
2462 [Function]
2463 <br><b>remove-session</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">session
2464 </clix:lambda-list></i>
2465 =&gt;
2466 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">|
2467 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2468 Completely removes the <code><a href="#session">SESSION</a></code> object
2469 <code><i>session</i></code> from Hunchentoot's
2470 internal <a xmlns="http://www.w3.org/1999/xhtml" href="#session-db">session database</a>.
2471 </clix:description></blockquote></p>
2473 <p xmlns=""><a class="none" name="reset-sessions"></a>
2474 [Function]
2475 <br><b>reset-sessions</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
2476 <tt>&amp;optional
2477 </tt> acceptor
2478 </clix:lambda-list></i>
2479 =&gt;
2480 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">|
2481 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2482 Removes <em xmlns="http://www.w3.org/1999/xhtml">all</em> stored sessions of
2483 <code><i>acceptor</i></code>. The default for
2484 <code><i>acceptor</i></code> is
2485 <code><a href="#*acceptor*">*ACCEPTOR*</a></code>.
2486 </clix:description></blockquote></p>
2488 <p xmlns=""><a class="none" name="regenerate-session-cookie-value"></a>
2489 [Function]
2490 <br><b>regenerate-session-cookie-value</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">session
2491 </clix:lambda-list></i>
2492 =&gt;
2493 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">cookie
2494 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2495 Regenerates the session cookie value. This should be used
2496 when a user logs in according to the application to prevent
2497 against session fixation attacks. The cookie value being
2498 dependent on ID, USER-AGENT, REMOTE-ADDR, START, and
2499 *SESSION-SECRET*, the only value we can change is START to
2500 regenerate a new value. Since we're generating a new cookie,
2501 it makes sense to have the session being restarted, in
2502 time. That said, because of this fact, calling this function
2503 twice in the same second will regenerate twice the same
2504 value.
2505 </clix:description></blockquote></p>
2507 <p xmlns=""><a class="none" name="*rewrite-for-session-urls*"></a>
2508 [Special variable]
2509 <br><b>*rewrite-for-session-urls*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2510 Whether HTML pages should possibly be rewritten for cookie-less
2511 session-management.
2512 </clix:description></blockquote></p>
2514 <p xmlns=""><a class="none" name="*content-types-for-url-rewrite*"></a>
2515 [Special variable]
2516 <br><b>*content-types-for-url-rewrite*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2517 The content types for which url-rewriting is OK. See
2518 <code><a href="#*rewrite-for-session-urls*">*REWRITE-FOR-SESSION-URLS*</a></code>.
2519 </clix:description></blockquote></p>
2521 <p xmlns=""><a class="none" name="*use-remote-addr-for-sessions*"></a>
2522 [Special variable]
2523 <br><b>*use-remote-addr-for-sessions*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2524 Whether the client's remote IP (as returned by <code><a href="#real-remote-addr">REAL-REMOTE-ADDR</a></code>)
2525 should be encoded into the session string. If this value is true, a
2526 session will cease to be accessible if the client's remote IP changes.
2527 <p xmlns="http://www.w3.org/1999/xhtml">
2528 This might for example be an issue if the client uses a proxy server
2529 which doesn't send correct 'X-Forwarded-For' headers.
2530 </p>
2531 </clix:description></blockquote></p>
2533 <p xmlns=""><a class="none" name="session-remote-addr"></a>
2534 [Generic function]
2535 <br><b>session-remote-addr</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">session
2536 </clix:lambda-list></i>
2537 =&gt;
2538 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">remote-addr
2539 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2540 The remote IP address of the client when this session was started (as
2541 returned by <code><a href="#real-remote-addr">REAL-REMOTE-ADDR</a></code>).
2542 </clix:description></blockquote></p>
2544 <p xmlns=""><a class="none" name="*use-user-agent-for-sessions*"></a>
2545 [Special variable]
2546 <br><b>*use-user-agent-for-sessions*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">Whether the 'User-Agent' header should
2547 be encoded into the session string. If this value is true, a session
2548 will cease to be accessible if the client sends a different
2549 'User-Agent' header.
2550 </clix:description></blockquote></p>
2552 <p xmlns=""><a class="none" name="session-user-agent"></a>
2553 [Generic function]
2554 <br><b>session-user-agent</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">session
2555 </clix:lambda-list></i>
2556 =&gt;
2557 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">user-agent
2558 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2559 The incoming 'User-Agent' header that
2560 was sent when this session was created.
2561 </clix:description></blockquote></p>
2563 <p xmlns=""><a class="none" name="session-max-time"></a>
2564 [Generic accessor]
2565 <br><b>session-max-time</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">session
2566 </clix:lambda-list></i>
2567 =&gt;
2568 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">max-time
2569 </clix:returns></i><br><tt>(setf (</tt><b>session-max-time</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">session
2570 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2571 Gets or sets the time (in seconds) after
2572 which <code><i>session</i></code> expires if it's not used.
2573 </clix:description></blockquote></p>
2576 <p xmlns=""><a class="none" name="*session-max-time*"></a>
2577 [Special variable]
2578 <br><b>*session-max-time*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2579 The default time (in seconds) after which a session times out.
2580 </clix:description></blockquote></p>
2582 <p xmlns=""><a class="none" name="*session-gc-frequency*"></a>
2583 [Special variable]
2584 <br><b>*session-gc-frequency*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2585 A session GC (see function <code><a href="#session-gc">SESSION-GC</a></code>) will happen every
2586 <code><a href="#*session-gc-frequency*">*SESSION-GC-FREQUENCY*</a></code> requests (counting only
2587 requests which create a new session) if this variable is
2588 not <code xmlns="http://www.w3.org/1999/xhtml">NIL</code>. See <code><a href="#session-created">SESSION-CREATED</a></code>.
2589 </clix:description></blockquote></p>
2591 <p xmlns=""><a class="none" name="session-gc"></a>
2592 [Function]
2593 <br><b>session-gc</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
2594 </clix:lambda-list></i>
2595 =&gt;
2596 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">|
2597 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2598 Removes sessions from the current session database which are
2599 too old - see <code><a href="#session-too-old-p">SESSION-TOO-OLD-P</a></code>.
2600 </clix:description></blockquote></p>
2602 <p xmlns=""><a class="none" name="session-too-old-p"></a>
2603 [Function]
2604 <br><b>session-too-old-p</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">session
2605 </clix:lambda-list></i>
2606 =&gt;
2607 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">generalized-boolean
2608 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2609 Returns true if the <code><a href="#session">SESSION</a></code> object <code><i>session</i></code> has not been active in
2610 the last <code xmlns="http://www.w3.org/1999/xhtml">(session-max-time session)</code> seconds.
2611 </clix:description></blockquote></p>
2613 <p xmlns=""><a class="none" name="session-id"></a>
2614 [Generic function]
2615 <br><b>session-id</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">session
2616 </clix:lambda-list></i>
2617 =&gt;
2618 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">session-id
2619 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2620 The unique ID (an INTEGER) of the session.
2621 </clix:description></blockquote></p>
2623 <p xmlns=""><a class="none" name="session-start"></a>
2624 [Generic function]
2625 <br><b>session-start</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">session
2626 </clix:lambda-list></i>
2627 =&gt;
2628 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">universal-time
2629 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2630 The time this session was started.
2631 </clix:description></blockquote></p>
2635 <h4 xmlns=""><a name="session-behaviour">Customizing session behaviour</a></h4>
2637 For everyday session usage, you will probably just
2638 use <code xmlns=""><a href="#start-session">START-SESSION</a></code>,
2639 <code xmlns=""><a href="#session-value">SESSION-VALUE</a></code>,
2640 and maybe <code xmlns=""><a href="#delete-session-value">DELETE-SESSION-VALUE</a></code>
2641 and <code xmlns=""><a href="#*session*">*SESSION*</a></code>. However, there are two ways to
2642 customize the way Hunchentoot maintains sessions.
2644 One way is to mostly leave the session mechanism intact but to tweak
2645 it a bit:
2646 <ul>
2647 <li>The publicly visible part of a session is encoded using a
2648 <a href="#*session-secret*">secret</a> which you can set yourself.</li>
2649 <li>And it is stored using a cookie (or GET
2650 parameter) <a href="#session-cookie-name">name</a> that you can
2651 override.</li>
2652 <li>Each session receives a <a href="#next-session-id">new ID</a> when
2653 it is created and you can implement a more robust way to do that.</li>
2654 <li>You can arrange to be called whenever a session
2655 is <a href="#session-created">created</a> to trigger some action. You
2656 might also do this to invent your own
2657 session <a href="#session-gc">garbage collection</a>.</li>
2658 <li>By default, all sessions are stored in a global alist in memory.
2659 You can't change the alist part, but you can distribute your sessions
2660 over different <a href="#session-db">"databases"</a>.</li>
2661 <li>By default, every operation which modifies sessions or one of the
2662 session databases is guarded by a global lock, but you can arrange to
2663 <a href="#session-db-lock">provide</a> different locks for this.</li>
2664 </ul>
2665 </p>
2667 The other way to customize Hunchentoot's sessions is to completely
2668 replace them. This is actually pretty easy: Create your own class to
2669 store state (which doesn't have to and probably shouldn't inherit
2670 from <code xmlns=""><a href="#session">SESSION</a></code>) and implement methods for
2671 <code xmlns=""><a href="#session-verify">SESSION-VERIFY</a></code>
2672 and <code xmlns=""><a href="#session-cookie-value">SESSION-COOKIE-VALUE</a></code> - that's it.
2673 Hunchentoot will continue to use cookies and/or to rewrite URLs to
2674 keep track of session state and it will store "the current session"
2675 (whatever that is in your implementation)
2676 in <code xmlns=""><a href="#*session*">*SESSION*</a></code>. Everything else (like persisting
2677 sessions, GC, getting and setting values) you'll have to take care of
2678 yourself and the other session functions
2679 (like <code xmlns=""><a href="#start-session">START-SESSION</a></code> or
2680 <code xmlns=""><a href="#session-value">SESSION-VALUE</a></code>) won't work anymore. (Almost)
2681 total freedom, but a lot of responsibility as well... :)
2682 </p>
2684 <p xmlns=""><a class="none" name="*session-secret*"></a>
2685 [Special variable]
2686 <br><b>*session-secret*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2687 A random ASCII string that's used to encode the public
2688 session data. This variable is initially unbound and will
2689 be set (using <code><a href="#reset-session-secret">RESET-SESSION-SECRET</a></code>) the
2690 first time a session is created, if necessary. You can
2691 prevent this from happening if you set the value yourself
2692 before starting <a xmlns="http://www.w3.org/1999/xhtml" href="#acceptors">acceptors</a>.
2693 </clix:description></blockquote></p>
2695 <p xmlns=""><a class="none" name="reset-session-secret"></a>
2696 [Function]
2697 <br><b>reset-session-secret</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
2698 </clix:lambda-list></i>
2699 =&gt;
2700 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">secret
2701 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2702 Sets <code><a href="#*session-secret*">*SESSION-SECRET*</a></code> to a
2703 new random value. All old sessions will cease to be valid.
2704 </clix:description></blockquote></p>
2706 <p xmlns=""><a class="none" name="session-cookie-name"></a>
2707 [Generic function]
2708 <br><b>session-cookie-name</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
2709 </clix:lambda-list></i>
2710 =&gt;
2711 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">name
2712 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2713 Returns the name (a string) of the cookie (or
2714 the GET parameter) which is used to store a session on the client
2715 side. The default is to use the
2716 string <code xmlns="http://www.w3.org/1999/xhtml">"hunchentoot-session"</code>, but you can
2717 specialize this function if you want another name.
2718 </clix:description></blockquote></p>
2720 <p xmlns=""><a class="none" name="session-created"></a>
2721 [Generic function]
2722 <br><b>session-created</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor new-session
2723 </clix:lambda-list></i>
2724 =&gt;
2725 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">result
2726 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2727 This function is called whenever a new session
2728 has been created. There's a default method which might trigger
2729 a <a xmlns="http://www.w3.org/1999/xhtml" href="#session-gc">session GC</a> based on the value of
2730 <code><a href="#*session-gc-frequency*">*SESSION-GC-FREQUENCY*</a></code>.
2731 <p xmlns="http://www.w3.org/1999/xhtml">
2732 The return value is ignored.
2733 </p>
2734 </clix:description></blockquote></p>
2736 <p xmlns=""><a class="none" name="next-session-id"></a>
2737 [Generic function]
2738 <br><b>next-session-id</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
2739 </clix:lambda-list></i>
2740 =&gt;
2741 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">id
2742 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2743 Returns the next sequential session ID, an
2744 integer, which should be unique per session. The default method uses
2745 a simple global counter and isn't guarded by a lock. For a
2746 high-performance production environment you might consider using a
2747 more robust implementation.
2748 </clix:description></blockquote></p>
2750 <p xmlns=""><a class="none" name="session-db"></a>
2751 [Generic accessor]
2752 <br><b>session-db</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
2753 </clix:lambda-list></i>
2754 =&gt;
2755 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">database
2756 </clix:returns></i><br><tt>(setf (</tt><b>session-db</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
2757 </clix:lambda-list></i><tt>) <i>new-value</i>)</tt><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2758 Returns the current session database which is an
2759 alist where each car is a session's ID and the cdr is the
2760 corresponding <code><a href="#session">SESSION</a></code> object itself. The default
2761 is to use a global list for all acceptors.
2762 </clix:description></blockquote></p>
2764 <p xmlns=""><a class="none" name="session-db-lock"></a>
2765 [Generic function]
2766 <br><b>session-db-lock</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">acceptor
2767 <tt>&amp;key
2768 </tt> whole-db-p
2769 </clix:lambda-list></i>
2770 =&gt;
2771 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">lock
2772 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2773 A function which returns a lock that will be
2774 used to prevent concurrent access to sessions. The first argument
2775 will be the <a xmlns="http://www.w3.org/1999/xhtml" href="#acceptors">acceptor</a> that handles the
2776 current <a xmlns="http://www.w3.org/1999/xhtml" href="#requests">request</a>, the second argument is true
2777 if the whole (current) session database is modified. If it
2778 is <code xmlns="http://www.w3.org/1999/xhtml">NIL</code>, only one existing session in the database is
2779 modified.
2780 <p xmlns="http://www.w3.org/1999/xhtml">
2781 This function can return <code>NIL</code> which means that sessions or
2782 session databases will be modified without a lock held (for example
2783 for single-threaded environments). The default is to always return a
2784 global lock (ignoring the <code xmlns=""><i>acceptor</i></code> argument) for
2785 Lisps that support threads and <code>NIL</code> otherwise.
2786 </p>
2787 </clix:description></blockquote></p>
2789 <p xmlns=""><a class="none" name="session-verify"></a>
2790 [Generic function]
2791 <br><b>session-verify</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">request
2792 </clix:lambda-list></i>
2793 =&gt;
2794 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">session-or-nil
2795 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2796 Tries to get a session identifier from the cookies
2797 (or alternatively from the GET parameters) sent by the client (see
2798 <code><a href="#session-cookie-name">SESSION-COOKIE-NAME</a></code>
2799 and <code><a href="#session-cookie-value">SESSION-COOKIE-VALUE</a></code>). This identifier is
2800 then checked for validity against the <code><a href="#request">REQUEST</a></code>
2801 object
2802 <code><i>request</i></code>. On success the corresponding session object (if not too
2803 old) is returned (and updated). Otherwise <code xmlns="http://www.w3.org/1999/xhtml">NIL</code> is returned.
2804 <p xmlns="http://www.w3.org/1999/xhtml">
2805 A default method is provided and you only need to write your own one
2806 if you want to maintain your own sessions.
2807 </p>
2808 </clix:description></blockquote></p>
2810 <p xmlns=""><a class="none" name="session-cookie-value"></a>
2811 [Generic function]
2812 <br><b>session-cookie-value</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">session
2813 </clix:lambda-list></i>
2814 =&gt;
2815 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">string
2816 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2817 Returns a string which can be used to safely
2818 restore the session <code><i>session</i></code> if as session has
2819 already been established. This is used as the value stored in the
2820 session cookie or in the corresponding GET parameter and verified
2821 by <code><a href="#session-verify">SESSION-VERIFY</a></code>.
2822 <p xmlns="http://www.w3.org/1999/xhtml">
2823 A default
2824 method is provided and there's no reason to change it unless you
2825 want to use your own session objects.
2826 </p>
2827 </clix:description></blockquote></p>
2831 <h4 xmlns=""><a name="cookies">Cookies</a></h4>
2833 Outgoing cookies are stored in the request's <code xmlns=""><a href="#reply">REPLY</a></code>
2834 object (see <code xmlns=""><a href="#cookie-out">COOKIE-OUT</a></code>
2835 and <code xmlns=""><a href="#cookies-out*">COOKIES-OUT*</a></code>). They are CLOS objects
2836 defined like this:
2838 <pre>(defclass cookie ()
2839 ((name :initarg :name
2840 :reader <a class="noborder" name="cookie-name">cookie-name</a>
2841 :type string
2842 :documentation "The name of the cookie - a string.")
2843 (value :initarg :value
2844 :accessor <a class="noborder" name="cookie-value">cookie-value</a>
2845 :initform ""
2846 :documentation "The value of the cookie. Will be URL-encoded when sent to the browser.")
2847 (expires :initarg :expires
2848 :initform nil
2849 :accessor <a class="noborder" name="cookie-expires">cookie-expires</a>
2850 :documentation "The time (a universal time) when the cookie expires (or NIL).")
2851 (max-age :initarg :max-age
2852 :initform nil
2853 :accessor <a class="noborder" name="cookie-max-age">cookie-max-age</a>
2854 :documentation "The time delta (in seconds) after which the cookie expires (or NIL).")
2855 (path :initarg :path
2856 :initform nil
2857 :accessor <a class="noborder" name="cookie-path">cookie-path</a>
2858 :documentation "The path this cookie is valid for (or NIL).")
2859 (domain :initarg :domain
2860 :initform nil
2861 :accessor <a class="noborder" name="cookie-domain">cookie-domain</a>
2862 :documentation "The domain this cookie is valid for (or NIL).")
2863 (secure :initarg :secure
2864 :initform nil
2865 :accessor <a class="noborder" name="cookie-secure">cookie-secure</a>
2866 :documentation "A generalized boolean denoting whether this is a secure cookie.")
2867 (http-only :initarg :http-only
2868 :initform nil
2869 :accessor <a class="noborder" name="cookie-http-only">cookie-http-only</a>
2870 :documentation "A generalized boolean denoting whether this is a <a href="http://msdn2.microsoft.com/en-us/library/ms533046.aspx">HttpOnly</a> cookie.")))
2871 </pre>
2873 The <a href="http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_r.htm#reader">reader</a>
2874 <code xmlns=""><a href="#cookie-name">COOKIE-NAME</a></code> and
2875 the <a href="http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_a.htm#accessor">accessors</a>
2876 <code xmlns=""><a href="#cookie-value">COOKIE-VALUE</a></code>, <code xmlns=""><a href="#cookie-expires">COOKIE-EXPIRES</a></code>, <code xmlns=""><a href="#cookie-max-age">COOKIE-MAX-AGE</a></code>,
2877 <code xmlns=""><a href="#cookie-path">COOKIE-PATH</a></code>, <code xmlns=""><a href="#cookie-domain">COOKIE-DOMAIN</a></code>, <code xmlns=""><a href="#cookie-secure">COOKIE-SECURE</a></code>,
2878 and <code xmlns=""><a href="#cookie-http-only">COOKIE-HTTP-ONLY</a></code> are all exported from
2879 the <code>HUNCHENTOOT</code> package. For now, the class name itself is <em>not</em> exported.
2881 <p xmlns=""><a class="none" name="set-cookie"></a>
2882 [Function]
2883 <br><b>set-cookie</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
2884 name <tt>&amp;key</tt> value expires path
2885 domain secure http-only reply
2886 </clix:lambda-list></i>
2887 =&gt;
2888 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">cookie</clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2889 Creates a <code xmlns="http://www.w3.org/1999/xhtml">COOKIE</code> object from the parameters
2890 provided to this function and adds it to the outgoing cookies
2891 of the <a xmlns="http://www.w3.org/1999/xhtml" href="#replies"><code>REPLY</code> object</a>
2892 <code><i>reply</i></code>. If a cookie with the same name
2893 (case-sensitive) already exists, it is replaced. The default
2894 for <code><i>reply</i></code>
2895 is <code><a href="#*reply*">*REPLY*</a></code>. The default
2896 for <code><i>value</i></code> is the empty string.
2897 </clix:description></blockquote></p>
2899 <p xmlns=""><a class="none" name="set-cookie*"></a>
2900 [Function]
2901 <br><b>set-cookie*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">cookie <tt>&amp;optional</tt> reply</clix:lambda-list></i>
2902 =&gt;
2903 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">cookie</clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2904 Adds the <code xmlns="http://www.w3.org/1999/xhtml">COOKIE</code> object <code><i>cookie</i></code>
2905 to the outgoing cookies of
2906 the <a xmlns="http://www.w3.org/1999/xhtml" href="#replies"><code>REPLY</code> object</a>
2907 <code><i>reply</i></code>. If a cookie with the same name
2908 (case-sensitive) already exists, it is replaced. The default
2909 for <code><i>reply</i></code> is <code><a href="#*reply*">*REPLY*</a></code>.
2910 </clix:description></blockquote></p>
2913 <h4 xmlns=""><a name="logging">Logging</a></h4>
2914 Hunchentoot can log accesses and diagnostic messages to two
2915 separate destinations, which can be either files in the file
2916 system or streams. Logging can also be disabled by setting the
2917 <clix:code xmlns:clix="http://bknr.net/clixdoc">ACCESS-LOG-DESTINATION</clix:code> and
2918 <clix:code xmlns:clix="http://bknr.net/clixdoc">MESSAGE-LOG-DESTINATION</clix:code> slots in the
2919 <code xmlns=""><a href="#acceptor">ACCEPTOR</a></code> to <code>NIL</code>. The two
2920 slots can be initialized by providing the
2921 :ACCESS-LOG-DESTINATION and :MESSAGE-LOG-DESTINATION
2922 initialization arguments when creating the acceptor or set by
2923 setting the slots through its
2924 <code xmlns=""><a href="#acceptor-message-log-destination">ACCEPTOR-MESSAGE-LOG-DESTINATION</a></code> and
2925 <code xmlns=""><a href="#acceptor-access-log-destination">ACCEPTOR-ACCESS-LOG-DESTINATION</a></code> accessors.
2927 When the path for the message or accept log is set to a
2928 variable holding an output stream, hunchentoots writes
2929 corresponding log entries to that stream. By default,
2930 Hunchentoot logs to *STANDARD-ERROR*.
2931 </p>
2933 Access logging is done in a format similar to what
2934 the Apache web server can write so that logfile analysis using
2935 standard tools is possible. Errors during request processing are
2936 logged to a separate file.
2937 </p>
2939 The standard logging mechanism is deliberately simple and slow. The
2940 log files are opened for each log entry and closed again after
2941 writing, and access to them is protected by a global lock. Derived
2942 acceptor classes can implement methods for the
2943 <code xmlns=""><a href="#acceptor-log-message">ACCEPTOR-LOG-MESSAGE</a></code> and
2944 <code xmlns=""><a href="#acceptor-log-access">ACCEPTOR-LOG-ACCESS</a></code> generic functions in order to
2945 log differently (e.g. to a central logging server or in a different
2946 file format.
2947 </p>
2949 Errors happening within a <a href="#request-dispatch">handler</a>
2950 which are not caught by the handler itself are handled by
2951 Hunchentoot by logging them to the established
2952 <code xmlns=""><a href="#acceptor-message-log-destination">ACCEPTOR-MESSAGE-LOG-DESTINATION</a></code>.
2953 </p>
2955 <p xmlns=""><a class="none" name="log-message*"></a>
2956 [Function]
2957 <br><b>log-message*</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">log-level format-string
2958 <tt>&amp;rest
2959 </tt> format-arguments
2960 </clix:lambda-list></i>
2961 =&gt;
2962 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">result
2963 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2964 Convenience function which calls the message
2965 logger of the current acceptor (if there is one) with the same
2966 arguments it accepts. Returns <code xmlns="http://www.w3.org/1999/xhtml">NIL</code> if there is no message
2967 logger or whatever the message logger returns.
2968 <p xmlns="http://www.w3.org/1999/xhtml">
2969 This is the function which Hunchentoot itself uses to log errors it
2970 catches during request processing.
2971 </p>
2972 </clix:description></blockquote></p>
2974 <p xmlns=""><a class="none" name="*log-lisp-errors-p*"></a>
2975 [Special variable]
2976 <br><b>*log-lisp-errors-p*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2977 Whether Lisp errors in request handlers should be logged.
2978 </clix:description></blockquote></p>
2980 <p xmlns=""><a class="none" name="*log-lisp-backtraces-p*"></a>
2981 [Special variable]
2982 <br><b>*log-lisp-backtraces-p*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2983 Whether Lisp backtraces should be logged. Only
2984 has an effect if <code><a href="#*log-lisp-errors-p*">*LOG-LISP-ERRORS-P*</a></code> is true
2985 as well.
2986 </clix:description></blockquote></p>
2988 <p xmlns=""><a class="none" name="*log-lisp-warnings-p*"></a>
2989 [Special variable]
2990 <br><b>*log-lisp-warnings-p*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2991 Whether Lisp warnings in request handlers should be logged.
2992 </clix:description></blockquote></p>
2994 <p xmlns=""><a class="none" name="*lisp-errors-log-level*"></a>
2995 [Special variable]
2996 <br><b>*lisp-errors-log-level*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
2997 Log level for Lisp errors. Should be one
2998 of <code xmlns="http://www.w3.org/1999/xhtml">:ERROR</code> (the default), <code xmlns="http://www.w3.org/1999/xhtml">:WARNING</code>,
2999 or <code xmlns="http://www.w3.org/1999/xhtml">:INFO</code>.
3000 </clix:description></blockquote></p>
3002 <p xmlns=""><a class="none" name="*lisp-warnings-log-level*"></a>
3003 [Special variable]
3004 <br><b>*lisp-warnings-log-level*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3005 Log level for Lisp warnings.
3006 Should be one of <code xmlns="http://www.w3.org/1999/xhtml">:ERROR</code>, <code xmlns="http://www.w3.org/1999/xhtml">:WARNING</code>
3007 (the default), or <code xmlns="http://www.w3.org/1999/xhtml">:INFO</code>.
3008 </clix:description></blockquote></p>
3011 <h4 xmlns=""><a name="conditions">Conditions and error handling</a></h4>
3013 This section describes how Hunchentoot deals with exceptional
3014 situations. See also the secion about <a href="#logging">logging</a>.
3015 </p>
3017 When an error occurs while processing a request, Hunchentoot's
3018 default behavior is to catch the error, log it and
3019 optionally display it to the client in the HTML response.
3020 This behavior can be customized through the values of a number
3021 of special variables, which are documented below.
3022 </p>
3024 <p xmlns=""><a class="none" name="*catch-errors-p*"></a>
3025 [Special variable]
3026 <br><b>*catch-errors-p*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3027 If the value of this variable is <code xmlns="http://www.w3.org/1999/xhtml">NIL</code>
3028 (the default is <code xmlns="http://www.w3.org/1999/xhtml">T</code>), then errors which happen while a
3029 request is handled aren't <a xmlns="http://www.w3.org/1999/xhtml" href="#logging">caught as usual</a>, but
3030 instead your
3031 Lisp's <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_d.htm#debugger">debugger</a>
3032 is <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_invoke.htm">invoked</a>.
3033 This variable should obviously always be set to a <em xmlns="http://www.w3.org/1999/xhtml">true</em> value
3034 in a production environment.
3035 See <code><a href="#maybe-invoke-debugger">MAYBE-INVOKE-DEBUGGER</a></code>
3036 if you want to fine-tune this behaviour.
3037 </clix:description></blockquote></p>
3039 <p xmlns=""><a class="none" name="*show-lisp-errors-p*"></a>
3040 [Special variable]
3041 <br><b>*show-lisp-errors-p*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3042 Whether Lisp errors should be shown in HTML output. Note
3043 that this only affects canned responses generated by Lisp.
3044 If an error template is present for the "internal server
3045 error" status code, this special variable is not used (see
3046 <code><a href="#acceptor-status-message">acceptor-status-message</a></code>).
3047 </clix:description></blockquote></p>
3049 <p xmlns=""><a class="none" name="*show-lisp-backtraces-p*"></a>
3050 [Special variable]
3051 <br><b>*show-lisp-backtraces-p*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3052 Whether Lisp backtraces should be shown in HTML output if
3053 <code><a href="#*show-lisp-errors-p*">*SHOW-LISP-ERRORS-P*</a></code> is true and an error occurs.
3054 </clix:description></blockquote></p>
3056 <p xmlns=""><a class="none" name="maybe-invoke-debugger"></a>
3057 [Generic function]
3058 <br><b>maybe-invoke-debugger</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">condition
3059 </clix:lambda-list></i>
3060 =&gt;
3061 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">|
3062 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3063 This generic function is called whenever a
3064 <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.lispworks.com/documentation/HyperSpec/Body/09_.htm">condition</a> <code xmlns="http://www.w3.org/1999/xhtml"><i>condition</i></code>
3065 is signaled in Hunchentoot. You might want to specialize it on
3066 specific condition classes for debugging purposes. The default
3067 method <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_invoke.htm">invokes
3068 the debugger</a> with <code><i>condition</i></code> if
3069 <code><a href="#*catch-errors-p*">*CATCH-ERRORS-P*</a></code> is <code xmlns="http://www.w3.org/1999/xhtml">NIL</code>.
3070 </clix:description></blockquote></p>
3072 <p xmlns=""><a class="none" name="hunchentoot-condition"></a>
3073 [Condition type]
3074 <br><b>hunchentoot-condition</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3075 Superclass for all conditions related to Hunchentoot.
3076 </clix:description></blockquote></p>
3078 <p xmlns=""><a class="none" name="hunchentoot-error"></a>
3079 [Condition type]
3080 <br><b>hunchentoot-error</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3081 Superclass for all errors related to Hunchentoot and a subclass of <code><a href="#hunchentoot-condition">HUNCHENTOOT-CONDITION</a></code>.
3082 </clix:description></blockquote></p>
3084 <p xmlns=""><a class="none" name="parameter-error"></a>
3085 [Condition type]
3086 <br><b>parameter-error</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3087 Signalled if a function was called with incosistent or illegal parameters. A subclass of <code><a href="#hunchentoot-error">HUNCHENTOOT-ERROR</a></code>.
3088 </clix:description></blockquote></p>
3090 <p xmlns=""><a class="none" name="hunchentoot-warning"></a>
3091 [Condition type]
3092 <br><b>hunchentoot-warning</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3093 Superclass for all warnings related to Hunchentoot and a subclass of <code><a href="#hunchentoot-condition">HUNCHENTOOT-CONDITION</a></code>.
3094 </clix:description></blockquote></p>
3098 <h4 xmlns=""><a name="misc">Miscellaneous</a></h4>
3100 Various functions and variables which didn't fit into one of the
3101 other categories.
3103 <p xmlns=""><a class="none" name="abort-request-handler"></a>
3104 [Function]
3105 <br><b>abort-request-handler</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
3106 <tt>&amp;optional
3107 </tt> result
3108 </clix:lambda-list></i>
3109 =&gt;
3110 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">result
3111 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3112 This function can be called by a request handler
3113 at any time to immediately abort handling the request. This works as
3114 if the handler had returned <code><i>result</i></code>. See the
3115 source code of <code><a href="#redirect">REDIRECT</a></code> for an example.
3116 </clix:description></blockquote></p>
3118 <p xmlns=""><a class="none" name="handle-if-modified-since"></a>
3119 [Function]
3120 <br><b>handle-if-modified-since</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">time <tt>&amp;optional</tt> request</clix:lambda-list></i>
3121 =&gt;
3122 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">|</clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3123 This function is designed to be used inside
3124 a <a xmlns="http://www.w3.org/1999/xhtml" href="#request-dispatch">handler</a>. If the client has sent an
3125 'If-Modified-Since' header
3126 (see <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.faqs.org/rfcs/rfc2616.html">RFC 2616</a>,
3127 section 14.25) and the time specified matches the universal
3128 time
3129 <code><i>time</i></code> then the
3130 header <code><a href="#+http-not-modified+">+HTTP-NOT-MODIFIED+</a></code> with no content
3131 is immediately returned to the client.
3132 <p xmlns="http://www.w3.org/1999/xhtml">
3133 Note that for this function to be useful you should usually
3134 send 'Last-Modified' headers back to the client. See the
3135 code
3136 of <code xmlns=""><a href="#create-static-file-dispatcher-and-handler">CREATE-STATIC-FILE-DISPATCHER-AND-HANDLER</a></code>
3137 for an example.
3138 </p>
3139 </clix:description></blockquote></p>
3142 <p xmlns=""><a class="none" name="handle-static-file"></a>
3143 [Function]
3144 <br><b>handle-static-file</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">path <tt>&amp;optional</tt> content-type callback</clix:lambda-list></i>
3145 =&gt;
3146 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">nil</clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3147 Sends the file denoted by the pathname designator
3148 <code><i>path</i></code> with content type
3149 <code><i>content-type</i></code> to the client. Sets the
3150 necessary handlers. In particular the function employs
3151 <code><a href="#handle-if-modified-since">HANDLE-IF-MODIFIED-SINCE</a></code>.
3152 <p xmlns="http://www.w3.org/1999/xhtml">
3153 If <code xmlns=""><i>content-type</i></code> is <code>NIL</code>, the
3154 function tries to determine the correct content type from
3155 the file's suffix or falls back
3156 to <code>"application/octet-stream"</code> as a last resort.
3157 </p>
3158 <p xmlns="http://www.w3.org/1999/xhtml">
3159 The <code xmlns=""><i>callback</i></code> is run just before opening
3160 the file; it can eg. check authorization or send caching headers.
3161 It gets the filename and the (guessed) content-type as arguments.
3162 </p>
3163 <p xmlns="http://www.w3.org/1999/xhtml">
3164 Note that this function
3165 calls <code xmlns=""><a href="#send-headers">SEND-HEADERS</a></code> internally, so after
3166 you've called it, the headers are sent and the return value
3167 of your handler is ignored.
3168 </p>
3169 </clix:description></blockquote></p>
3171 <p xmlns=""><a class="none" name="redirect"></a>
3172 [Function]
3173 <br><b>redirect</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">target <tt>&amp;key</tt> host port protocol add-session-id code</clix:lambda-list></i>
3174 =&gt;
3175 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">|</clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3176 Sends back appropriate headers to redirect the client
3177 to <code><i>target</i></code> (a string).
3178 <p xmlns="http://www.w3.org/1999/xhtml">
3179 If <code xmlns=""><i>target</i></code> is a full URL starting with a
3180 scheme, <code xmlns=""><i>host</i></code>, <code xmlns=""><i>port</i></code>,
3181 and <code xmlns=""><i>protocol</i></code> are ignored.
3182 Otherwise, <code xmlns=""><i>target</i></code> should denote the path
3183 part of a URL, <code xmlns=""><i>protocol</i></code> must be one of
3184 the keywords <code>:HTTP</code> or <code>:HTTPS</code>, and
3185 the URL to redirect to will be constructed
3186 from <code xmlns=""><i>host</i></code>, <code xmlns=""><i>port</i></code>, <code xmlns=""><i>protocol</i></code>,
3187 and <code xmlns=""><i>target</i></code>.
3188 </p>
3189 <p xmlns="http://www.w3.org/1999/xhtml">
3190 <code xmlns=""><i>code</i></code> must be a 3xx HTTP redirection
3191 status code to send to the client. It defaults to 302
3192 ("Found"). If <code xmlns=""><i>host</i></code> is not provided,
3193 the current host (see <code xmlns=""><a href="#host">HOST</a></code>) will be
3194 used. If <code xmlns=""><i>protocol</i></code> is the keyword
3195 <code>:HTTPS</code>, the client will be redirected to a
3196 https URL, if it's <code>:HTTP</code> it'll be sent to a
3197 http URL. If both <code xmlns=""><i>host</i></code> and
3198 <code xmlns=""><i>protocol</i></code> aren't provided, then the
3199 value of <code xmlns=""><i>protocol</i></code> will match the
3200 current request.
3201 </p>
3202 </clix:description></blockquote></p>
3204 <p xmlns=""><a class="none" name="require-authorization"></a>
3205 [Function]
3206 <br><b>require-authorization</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc"><tt>&amp;optional</tt> realm</clix:lambda-list></i>
3207 =&gt;
3208 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">|</clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3209 Sends back appropriate headers to require basic HTTP
3210 authentication
3211 (see <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.faqs.org/rfcs/rfc2617.html">RFC 2617</a>)
3212 for the realm <code><i>realm</i></code>. The default value
3213 for <code><i>realm</i></code> is <code xmlns="http://www.w3.org/1999/xhtml">"Hunchentoot"</code>.
3214 </clix:description></blockquote></p>
3216 <p xmlns=""><a class="none" name="no-cache"></a>
3217 [Function]
3218 <br><b>no-cache</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
3219 </clix:lambda-list></i>
3220 =&gt;
3221 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">|
3222 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3223 Adds appropriate headers to completely prevent caching on most browsers.
3224 </clix:description></blockquote></p>
3226 <p xmlns=""><a class="none" name="ssl-p"></a>
3227 [Function]
3228 <br><b>ssl-p</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
3229 <tt>&amp;optional
3230 </tt> acceptor
3231 </clix:lambda-list></i>
3232 =&gt;
3233 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">generalized-boolean
3234 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3235 Whether the current connection to the client is secure. See <code><a href="#acceptor-ssl-p">ACCEPTOR-SSL-P</a></code>.
3236 </clix:description></blockquote></p>
3238 <p xmlns=""><a class="none" name="ssl-get-peer-certificate"></a>
3239 [Function]
3240 <br><b>ssl-get-peer-certificate</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
3241 </clix:lambda-list></i>
3242 =&gt;
3243 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">system-area-pointer
3244 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3245 Returns a SAP to the certificate the peer used to authenticate itself, or NIL.
3246 Can be used with <code xmlns="http://www.w3.org/1999/xhtml">CL+SSL:CERTIFICATE-SUBJECT-COMMON-NAMES</code> and the other certificate functions.
3247 </clix:description></blockquote></p>
3249 <p xmlns=""><a class="none" name="reason-phrase"></a>
3250 [Function]
3251 <br><b>reason-phrase</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">return-code
3252 </clix:lambda-list></i>
3253 =&gt;
3254 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">string
3255 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3256 Returns a reason phrase for the HTTP return code <code><i>return-code</i></code>
3257 (which should be an integer) or <code xmlns="http://www.w3.org/1999/xhtml">NIL</code> for return codes Hunchentoot
3258 doesn't know.
3259 </clix:description></blockquote></p>
3261 <p xmlns=""><a class="none" name="rfc-1123-date"></a>
3262 [Function]
3263 <br><b>rfc-1123-date</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
3264 <tt>&amp;optional
3265 </tt> time
3266 </clix:lambda-list></i>
3267 =&gt;
3268 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">string
3269 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3270 Generates a time string according to <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.faqs.org/rfcs/rfc1123.html">RFC 1123</a>. Default is current time.
3271 This can be used to send a 'Last-Modified' header - see <code><a href="#handle-if-modified-since">HANDLE-IF-MODIFIED-SINCE</a></code>.
3272 </clix:description></blockquote></p>
3274 <p xmlns=""><a class="none" name="url-encode"></a>
3275 [Function]
3276 <br><b>url-encode</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">string
3277 <tt>&amp;optional
3278 </tt> external-format
3279 </clix:lambda-list></i>
3280 =&gt;
3281 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">string
3282 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3283 URL-encodes a string using the external format <code><i>external-format</i></code>. The default for <code><i>external-format</i></code> is the value of <code><a href="#*hunchentoot-default-external-format*">*HUNCHENTOOT-DEFAULT-EXTERNAL-FORMAT*</a></code>.
3284 </clix:description></blockquote></p>
3286 <p xmlns=""><a class="none" name="url-decode"></a>
3287 [Function]
3288 <br><b>url-decode</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">string
3289 <tt>&amp;optional
3290 </tt> external-format
3291 </clix:lambda-list></i>
3292 =&gt;
3293 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">string
3294 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3295 Decodes a URL-encoded string which is assumed to
3296 be encoded using the external
3297 format <code><i>external-format</i></code>, i.e. this is the inverse
3298 of <code><a href="#url-encode">URL-ENCODE</a></code>. It is assumed that you'll rarely
3299 need this function, if ever. But just in case - here it is. The
3300 default for <code><i>external-format</i></code> is the value
3301 of <code><a href="#*hunchentoot-default-external-format*">*HUNCHENTOOT-DEFAULT-EXTERNAL-FORMAT*</a></code>.
3302 </clix:description></blockquote></p>
3304 <p xmlns=""><a class="none" name="escape-for-html"></a>
3305 [Function]
3306 <br><b>escape-for-html</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">string
3307 </clix:lambda-list></i>
3308 =&gt;
3309 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">result
3310 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3311 Escapes the characters #\&lt;, #\&gt;, #\', #\", and #\&amp; for HTML output.
3312 </clix:description></blockquote></p>
3314 <p xmlns=""><a class="none" name="http-token-p"></a>
3315 [Function]
3316 <br><b>http-token-p</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">object</clix:lambda-list></i>
3317 =&gt;
3318 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">generalized-boolean</clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3319 This function tests whether <code><i>object</i></code> is a
3320 non-empty string which is a <em xmlns="http://www.w3.org/1999/xhtml">token</em> according
3321 to <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.faqs.org/rfcs/rfc2068.html">RFC
3322 2068</a> (i.e. whether it may be used for, say, cookie names).
3323 </clix:description></blockquote></p>
3325 <p xmlns=""><a class="none" name="mime-type"></a>
3326 [Function]
3327 <br><b>mime-type</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">pathspec
3328 </clix:lambda-list></i>
3329 =&gt;
3330 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">result
3331 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3332 Given a pathname designator <code><i>pathspec</i></code> returns the <a xmlns="http://www.w3.org/1999/xhtml" href="http://en.wikipedia.org/wiki/Internet_media_type">MIME type</a>
3333 (as a string) corresponding to the suffix of the file denoted by
3334 <code><i>pathspec</i></code> (or <code xmlns="http://www.w3.org/1999/xhtml">NIL</code>).
3335 </clix:description></blockquote></p>
3337 <p xmlns=""><a class="none" name="within-request-p"></a>
3338 [Function]
3339 <br><b>within-request-p</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">
3340 </clix:lambda-list></i>
3341 =&gt;
3342 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">generalized-boolean
3343 </clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3344 Returns true if in the context of a request. Otherwise, <code xmlns="http://www.w3.org/1999/xhtml">NIL</code>.
3345 </clix:description></blockquote></p>
3347 <p xmlns=""><a class="none" name="*tmp-directory*"></a>
3348 [Special variable]
3349 <br><b>*tmp-directory*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3350 This should be a pathname denoting a directory where temporary
3351 files can be stored. It is used for <a xmlns="http://www.w3.org/1999/xhtml" href="#upload">file
3352 uploads</a>.
3353 </clix:description></blockquote></p>
3355 <p xmlns=""><a class="none" name="*header-stream*"></a>
3356 [Special variable]
3357 <br><b>*header-stream*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3358 If this variable is not <code xmlns="http://www.w3.org/1999/xhtml">NIL</code>, it should be bound to a stream to
3359 which incoming and outgoing headers will be written for debugging
3360 purposes.
3361 </clix:description></blockquote></p>
3364 <p xmlns=""><a class="none" name="*cleanup-function*"></a>
3365 [Special variable]
3366 <br><b>*cleanup-function*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3367 A designator for a function without arguments which is called on a
3368 regular basis if <code><a href="#*cleanup-interval*">*CLEANUP-INTERVAL*</a></code> is not <code xmlns="http://www.w3.org/1999/xhtml">NIL</code>. The initial value is
3369 the name of a function which invokes a garbage collection on 32-bit
3370 versions of LispWorks.
3371 <p xmlns="http://www.w3.org/1999/xhtml">
3372 This variable is only available on LispWorks.
3373 </p>
3374 </clix:description></blockquote></p>
3376 <p xmlns=""><a class="none" name="*cleanup-interval*"></a>
3377 [Special variable]
3378 <br><b>*cleanup-interval*</b><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3379 Should be <code xmlns="http://www.w3.org/1999/xhtml">NIL</code> or a positive integer. The system calls
3380 <code><a href="#*cleanup-function*">*CLEANUP-FUNCTION*</a></code>
3381 whenever <code><a href="#*cleanup-interval*">*CLEANUP-INTERVAL*</a></code> new worker threads
3382 (counted globally across all acceptors) have been created unless the
3383 value is <code xmlns="http://www.w3.org/1999/xhtml">NIL</code>. The initial value is 100.
3384 <p xmlns="http://www.w3.org/1999/xhtml">
3385 This variable is only available on LispWorks.
3386 </p>
3387 </clix:description></blockquote></p>
3391 <h3 xmlns=""><a class="none" name="testing">Testing</a></h3>
3392 Hunchentoot comes with a test script which verifies that the
3393 example web server responds as expected. This test script uses the
3394 <a href="http://weitz.de/drakma/">Drakma</a> HTTP client library
3395 and thus shares a significant amount of its base code with
3396 Hunchentoot itself. Still, running the test script is a useful
3397 confidence test, and it is also possible to run the script across
3398 machines in order to verify a new Hunchentoot (or, for that matter
3399 Drakma) port.
3401 To run the confidence test, <a href="#teen-age">start
3402 the example web server</a>. Then, in your Lisp
3403 listener, type
3404 <pre>(<a class="noborder" href="hunchentoot-test:test-hunchentoot">hunchentoot-test:test-hunchentoot</a> "http://localhost:4242")</pre>
3405 You will see some diagnostic output and a summary line that
3406 reports whether any tests have failed. (You can also use the
3407 example certificate and key files in the test directory and
3408 start and test an https server instead.)
3409 </p>
3411 <p xmlns=""><a class="none" name="hunchentoot-test:test-hunchentoot"></a>
3412 [Function]
3413 <br><b>hunchentoot-test:test-hunchentoot</b> <i><clix:lambda-list xmlns:clix="http://bknr.net/clixdoc">base-url <tt>&amp;key</tt></clix:lambda-list></i>
3414 =&gt;
3415 <i><clix:returns xmlns:clix="http://bknr.net/clixdoc">|</clix:returns></i><blockquote><clix:description xmlns:clix="http://bknr.net/clixdoc">
3416 Runs the built-in confidence
3417 test. <code><i>base-url</i></code> is the base URL to use
3418 for testing, it should not have a trailing slash. The keyword
3419 arguments accepted are for future extension and should not
3420 currently be used.
3421 <p xmlns="http://www.w3.org/1999/xhtml">
3422 The script expects the Hunchentoot example test server to be
3423 running at the given <code xmlns=""><i>base-url</i></code> and
3424 retrieves various pages from that server, expecting certain
3425 responses.
3426 </p>
3427 </clix:description></blockquote></p>
3430 <h3 xmlns=""><a class="none" name="debugging">Debugging</a></h3>
3431 By default, Hunchentoot intercepts all errors that occur while
3432 executing request handlers, logs them to the log file and displays
3433 a static error page to the user. While developing applications,
3434 you may want to change that behavior so that the debugger is
3435 invoked when an error occurs. You can set
3436 the <code xmlns=""><a href="#*catch-errors-p*">*CATCH-ERRORS-P*</a></code> to <code>NIL</code> to
3437 make that happen. Alternatively, you may want to have Hunchentoot
3438 display detailed error information in the error response page.
3439 You can set the <code xmlns=""><a href="#*show-lisp-errors-p*">*SHOW-LISP-ERRORS-P*</a></code> to a
3440 true value to make that happen. If you don't want to see Lisp
3441 backtraces in these error pages, you can
3442 set <code xmlns=""><a href="#*show-lisp-backtraces-p*">*SHOW-LISP-BACKTRACES-P*</a></code>
3443 to <code>NIL</code>.
3446 <h3 xmlns=""><a class="none" name="history">History</a></h3>
3448 Hunchentoot's predecessor <a href="http://weitz.de/tbnl/">TBNL</a>
3449 (which is short for "To Be Named Later") grew over the years as a
3450 toolkit that I used for various commercial and private
3451 projects. In August 2003, Daniel Barlow started
3452 a <a href="http://article.gmane.org/gmane.lisp.web/148">review of
3453 web APIs</a> on
3454 the <a href="http://www.red-bean.com/lispweb/">lispweb</a> mailing
3455 list and
3456 I <a href="http://article.gmane.org/gmane.lisp.web/153">described</a>
3457 the API of my hitherto-unreleased bunch of code (and christened it
3458 "TBNL").
3460 It turned out that
3461 <a href="http://www.jeffcaldwell.com/">Jeff Caldwell</a> had
3462 worked on something similar so he emailed me and proposed to
3463 join our efforts. As I had no immediate plans to release my code
3464 (which was poorly organized, undocumented, and mostly
3465 CMUCL-specific), I gave it to Jeff and he worked towards a
3466 release. He added docstrings, refactored, added some stuff, and
3467 based it on KMRCL to make it portable across several Lisp
3468 implementations.
3469 </p>
3471 Unfortunately, Jeff is at least as busy as I am so he didn't
3472 find the time to finish a full release. But in spring 2004 I
3473 needed a documented version of the code for a client of mine who
3474 thought it would be good if the toolkit were publicly available
3475 under an open source license. So I took Jeff's code, refactored
3476 again (to sync with the changes I had done in the meantime), and
3477 added documentation. This resulted in TBNL 0.1.0 (which
3478 initially required mod_lisp as its front-end).
3479 </p>
3481 In March 2005, Bob Hutchinson sent patches which enabled TBNL to
3482 use other front-ends than mod_lisp. This made me aware that
3483 TBNL was already <em>almost</em> a full web server, so
3484 eventually I wrote Hunchentoot which <em>was</em> a full web
3485 server, implemented as a wrapper around TBNL. Hunchentoot 0.1.0
3486 was released at the end of 2005 and was originally
3487 LispWorks-only.
3488 </p>
3490 Hunchentoot 0.4.0, released in October 2006, was the first
3491 release which also worked with other Common Lisp
3492 implementations. It is a major rewrite and also incorporates
3493 most of TBNL and replaces it completely.
3494 </p>
3496 Hunchentoot 1.0.0, released in February 2009, is again a major
3497 rewrite and should be considered work in progress. It moved to
3498 using
3499 the <a href="http://common-lisp.net/project/usocket/">usocket</a>
3500 and <a href="http://common-lisp.net/project/bordeaux-threads/">Bordeaux
3501 Threads</a> libraries for non-LispWorks Lisps, thereby removing most of
3502 the platform dependent code. Threading behaviour was made
3503 controllable through the introduction of
3504 taskmasters. <a href="http://www.cliki.net/mod_lisp">mod_lisp</a>
3505 support and several other things were removed in this release to
3506 simplify the code base (and partly due to the lack of interest).
3507 Several architectural changes (lots of them not
3508 backwards-compatible) were made to ease customization of
3509 Hunchentoot's behaviour. A significant part of the 1.0.0
3510 redesign was done
3511 by <a href="http://netzhansa.blogspot.com/">Hans Hübner</a>.
3512 </p>
3515 <h3 xmlns=""><a class="none" name="index">Symbol index</a></h3>
3517 Here are all exported symbols of the <code>HUNCHENTOOT</code>
3518 package in alphabetical order linked to their corresponding
3519 documentation entries:
3521 <ul xmlns="">
3522 <li>
3523 <code><a href="#*acceptor*">*acceptor*</a></code><span class="entry-type">Special variable</span>
3524 </li>
3525 <li>
3526 <code><a href="#*catch-errors-p*">*catch-errors-p*</a></code><span class="entry-type">Special variable</span>
3527 </li>
3528 <li>
3529 <code><a href="#*cleanup-function*">*cleanup-function*</a></code><span class="entry-type">Special variable</span>
3530 </li>
3531 <li>
3532 <code><a href="#*cleanup-interval*">*cleanup-interval*</a></code><span class="entry-type">Special variable</span>
3533 </li>
3534 <li>
3535 <code><a href="#*content-types-for-url-rewrite*">*content-types-for-url-rewrite*</a></code><span class="entry-type">Special variable</span>
3536 </li>
3537 <li>
3538 <code><a href="#*default-connection-timeout*">*default-connection-timeout*</a></code><span class="entry-type">Special variable</span>
3539 </li>
3540 <li>
3541 <code><a href="#*default-content-type*">*default-content-type*</a></code><span class="entry-type">Special variable</span>
3542 </li>
3543 <li>
3544 <code><a href="#*dispatch-table*">*dispatch-table*</a></code><span class="entry-type">Special variable</span>
3545 </li>
3546 <li>
3547 <code><a href="#*file-upload-hook*">*file-upload-hook*</a></code><span class="entry-type">Special variable</span>
3548 </li>
3549 <li>
3550 <code><a href="#*header-stream*">*header-stream*</a></code><span class="entry-type">Special variable</span>
3551 </li>
3552 <li>
3553 <code><a href="#*hunchentoot-default-external-format*">*hunchentoot-default-external-format*</a></code><span class="entry-type">Special variable</span>
3554 </li>
3555 <li>
3556 <code><a href="#*lisp-errors-log-level*">*lisp-errors-log-level*</a></code><span class="entry-type">Special variable</span>
3557 </li>
3558 <li>
3559 <code><a href="#*lisp-warnings-log-level*">*lisp-warnings-log-level*</a></code><span class="entry-type">Special variable</span>
3560 </li>
3561 <li>
3562 <code><a href="#*log-lisp-backtraces-p*">*log-lisp-backtraces-p*</a></code><span class="entry-type">Special variable</span>
3563 </li>
3564 <li>
3565 <code><a href="#*log-lisp-errors-p*">*log-lisp-errors-p*</a></code><span class="entry-type">Special variable</span>
3566 </li>
3567 <li>
3568 <code><a href="#*log-lisp-warnings-p*">*log-lisp-warnings-p*</a></code><span class="entry-type">Special variable</span>
3569 </li>
3570 <li>
3571 <code><a href="#*methods-for-post-parameters*">*methods-for-post-parameters*</a></code><span class="entry-type">Special variable</span>
3572 </li>
3573 <li>
3574 <code><a href="#*reply*">*reply*</a></code><span class="entry-type">Special variable</span>
3575 </li>
3576 <li>
3577 <code><a href="#*request*">*request*</a></code><span class="entry-type">Special variable</span>
3578 </li>
3579 <li>
3580 <code><a href="#*rewrite-for-session-urls*">*rewrite-for-session-urls*</a></code><span class="entry-type">Special variable</span>
3581 </li>
3582 <li>
3583 <code><a href="#*session*">*session*</a></code><span class="entry-type">Special variable</span>
3584 </li>
3585 <li>
3586 <code><a href="#*session-gc-frequency*">*session-gc-frequency*</a></code><span class="entry-type">Special variable</span>
3587 </li>
3588 <li>
3589 <code><a href="#*session-max-time*">*session-max-time*</a></code><span class="entry-type">Special variable</span>
3590 </li>
3591 <li>
3592 <code><a href="#*session-secret*">*session-secret*</a></code><span class="entry-type">Special variable</span>
3593 </li>
3594 <li>
3595 <code><a href="#*show-lisp-backtraces-p*">*show-lisp-backtraces-p*</a></code><span class="entry-type">Special variable</span>
3596 </li>
3597 <li>
3598 <code><a href="#*show-lisp-errors-p*">*show-lisp-errors-p*</a></code><span class="entry-type">Special variable</span>
3599 </li>
3600 <li>
3601 <code><a href="#*tmp-directory*">*tmp-directory*</a></code><span class="entry-type">Special variable</span>
3602 </li>
3603 <li>
3604 <code><a href="#*use-remote-addr-for-sessions*">*use-remote-addr-for-sessions*</a></code><span class="entry-type">Special variable</span>
3605 </li>
3606 <li>
3607 <code><a href="#*use-user-agent-for-sessions*">*use-user-agent-for-sessions*</a></code><span class="entry-type">Special variable</span>
3608 </li>
3609 <li>
3610 <code><a href="#+http-accepted+">+http-accepted+</a></code><span class="entry-type">Constant</span>
3611 </li>
3612 <li>
3613 <code><a href="#+http-authorization-required+">+http-authorization-required+</a></code><span class="entry-type">Constant</span>
3614 </li>
3615 <li>
3616 <code><a href="#+http-bad-gateway+">+http-bad-gateway+</a></code><span class="entry-type">Constant</span>
3617 </li>
3618 <li>
3619 <code><a href="#+http-bad-request+">+http-bad-request+</a></code><span class="entry-type">Constant</span>
3620 </li>
3621 <li>
3622 <code><a href="#+http-conflict+">+http-conflict+</a></code><span class="entry-type">Constant</span>
3623 </li>
3624 <li>
3625 <code><a href="#+http-continue+">+http-continue+</a></code><span class="entry-type">Constant</span>
3626 </li>
3627 <li>
3628 <code><a href="#+http-created+">+http-created+</a></code><span class="entry-type">Constant</span>
3629 </li>
3630 <li>
3631 <code><a href="#+http-expectation-failed+">+http-expectation-failed+</a></code><span class="entry-type">Constant</span>
3632 </li>
3633 <li>
3634 <code><a href="#+http-failed-dependency+">+http-failed-dependency+</a></code><span class="entry-type">Constant</span>
3635 </li>
3636 <li>
3637 <code><a href="#+http-forbidden+">+http-forbidden+</a></code><span class="entry-type">Constant</span>
3638 </li>
3639 <li>
3640 <code><a href="#+http-gateway-time-out+">+http-gateway-time-out+</a></code><span class="entry-type">Constant</span>
3641 </li>
3642 <li>
3643 <code><a href="#+http-gone+">+http-gone+</a></code><span class="entry-type">Constant</span>
3644 </li>
3645 <li>
3646 <code><a href="#+http-internal-server-error+">+http-internal-server-error+</a></code><span class="entry-type">Constant</span>
3647 </li>
3648 <li>
3649 <code><a href="#+http-length-required+">+http-length-required+</a></code><span class="entry-type">Constant</span>
3650 </li>
3651 <li>
3652 <code><a href="#+http-method-not-allowed+">+http-method-not-allowed+</a></code><span class="entry-type">Constant</span>
3653 </li>
3654 <li>
3655 <code><a href="#+http-moved-permanently+">+http-moved-permanently+</a></code><span class="entry-type">Constant</span>
3656 </li>
3657 <li>
3658 <code><a href="#+http-moved-temporarily+">+http-moved-temporarily+</a></code><span class="entry-type">Constant</span>
3659 </li>
3660 <li>
3661 <code><a href="#+http-multi-status+">+http-multi-status+</a></code><span class="entry-type">Constant</span>
3662 </li>
3663 <li>
3664 <code><a href="#+http-multiple-choices+">+http-multiple-choices+</a></code><span class="entry-type">Constant</span>
3665 </li>
3666 <li>
3667 <code><a href="#+http-no-content+">+http-no-content+</a></code><span class="entry-type">Constant</span>
3668 </li>
3669 <li>
3670 <code><a href="#+http-non-authoritative-information+">+http-non-authoritative-information+</a></code><span class="entry-type">Constant</span>
3671 </li>
3672 <li>
3673 <code><a href="#+http-not-acceptable+">+http-not-acceptable+</a></code><span class="entry-type">Constant</span>
3674 </li>
3675 <li>
3676 <code><a href="#+http-not-found+">+http-not-found+</a></code><span class="entry-type">Constant</span>
3677 </li>
3678 <li>
3679 <code><a href="#+http-not-implemented+">+http-not-implemented+</a></code><span class="entry-type">Constant</span>
3680 </li>
3681 <li>
3682 <code><a href="#+http-not-modified+">+http-not-modified+</a></code><span class="entry-type">Constant</span>
3683 </li>
3684 <li>
3685 <code><a href="#+http-ok+">+http-ok+</a></code><span class="entry-type">Constant</span>
3686 </li>
3687 <li>
3688 <code><a href="#+http-partial-content+">+http-partial-content+</a></code><span class="entry-type">Constant</span>
3689 </li>
3690 <li>
3691 <code><a href="#+http-payment-required+">+http-payment-required+</a></code><span class="entry-type">Constant</span>
3692 </li>
3693 <li>
3694 <code><a href="#+http-precondition-failed+">+http-precondition-failed+</a></code><span class="entry-type">Constant</span>
3695 </li>
3696 <li>
3697 <code><a href="#+http-proxy-authentication-required+">+http-proxy-authentication-required+</a></code><span class="entry-type">Constant</span>
3698 </li>
3699 <li>
3700 <code><a href="#+http-request-entity-too-large+">+http-request-entity-too-large+</a></code><span class="entry-type">Constant</span>
3701 </li>
3702 <li>
3703 <code><a href="#+http-request-time-out+">+http-request-time-out+</a></code><span class="entry-type">Constant</span>
3704 </li>
3705 <li>
3706 <code><a href="#+http-request-uri-too-large+">+http-request-uri-too-large+</a></code><span class="entry-type">Constant</span>
3707 </li>
3708 <li>
3709 <code><a href="#+http-requested-range-not-satisfiable+">+http-requested-range-not-satisfiable+</a></code><span class="entry-type">Constant</span>
3710 </li>
3711 <li>
3712 <code><a href="#+http-reset-content+">+http-reset-content+</a></code><span class="entry-type">Constant</span>
3713 </li>
3714 <li>
3715 <code><a href="#+http-see-other+">+http-see-other+</a></code><span class="entry-type">Constant</span>
3716 </li>
3717 <li>
3718 <code><a href="#+http-service-unavailable+">+http-service-unavailable+</a></code><span class="entry-type">Constant</span>
3719 </li>
3720 <li>
3721 <code><a href="#+http-switching-protocols+">+http-switching-protocols+</a></code><span class="entry-type">Constant</span>
3722 </li>
3723 <li>
3724 <code><a href="#+http-temporary-redirect+">+http-temporary-redirect+</a></code><span class="entry-type">Constant</span>
3725 </li>
3726 <li>
3727 <code><a href="#+http-unsupported-media-type+">+http-unsupported-media-type+</a></code><span class="entry-type">Constant</span>
3728 </li>
3729 <li>
3730 <code><a href="#+http-use-proxy+">+http-use-proxy+</a></code><span class="entry-type">Constant</span>
3731 </li>
3732 <li>
3733 <code><a href="#+http-version-not-supported+">+http-version-not-supported+</a></code><span class="entry-type">Constant</span>
3734 </li>
3735 <li>
3736 <code><a href="#abort-request-handler">abort-request-handler</a></code><span class="entry-type">Function</span>
3737 </li>
3738 <li>
3739 <code><a href="#accept-connections">accept-connections</a></code><span class="entry-type">Generic function</span>
3740 </li>
3741 <li>
3742 <code><a href="#acceptor">acceptor</a></code><span class="entry-type">Standard class</span>
3743 </li>
3744 <li>
3745 <code><a href="#acceptor-access-log-destination">acceptor-access-log-destination</a></code><span class="entry-type">Generic accessor</span>
3746 </li>
3747 <li>
3748 <code><a href="#acceptor-address">acceptor-address</a></code><span class="entry-type">Generic reader</span>
3749 </li>
3750 <li>
3751 <code><a href="#acceptor-dispatch-request">acceptor-dispatch-request</a></code><span class="entry-type">Generic function</span>
3752 </li>
3753 <li>
3754 <code><a href="#acceptor-document-root">acceptor-document-root</a></code><span class="entry-type">Generic accessor</span>
3755 </li>
3756 <li>
3757 <code><a href="#acceptor-error-template-directory">acceptor-error-template-directory</a></code><span class="entry-type">Generic accessor</span>
3758 </li>
3759 <li>
3760 <code><a href="#acceptor-input-chunking-p">acceptor-input-chunking-p</a></code><span class="entry-type">Generic accessor</span>
3761 </li>
3762 <li>
3763 <code><a href="#acceptor-listen-backlog">acceptor-listen-backlog</a></code><span class="entry-type">Generic function</span>
3764 </li>
3765 <li>
3766 <code><a href="#acceptor-log-access">acceptor-log-access</a></code><span class="entry-type">Generic function</span>
3767 </li>
3768 <li>
3769 <code><a href="#acceptor-log-message">acceptor-log-message</a></code><span class="entry-type">Generic function</span>
3770 </li>
3771 <li>
3772 <code><a href="#acceptor-message-log-destination">acceptor-message-log-destination</a></code><span class="entry-type">Generic accessor</span>
3773 </li>
3774 <li>
3775 <code><a href="#acceptor-name">acceptor-name</a></code><span class="entry-type">Generic accessor</span>
3776 </li>
3777 <li>
3778 <code><a href="#acceptor-output-chunking-p">acceptor-output-chunking-p</a></code><span class="entry-type">Generic accessor</span>
3779 </li>
3780 <li>
3781 <code><a href="#acceptor-persistent-connections-p">acceptor-persistent-connections-p</a></code><span class="entry-type">Generic accessor</span>
3782 </li>
3783 <li>
3784 <code><a href="#acceptor-port">acceptor-port</a></code><span class="entry-type">Generic reader</span>
3785 </li>
3786 <li>
3787 <code><a href="#acceptor-read-timeout">acceptor-read-timeout</a></code><span class="entry-type">Generic reader</span>
3788 </li>
3789 <li>
3790 <code><a href="#acceptor-remove-session">acceptor-remove-session</a></code><span class="entry-type">Generic function</span>
3791 </li>
3792 <li>
3793 <code><a href="#acceptor-reply-class">acceptor-reply-class</a></code><span class="entry-type">Generic accessor</span>
3794 </li>
3795 <li>
3796 <code><a href="#acceptor-request-class">acceptor-request-class</a></code><span class="entry-type">Generic accessor</span>
3797 </li>
3798 <li>
3799 <code><a href="#acceptor-ssl-certificate-file">acceptor-ssl-certificate-file</a></code><span class="entry-type">Generic reader</span>
3800 </li>
3801 <li>
3802 <code><a href="#acceptor-ssl-p">acceptor-ssl-p</a></code><span class="entry-type">Generic function</span>
3803 </li>
3804 <li>
3805 <code><a href="#acceptor-ssl-privatekey-file">acceptor-ssl-privatekey-file</a></code><span class="entry-type">Generic reader</span>
3806 </li>
3807 <li>
3808 <code><a href="#acceptor-ssl-privatekey-password">acceptor-ssl-privatekey-password</a></code><span class="entry-type">Generic reader</span>
3809 </li>
3810 <li>
3811 <code><a href="#acceptor-status-message">acceptor-status-message</a></code><span class="entry-type">Generic function</span>
3812 </li>
3813 <li>
3814 <code><a href="#acceptor-write-timeout">acceptor-write-timeout</a></code><span class="entry-type">Generic reader</span>
3815 </li>
3816 <li>
3817 <code><a href="#authorization">authorization</a></code><span class="entry-type">Function</span>
3818 </li>
3819 <li>
3820 <code><a href="#aux-request-value">aux-request-value</a></code><span class="entry-type">Accessor</span>
3821 </li>
3822 <li>
3823 <code><a href="#content-length">content-length</a></code><span class="entry-type">Generic reader</span>
3824 </li>
3825 <li>
3826 <code><a href="#content-length*">content-length*</a></code><span class="entry-type">Accessor</span>
3827 </li>
3828 <li>
3829 <code><a href="#content-type">content-type</a></code><span class="entry-type">Generic reader</span>
3830 </li>
3831 <li>
3832 <code><a href="#content-type*">content-type*</a></code><span class="entry-type">Accessor</span>
3833 </li>
3834 <li>
3835 <code><a href="#cookie-in">cookie-in</a></code><span class="entry-type">Function</span>
3836 </li>
3837 <li>
3838 <code><a href="#cookie-out">cookie-out</a></code><span class="entry-type">Function</span>
3839 </li>
3840 <li>
3841 <code><a href="#cookies-in">cookies-in</a></code><span class="entry-type">Generic reader</span>
3842 </li>
3843 <li>
3844 <code><a href="#cookies-in*">cookies-in*</a></code><span class="entry-type">Function</span>
3845 </li>
3846 <li>
3847 <code><a href="#cookies-out">cookies-out</a></code><span class="entry-type">Generic accessor</span>
3848 </li>
3849 <li>
3850 <code><a href="#cookies-out*">cookies-out*</a></code><span class="entry-type">Accessor</span>
3851 </li>
3852 <li>
3853 <code><a href="#create-folder-dispatcher-and-handler">create-folder-dispatcher-and-handler</a></code><span class="entry-type">Function</span>
3854 </li>
3855 <li>
3856 <code><a href="#create-prefix-dispatcher">create-prefix-dispatcher</a></code><span class="entry-type">Function</span>
3857 </li>
3858 <li>
3859 <code><a href="#create-regex-dispatcher">create-regex-dispatcher</a></code><span class="entry-type">Function</span>
3860 </li>
3861 <li>
3862 <code><a href="#create-request-handler-thread">create-request-handler-thread</a></code><span class="entry-type">Generic function</span>
3863 </li>
3864 <li>
3865 <code><a href="#create-static-file-dispatcher-and-handler">create-static-file-dispatcher-and-handler</a></code><span class="entry-type">Function</span>
3866 </li>
3867 <li>
3868 <code><a href="#define-easy-handler">define-easy-handler</a></code><span class="entry-type">Macro</span>
3869 </li>
3870 <li>
3871 <code><a href="#delete-aux-request-value">delete-aux-request-value</a></code><span class="entry-type">Function</span>
3872 </li>
3873 <li>
3874 <code><a href="#delete-session-value">delete-session-value</a></code><span class="entry-type">Function</span>
3875 </li>
3876 <li>
3877 <code><a href="#detach-socket">detach-socket</a></code><span class="entry-type">Generic function</span>
3878 </li>
3879 <li>
3880 <code><a href="#dispatch-easy-handlers">dispatch-easy-handlers</a></code><span class="entry-type">Function</span>
3881 </li>
3882 <li>
3883 <code><a href="#easy-acceptor">easy-acceptor</a></code><span class="entry-type">Standard class</span>
3884 </li>
3885 <li>
3886 <code><a href="#easy-ssl-acceptor">easy-ssl-acceptor</a></code><span class="entry-type">Standard class</span>
3887 </li>
3888 <li>
3889 <code><a href="#escape-for-html">escape-for-html</a></code><span class="entry-type">Function</span>
3890 </li>
3891 <li>
3892 <code><a href="#execute-acceptor">execute-acceptor</a></code><span class="entry-type">Generic function</span>
3893 </li>
3894 <li>
3895 <code><a href="#get-parameter">get-parameter</a></code><span class="entry-type">Function</span>
3896 </li>
3897 <li>
3898 <code><a href="#get-parameters">get-parameters</a></code><span class="entry-type">Generic reader</span>
3899 </li>
3900 <li>
3901 <code><a href="#get-parameters*">get-parameters*</a></code><span class="entry-type">Function</span>
3902 </li>
3903 <li>
3904 <code><a href="#handle-if-modified-since">handle-if-modified-since</a></code><span class="entry-type">Function</span>
3905 </li>
3906 <li>
3907 <code><a href="#handle-incoming-connection">handle-incoming-connection</a></code><span class="entry-type">Generic function</span>
3908 </li>
3909 <li>
3910 <code><a href="#handle-request">handle-request</a></code><span class="entry-type">Generic function</span>
3911 </li>
3912 <li>
3913 <code><a href="#handle-static-file">handle-static-file</a></code><span class="entry-type">Function</span>
3914 </li>
3915 <li>
3916 <code><a href="#header-in">header-in</a></code><span class="entry-type">Generic reader</span>
3917 </li>
3918 <li>
3919 <code><a href="#header-in*">header-in*</a></code><span class="entry-type">Function</span>
3920 </li>
3921 <li>
3922 <code><a href="#header-out">header-out</a></code><span class="entry-type">Accessor</span>
3923 </li>
3924 <li>
3925 <code><a href="#headers-in">headers-in</a></code><span class="entry-type">Generic reader</span>
3926 </li>
3927 <li>
3928 <code><a href="#headers-in*">headers-in*</a></code><span class="entry-type">Function</span>
3929 </li>
3930 <li>
3931 <code><a href="#headers-out">headers-out</a></code><span class="entry-type">Generic reader</span>
3932 </li>
3933 <li>
3934 <code><a href="#headers-out*">headers-out*</a></code><span class="entry-type">Function</span>
3935 </li>
3936 <li>
3937 <code><a href="#host">host</a></code><span class="entry-type">Function</span>
3938 </li>
3939 <li>
3940 <code><a href="#http-token-p">http-token-p</a></code><span class="entry-type">Function</span>
3941 </li>
3942 <li>
3943 <code><a href="#hunchentoot-condition">hunchentoot-condition</a></code><span class="entry-type">Condition type</span>
3944 </li>
3945 <li>
3946 <code><a href="#hunchentoot-error">hunchentoot-error</a></code><span class="entry-type">Condition type</span>
3947 </li>
3948 <li>
3949 <code><a href="#hunchentoot-test:test-hunchentoot">hunchentoot-test:test-hunchentoot</a></code><span class="entry-type">Function</span>
3950 </li>
3951 <li>
3952 <code><a href="#hunchentoot-warning">hunchentoot-warning</a></code><span class="entry-type">Condition type</span>
3953 </li>
3954 <li>
3955 <code><a href="#initialize-connection-stream">initialize-connection-stream</a></code><span class="entry-type">Generic function</span>
3956 </li>
3957 <li>
3958 <code><a href="#local-addr">local-addr</a></code><span class="entry-type">Generic reader</span>
3959 </li>
3960 <li>
3961 <code><a href="#local-addr*">local-addr*</a></code><span class="entry-type">Function</span>
3962 </li>
3963 <li>
3964 <code><a href="#local-port">local-port</a></code><span class="entry-type">Generic reader</span>
3965 </li>
3966 <li>
3967 <code><a href="#local-port*">local-port*</a></code><span class="entry-type">Function</span>
3968 </li>
3969 <li>
3970 <code><a href="#log-message*">log-message*</a></code><span class="entry-type">Function</span>
3971 </li>
3972 <li>
3973 <code><a href="#maybe-invoke-debugger">maybe-invoke-debugger</a></code><span class="entry-type">Generic function</span>
3974 </li>
3975 <li>
3976 <code><a href="#mime-type">mime-type</a></code><span class="entry-type">Function</span>
3977 </li>
3978 <li>
3979 <code><a href="#multi-threaded-taskmaster">multi-threaded-taskmaster</a></code><span class="entry-type">Standard class</span>
3980 </li>
3981 <li>
3982 <code><a href="#next-session-id">next-session-id</a></code><span class="entry-type">Generic function</span>
3983 </li>
3984 <li>
3985 <code><a href="#no-cache">no-cache</a></code><span class="entry-type">Function</span>
3986 </li>
3987 <li>
3988 <code><a href="#one-thread-per-connection-taskmaster">one-thread-per-connection-taskmaster</a></code><span class="entry-type">Standard class</span>
3989 </li>
3990 <li>
3991 <code><a href="#parameter">parameter</a></code><span class="entry-type">Function</span>
3992 </li>
3993 <li>
3994 <code><a href="#parameter-error">parameter-error</a></code><span class="entry-type">Condition type</span>
3995 </li>
3996 <li>
3997 <code><a href="#post-parameter">post-parameter</a></code><span class="entry-type">Function</span>
3998 </li>
3999 <li>
4000 <code><a href="#post-parameters">post-parameters</a></code><span class="entry-type">Generic reader</span>
4001 </li>
4002 <li>
4003 <code><a href="#post-parameters*">post-parameters*</a></code><span class="entry-type">Function</span>
4004 </li>
4005 <li>
4006 <code><a href="#process-connection">process-connection</a></code><span class="entry-type">Generic function</span>
4007 </li>
4008 <li>
4009 <code><a href="#process-request">process-request</a></code><span class="entry-type">Generic function</span>
4010 </li>
4011 <li>
4012 <code><a href="#query-string">query-string</a></code><span class="entry-type">Generic reader</span>
4013 </li>
4014 <li>
4015 <code><a href="#query-string*">query-string*</a></code><span class="entry-type">Function</span>
4016 </li>
4017 <li>
4018 <code><a href="#raw-post-data">raw-post-data</a></code><span class="entry-type">Function</span>
4019 </li>
4020 <li>
4021 <code><a href="#real-remote-addr">real-remote-addr</a></code><span class="entry-type">Function</span>
4022 </li>
4023 <li>
4024 <code><a href="#reason-phrase">reason-phrase</a></code><span class="entry-type">Function</span>
4025 </li>
4026 <li>
4027 <code><a href="#recompute-request-parameters">recompute-request-parameters</a></code><span class="entry-type">Function</span>
4028 </li>
4029 <li>
4030 <code><a href="#redirect">redirect</a></code><span class="entry-type">Function</span>
4031 </li>
4032 <li>
4033 <code><a href="#referer">referer</a></code><span class="entry-type">Function</span>
4034 </li>
4035 <li>
4036 <code><a href="#regenerate-session-cookie-value">regenerate-session-cookie-value</a></code><span class="entry-type">Function</span>
4037 </li>
4038 <li>
4039 <code><a href="#remote-addr">remote-addr</a></code><span class="entry-type">Generic reader</span>
4040 </li>
4041 <li>
4042 <code><a href="#remote-addr*">remote-addr*</a></code><span class="entry-type">Function</span>
4043 </li>
4044 <li>
4045 <code><a href="#remote-port">remote-port</a></code><span class="entry-type">Generic reader</span>
4046 </li>
4047 <li>
4048 <code><a href="#remote-port*">remote-port*</a></code><span class="entry-type">Function</span>
4049 </li>
4050 <li>
4051 <code><a href="#remove-session">remove-session</a></code><span class="entry-type">Function</span>
4052 </li>
4053 <li>
4054 <code><a href="#reply">reply</a></code><span class="entry-type">Standard class</span>
4055 </li>
4056 <li>
4057 <code><a href="#reply-external-format">reply-external-format</a></code><span class="entry-type">Generic accessor</span>
4058 </li>
4059 <li>
4060 <code><a href="#reply-external-format*">reply-external-format*</a></code><span class="entry-type">Accessor</span>
4061 </li>
4062 <li>
4063 <code><a href="#request">request</a></code><span class="entry-type">Standard class</span>
4064 </li>
4065 <li>
4066 <code><a href="#request-acceptor">request-acceptor</a></code><span class="entry-type">Generic reader</span>
4067 </li>
4068 <li>
4069 <code><a href="#request-method">request-method</a></code><span class="entry-type">Generic reader</span>
4070 </li>
4071 <li>
4072 <code><a href="#request-method*">request-method*</a></code><span class="entry-type">Function</span>
4073 </li>
4074 <li>
4075 <code><a href="#request-uri">request-uri</a></code><span class="entry-type">Generic reader</span>
4076 </li>
4077 <li>
4078 <code><a href="#request-uri*">request-uri*</a></code><span class="entry-type">Function</span>
4079 </li>
4080 <li>
4081 <code><a href="#require-authorization">require-authorization</a></code><span class="entry-type">Function</span>
4082 </li>
4083 <li>
4084 <code><a href="#reset-connection-stream">reset-connection-stream</a></code><span class="entry-type">Generic function</span>
4085 </li>
4086 <li>
4087 <code><a href="#reset-session-secret">reset-session-secret</a></code><span class="entry-type">Function</span>
4088 </li>
4089 <li>
4090 <code><a href="#reset-sessions">reset-sessions</a></code><span class="entry-type">Function</span>
4091 </li>
4092 <li>
4093 <code><a href="#return-code">return-code</a></code><span class="entry-type">Generic accessor</span>
4094 </li>
4095 <li>
4096 <code><a href="#return-code*">return-code*</a></code><span class="entry-type">Accessor</span>
4097 </li>
4098 <li>
4099 <code><a href="#rfc-1123-date">rfc-1123-date</a></code><span class="entry-type">Function</span>
4100 </li>
4101 <li>
4102 <code><a href="#script-name">script-name</a></code><span class="entry-type">Generic reader</span>
4103 </li>
4104 <li>
4105 <code><a href="#script-name*">script-name*</a></code><span class="entry-type">Function</span>
4106 </li>
4107 <li>
4108 <code><a href="#send-headers">send-headers</a></code><span class="entry-type">Function</span>
4109 </li>
4110 <li>
4111 <code><a href="#server-protocol">server-protocol</a></code><span class="entry-type">Generic reader</span>
4112 </li>
4113 <li>
4114 <code><a href="#server-protocol*">server-protocol*</a></code><span class="entry-type">Function</span>
4115 </li>
4116 <li>
4117 <code><a href="#session">session</a></code><span class="entry-type">Standard class</span>
4118 </li>
4119 <li>
4120 <code><a href="#session-cookie-name">session-cookie-name</a></code><span class="entry-type">Generic function</span>
4121 </li>
4122 <li>
4123 <code><a href="#session-cookie-value">session-cookie-value</a></code><span class="entry-type">Generic function</span>
4124 </li>
4125 <li>
4126 <code><a href="#session-created">session-created</a></code><span class="entry-type">Generic function</span>
4127 </li>
4128 <li>
4129 <code><a href="#session-db">session-db</a></code><span class="entry-type">Generic accessor</span>
4130 </li>
4131 <li>
4132 <code><a href="#session-db-lock">session-db-lock</a></code><span class="entry-type">Generic function</span>
4133 </li>
4134 <li>
4135 <code><a href="#session-gc">session-gc</a></code><span class="entry-type">Function</span>
4136 </li>
4137 <li>
4138 <code><a href="#session-id">session-id</a></code><span class="entry-type">Generic function</span>
4139 </li>
4140 <li>
4141 <code><a href="#session-max-time">session-max-time</a></code><span class="entry-type">Generic accessor</span>
4142 </li>
4143 <li>
4144 <code><a href="#session-remote-addr">session-remote-addr</a></code><span class="entry-type">Generic function</span>
4145 </li>
4146 <li>
4147 <code><a href="#session-start">session-start</a></code><span class="entry-type">Generic function</span>
4148 </li>
4149 <li>
4150 <code><a href="#session-too-old-p">session-too-old-p</a></code><span class="entry-type">Function</span>
4151 </li>
4152 <li>
4153 <code><a href="#session-user-agent">session-user-agent</a></code><span class="entry-type">Generic function</span>
4154 </li>
4155 <li>
4156 <code><a href="#session-value">session-value</a></code><span class="entry-type">Accessor</span>
4157 </li>
4158 <li>
4159 <code><a href="#session-verify">session-verify</a></code><span class="entry-type">Generic function</span>
4160 </li>
4161 <li>
4162 <code><a href="#set-cookie">set-cookie</a></code><span class="entry-type">Function</span>
4163 </li>
4164 <li>
4165 <code><a href="#set-cookie*">set-cookie*</a></code><span class="entry-type">Function</span>
4166 </li>
4167 <li>
4168 <code><a href="#shutdown">shutdown</a></code><span class="entry-type">Generic function</span>
4169 </li>
4170 <li>
4171 <code><a href="#single-threaded-taskmaster">single-threaded-taskmaster</a></code><span class="entry-type">Standard class</span>
4172 </li>
4173 <li>
4174 <code><a href="#ssl-acceptor">ssl-acceptor</a></code><span class="entry-type">Standard class</span>
4175 </li>
4176 <li>
4177 <code><a href="#ssl-get-peer-certificate">ssl-get-peer-certificate</a></code><span class="entry-type">Function</span>
4178 </li>
4179 <li>
4180 <code><a href="#ssl-p">ssl-p</a></code><span class="entry-type">Function</span>
4181 </li>
4182 <li>
4183 <code><a href="#start">start</a></code><span class="entry-type">Generic function</span>
4184 </li>
4185 <li>
4186 <code><a href="#start-listening">start-listening</a></code><span class="entry-type">Generic function</span>
4187 </li>
4188 <li>
4189 <code><a href="#start-session">start-session</a></code><span class="entry-type">Function</span>
4190 </li>
4191 <li>
4192 <code><a href="#start-thread">start-thread</a></code><span class="entry-type">Generic function</span>
4193 </li>
4194 <li>
4195 <code><a href="#stop">stop</a></code><span class="entry-type">Generic function</span>
4196 </li>
4197 <li>
4198 <code><a href="#taskmaster">taskmaster</a></code><span class="entry-type">Standard class</span>
4199 </li>
4200 <li>
4201 <code><a href="#taskmaster-acceptor">taskmaster-acceptor</a></code><span class="entry-type">Generic accessor</span>
4202 </li>
4203 <li>
4204 <code><a href="#url-decode">url-decode</a></code><span class="entry-type">Function</span>
4205 </li>
4206 <li>
4207 <code><a href="#url-encode">url-encode</a></code><span class="entry-type">Function</span>
4208 </li>
4209 <li>
4210 <code><a href="#user-agent">user-agent</a></code><span class="entry-type">Function</span>
4211 </li>
4212 <li>
4213 <code><a href="#within-request-p">within-request-p</a></code><span class="entry-type">Function</span>
4214 </li>
4215 </ul>
4219 <h3 xmlns=""><a class="none" name="ack">Acknowledgements</a></h3>
4221 Thanks to Jeff Caldwell - TBNL would not have been released
4222 without his efforts. Thanks
4223 to <a href="http://www.cliki.net/Stefan%20Scholl">Stefan
4224 Scholl</a> and Travis Cross for various additions and fixes to
4225 TBNL, to <a href="http://www.foldr.org/~michaelw/">Michael
4226 Weber</a> for initial file upload code, and
4227 to <a href="http://www.ltn.lv/~jonis/">Janis Dzerins</a> for
4228 his <a href="http://common-lisp.net/project/rfc2388/">RFC 2388
4229 code</a>. Thanks to Bob Hutchison for his code for multiple
4230 front-ends (which made me realize that TBNL was already pretty
4231 close to a "real" web server) and the initial UTF-8 example.
4232 Thanks to <a href="http://netzhansa.blogspot.com/">Hans Hübner</a>
4233 for a lot of architectural and implementation enhancements for the
4234 1.0.0 release and also for transferring the documentation to sane
4235 XHTML. Thanks to John
4236 Foderaro's <a href="http://opensource.franz.com/aserve/index.html">AllegroServe</a>
4237 for inspiration. Thanks to <a href="http://www.htg1.de/">Uwe von
4238 Loh</a> for
4239 the <a href="http://www.htg1.de/hunchentoot/hunchentoot.html">Hunchentoot
4240 logo</a>.
4243 Hunchentoot originally used code
4244 from <a href="http://www.cliki.net/ACL-COMPAT">ACL-COMPAT</a>,
4245 specifically the chunking code from Jochen Schmidt. (This has been
4246 replaced by <a href="http://weitz.de/chunga/">Chunga</a>.) When I ported
4247 Hunchentoot to other Lisps than LispWorks, I stole code from
4248 ACL-COMPAT, <a href="http://www.cliki.net/kmrcl">KMRCL</a>,
4249 and <a href="http://www.cliki.net/trivial-sockets">trivial-sockets</a> for
4250 implementation-dependent stuff like sockets and MP. (This has been replaced by
4251 <a href="http://common-lisp.net/project/bordeaux-threads/">Bordeaux
4252 Threads</a>
4253 and <a href="http://common-lisp.net/project/usocket/">usocket</a>.)
4254 </p>
4256 Parts of this documentation were prepared
4257 with <a href="http://weitz.de/documentation-template/">DOCUMENTATION-TEMPLATE</a>,
4258 no animals were harmed.
4259 </p>
4262 <a href="http://weitz.de/index.html">BACK TO MY HOMEPAGE
4263 </a>
4264 </p>
4265 </body></html>