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