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