Common Lisp Package: HUNCHENTOOT

README:

FUNCTION

Public

ABORT-REQUEST-HANDLER (&OPTIONAL RESULT)

This function can be called by a request handler at any time to immediately abort handling the request. This works as if the handler had returned RESULT. See the source code of REDIRECT for an example.

AUTHORIZATION (&OPTIONAL (REQUEST *REQUEST*))

Returns as two values the user and password (if any) as encoded in the 'AUTHORIZATION' header. Returns NIL if there is no such header.

AUX-REQUEST-VALUE (SYMBOL &OPTIONAL (REQUEST *REQUEST*))

Returns the value associated with SYMBOL from the request object REQUEST (the default is the current request) if it exists. The second return value is true if such a value was found.

CLIENT-AS-STRING (SOCKET)

A helper function which returns the client's address and port as a string and tries to act robustly in the presence of network problems.

CONTENT-LENGTH* (&OPTIONAL (REPLY *REPLY*))

The outgoing 'Content-Length' http header of REPLY.

SETFCONTENT-LENGTH* (NEW-VALUE &OPTIONAL (REPLY *REPLY*))

Sets the outgoing 'Content-Length' http header of REPLY.

CONTENT-TYPE* (&OPTIONAL (REPLY *REPLY*))

The outgoing 'Content-Type' http header of REPLY.

SETFCONTENT-TYPE* (NEW-VALUE &OPTIONAL (REPLY *REPLY*))

Sets the outgoing 'Content-Type' http header of REPLY.

COOKIES-IN* (&OPTIONAL (REQUEST *REQUEST*))

Returns an alist of all cookies associated with the REQUEST object REQUEST.

COOKIES-OUT* (&OPTIONAL (REPLY *REPLY*))

Returns an alist of the outgoing cookies associated with the REPLY object REPLY.

SETFCOOKIES-OUT* (NEW-VALUE &OPTIONAL (REPLY *REPLY*))

Sets the alist of the outgoing cookies associated with the REPLY object REPLY.

CREATE-FOLDER-DISPATCHER-AND-HANDLER (URI-PREFIX BASE-PATH &OPTIONAL CONTENT-TYPE)

Creates and returns a dispatch function which will dispatch to a handler function which emits the file relative to BASE-PATH that is denoted by the URI of the request relative to URI-PREFIX. URI-PREFIX must be a string ending with a slash, BASE-PATH must be a pathname designator for an existing directory. If CONTENT-TYPE is not NIL, it'll be the content type used for all files in the folder.

CREATE-PREFIX-DISPATCHER (PREFIX HANDLER)

Creates a request dispatch function which will dispatch to the function denoted by HANDLER if the file name of the current request starts with the string PREFIX.

CREATE-REGEX-DISPATCHER (REGEX HANDLER)

Creates a request dispatch function which will dispatch to the function denoted by HANDLER if the file name of the current request matches the CL-PPCRE regular expression REGEX.

CREATE-STATIC-FILE-DISPATCHER-AND-HANDLER (URI PATH &OPTIONAL CONTENT-TYPE)

Creates and returns a request dispatch function which will dispatch to a handler function which emits the file denoted by the pathname designator PATH with content type CONTENT-TYPE if the SCRIPT-NAME of the request matches the string URI. If CONTENT-TYPE is NIL, tries to determine the content type via the file's suffix.

DELETE-AUX-REQUEST-VALUE (SYMBOL &OPTIONAL (REQUEST *REQUEST*))

Removes the value associated with SYMBOL from the request object REQUEST.

DELETE-SESSION-VALUE (SYMBOL &OPTIONAL (SESSION *SESSION*))

Removes the value associated with SYMBOL from SESSION if there is one.

DISPATCH-EASY-HANDLERS (REQUEST)

This is a dispatcher which returns the appropriate handler defined with DEFINE-EASY-HANDLER, if there is one.

ESCAPE-FOR-HTML (STRING)

Escapes the characters #\<, #\>, #\', #\", and #\& for HTML output.

GET-PARAMETER (NAME &OPTIONAL (REQUEST *REQUEST*))

Returns the GET parameter with name NAME (a string) - or NIL if there is none. Search is case-sensitive.

GET-PARAMETERS* (&OPTIONAL (REQUEST *REQUEST*))

Returns an alist of the GET parameters associated with the REQUEST object REQUEST.

HANDLE-IF-MODIFIED-SINCE (TIME &OPTIONAL (REQUEST *REQUEST*))

Handles the 'If-Modified-Since' header of REQUEST. The date string is compared to the one generated from the supplied universal time TIME.

HANDLE-STATIC-FILE (PATHNAME &OPTIONAL CONTENT-TYPE)

A function which acts like a Hunchentoot handler for the file denoted by PATHNAME. Sends a content type header corresponding to CONTENT-TYPE or (if that is NIL) tries to determine the content type via the file's suffix.

HEADER-IN* (NAME &OPTIONAL (REQUEST *REQUEST*))

Returns the incoming header with name NAME. NAME can be a keyword (recommended) or a string.

HEADER-OUT (NAME &OPTIONAL (REPLY *REPLY*))

Returns the current value of the outgoing http header named NAME. NAME should be a keyword or a string.

HEADERS-IN* (&OPTIONAL (REQUEST *REQUEST*))

Returns an alist of the incoming headers associated with the REQUEST object REQUEST.

HEADERS-OUT* (&OPTIONAL (REPLY *REPLY*))

Returns an alist of the outgoing headers associated with the REPLY object REPLY.

HOST (&OPTIONAL (REQUEST *REQUEST*))

Returns the 'Host' incoming http header value.

HTTP-TOKEN-P (TOKEN)

This function tests whether OBJECT is a non-empty string which is a TOKEN according to RFC 2068 (i.e. whether it may be used for, say, cookie names).

HUNCHENTOOT-ERROR (FORMAT-CONTROL &REST FORMAT-ARGUMENTS)

Signals an error of type HUNCHENTOOT-SIMPLE-ERROR with the provided format control and arguments.

LOCAL-ADDR* (&OPTIONAL (REQUEST *REQUEST*))

Returns the address the current request connected to.

LOCAL-PORT* (&OPTIONAL (REQUEST *REQUEST*))

Returns the port the current request connected to.

LOG-MESSAGE* (LOG-LEVEL FORMAT-STRING &REST FORMAT-ARGUMENTS)

Convenience function which calls the message logger of the current acceptor (if there is one) with the same arguments it accepts. This is the function which Hunchentoot itself uses to log errors it catches during request processing.

MIME-TYPE (PATHSPEC)

Given a pathname designator PATHSPEC returns the MIME type (as a string) corresponding to the suffix of the file denoted by PATHSPEC (or NIL).

NO-CACHE

Adds appropriate headers to completely prevent caching on most browsers.

PARAMETER (NAME &OPTIONAL (REQUEST *REQUEST*))

Returns the GET or the POST parameter with name NAME (a string) - or NIL if there is none. If both a GET and a POST parameter with the same name exist the GET parameter is returned. Search is case-sensitive.

PARAMETER-ERROR (FORMAT-CONTROL &REST FORMAT-ARGUMENTS)

Signals an error of type PARAMETER-ERROR with the provided format control and arguments.

POST-PARAMETER (NAME &OPTIONAL (REQUEST *REQUEST*))

Returns the POST parameter with name NAME (a string) - or NIL if there is none. Search is case-sensitive.

POST-PARAMETERS* (&OPTIONAL (REQUEST *REQUEST*))

Returns an alist of the POST parameters associated with the REQUEST object REQUEST.

QUERY-STRING* (&OPTIONAL (REQUEST *REQUEST*))

Returns the query string of the REQUEST object REQUEST. That's the part behind the question mark (i.e. the GET parameters).

RAW-POST-DATA (&KEY (REQUEST *REQUEST*) EXTERNAL-FORMAT FORCE-TEXT FORCE-BINARY WANT-STREAM)

Returns the content sent by the client if there was any (unless the content type was "multipart/form-data"). By default, the result is a string if the type of the `Content-Type' media type is "text", and a vector of octets otherwise. In the case of a string, the external format to be used to decode the content will be determined from the `charset' parameter sent by the client (or otherwise *HUNCHENTOOT-DEFAULT-EXTERNAL-FORMAT* will be used). You can also provide an external format explicitly (through EXTERNAL-FORMAT) in which case the result will unconditionally be a string. Likewise, you can provide a true value for FORCE-TEXT which will force Hunchentoot to act as if the type of the media type had been "text". Or you can provide a true value for FORCE-BINARY which means that you want a vector of octets at any rate. If, however, you provide a true value for WANT-STREAM, the other parameters are ignored and you'll get the content (flexi) stream to read from it yourself. It is then your responsibility to read the correct amount of data, because otherwise you won't be able to return a response to the client. If the content type of the request was `multipart/form-data' or `application/x-www-form-urlencoded', the content has been read by Hunchentoot already and you can't read from the stream anymore. You can call RAW-POST-DATA more than once per request, but you can't mix calls which have different values for WANT-STREAM. Note that this function is slightly misnamed because a client can send content even if the request method is not POST.

REAL-REMOTE-ADDR (&OPTIONAL (REQUEST *REQUEST*))

Returns the 'X-Forwarded-For' incoming http header as the second value in the form of a list of IP addresses and the first element of this list as the first value if this header exists. Otherwise returns the value of REMOTE-ADDR as the only value.

REASON-PHRASE (RETURN-CODE)

Returns a reason phrase for the HTTP return code RETURN-CODE (which should be an integer) or NIL for return codes Hunchentoot doesn't know.

RECOMPUTE-REQUEST-PARAMETERS (&KEY (REQUEST *REQUEST*) (EXTERNAL-FORMAT *HUNCHENTOOT-DEFAULT-EXTERNAL-FORMAT*))

Recomputes the GET and POST parameters for the REQUEST object REQUEST. This only makes sense if you're switching external formats during the request.

REDIRECT (TARGET &KEY (HOST (HOST *REQUEST*) HOST-PROVIDED-P) PORT (PROTOCOL (IF (SSL-P) HTTPS HTTP)) (ADD-SESSION-ID (NOT (OR HOST-PROVIDED-P (STARTS-WITH-SCHEME-P TARGET) (COOKIE-IN (SESSION-COOKIE-NAME *ACCEPTOR*))))) (CODE +HTTP-MOVED-TEMPORARILY+))

Redirects the browser to TARGET which should be a string. If TARGET is a full URL starting with a scheme, HOST, PORT and PROTOCOL are ignored. Otherwise, TARGET should denote the path part of a URL, PROTOCOL must be one of the keywords :HTTP or :HTTPS, and the URL to redirect to will be constructed from HOST, PORT, PROTOCOL, and TARGET. Adds a session ID if ADD-SESSION-ID is true. If CODE is a 3xx redirection code, it will be sent as status code.

REFERER (&OPTIONAL (REQUEST *REQUEST*))

Returns the 'Referer' (sic!) http header.

REMOTE-ADDR* (&OPTIONAL (REQUEST *REQUEST*))

Returns the address the current request originated from.

REMOTE-PORT* (&OPTIONAL (REQUEST *REQUEST*))

Returns the port the current request originated from.

REMOVE-SESSION (SESSION)

Completely removes the SESSION object SESSION from Hunchentoot's internal session database.

REPLY-EXTERNAL-FORMAT* (&OPTIONAL (REPLY *REPLY*))

The external format of REPLY which is used for character output.

SETFREPLY-EXTERNAL-FORMAT* (NEW-VALUE &OPTIONAL (REPLY *REPLY*))

Sets the external format of REPLY.

REQUEST-METHOD* (&OPTIONAL (REQUEST *REQUEST*))

Returns the request method as a Lisp keyword.

REQUEST-PATHNAME (&OPTIONAL (REQUEST *REQUEST*) DROP-PREFIX)

Construct a relative pathname from the request's SCRIPT-NAME. If DROP-PREFIX is given, pathname construction starts at the first path segment after the prefix.

REQUEST-URI* (&OPTIONAL (REQUEST *REQUEST*))

Returns the request URI.

REQUIRE-AUTHORIZATION (&OPTIONAL (REALM Hunchentoot))

Sends back appropriate headers to require basic HTTP authentication (see RFC 2617) for the realm REALM.

RESET-SESSION-SECRET

Sets *SESSION-SECRET* to a new random value. All old sessions will cease to be valid.

RESET-SESSIONS (&OPTIONAL (ACCEPTOR *ACCEPTOR*))

Removes ALL stored sessions of ACCEPTOR.

RETURN-CODE* (&OPTIONAL (REPLY *REPLY*))

The http return code of REPLY. The return codes Hunchentoot can handle are defined in specials.lisp.

SETFRETURN-CODE* (NEW-VALUE &OPTIONAL (REPLY *REPLY*))

Sets the http return code of REPLY.

RFC-1123-DATE (&OPTIONAL (TIME (GET-UNIVERSAL-TIME)))

Generates a time string according to RFC 1123. Default is current time. This can be used to send a 'Last-Modified' header - see HANDLE-IF-MODIFIED-SINCE.

SCRIPT-NAME* (&OPTIONAL (REQUEST *REQUEST*))

Returns the file name of the REQUEST object REQUEST. That's the requested URI without the query string (i.e the GET parameters).

SEND-HEADERS

Sends the initial status line and all headers as determined by the REPLY object *REPLY*. Returns a binary stream to which the body of the reply can be written. Once this function has been called, further changes to *REPLY* don't have any effect. Also, automatic handling of errors (i.e. sending the corresponding status code to the browser, etc.) is turned off for this request. If your handlers return the full body as a string or as an array of octets you should NOT call this function. This function does not return control to the caller during HEAD request processing.

SERVER-PROTOCOL* (&OPTIONAL (REQUEST *REQUEST*))

Returns the request protocol as a Lisp keyword.

SESSION-GC

Removes sessions from the current session database which are too old - see SESSION-TOO-OLD-P.

SESSION-TOO-OLD-P (SESSION)

Returns true if the SESSION object SESSION has not been active in the last (SESSION-MAX-TIME SESSION) seconds.

SESSION-VALUE (SYMBOL &OPTIONAL (SESSION *SESSION*))

Returns the value associated with SYMBOL from the session object SESSION (the default is the current session) if it exists.

SSL-P (&OPTIONAL (ACCEPTOR *ACCEPTOR*))

Whether the current connection to the client is secure. See ACCEPTOR-SSL-P.

START-SESSION

Returns the current SESSION object. If there is no current session, creates one and updates the corresponding data structures. In this case the function will also send a session cookie to the browser.

URL-DECODE (STRING &OPTIONAL (EXTERNAL-FORMAT *HUNCHENTOOT-DEFAULT-EXTERNAL-FORMAT*))

Decodes a URL-encoded string which is assumed to be encoded using the external format EXTERNAL-FORMAT, i.e. this is the inverse of URL-ENCODE. It is assumed that you'll rarely need this function, if ever. But just in case - here it is. The default for EXTERNAL-FORMAT is the value of *HUNCHENTOOT-DEFAULT-EXTERNAL-FORMAT*.

URL-ENCODE (STRING &OPTIONAL (EXTERNAL-FORMAT *HUNCHENTOOT-DEFAULT-EXTERNAL-FORMAT*))

URL-encodes a string using the external format EXTERNAL-FORMAT. The default for EXTERNAL-FORMAT is the value of *HUNCHENTOOT-DEFAULT-EXTERNAL-FORMAT*.

USER-AGENT (&OPTIONAL (REQUEST *REQUEST*))

Returns the 'User-Agent' http header.

WITHIN-REQUEST-P

True if we're in the context of a request, otherwise nil.

Undocumented

DEFAULT-DOCUMENT-DIRECTORY (&OPTIONAL SUB-DIRECTORY)

Private

ACCEPTOR-MAKE-REQUEST (ACCEPTOR SOCKET &KEY HEADERS-IN CONTENT-STREAM METHOD URI SERVER-PROTOCOL)

Make a REQUEST instance for the ACCEPTOR, setting up those slots that are determined from the SOCKET by calling the appropriate socket query functions.

ADDRESS-STRING

Returns a string with information about Hunchentoot suitable for inclusion in HTML output.

COMPUTE-ARRAY-PARAMETER (PARAMETER-NAME TYPE PARAMETERS)

Retrieves all parameters from PARAMETERS which are named like "PARAMETER-NAME[N]" (where N is a non-negative integer), converts them to TYPE, and returns an array where the Nth element is the corresponding value.

COMPUTE-HASH-TABLE-PARAMETER (PARAMETER-NAME TYPE PARAMETERS KEY-TYPE TEST-FUNCTION)

Retrieves all parameters from PARAMETERS which are named like "PARAMETER-NAME{FOO}" (where FOO is any sequence of characters not containing curly brackets), converts them to TYPE, and returns a hash table with test function TEST-FUNCTION where the corresponding value is associated with the key FOO (converted to KEY-TYPE).

COMPUTE-LIST-PARAMETER (PARAMETER-NAME TYPE PARAMETERS)

Retrieves all parameters from PARAMETERS which are named PARAMETER-NAME, converts them to TYPE, and returns a list of them.

COMPUTE-PARAMETER (PARAMETER-NAME PARAMETER-TYPE REQUEST-TYPE)

Computes and returns the parameter(s) called PARAMETER-NAME and converts it/them according to the value of PARAMETER-TYPE. REQUEST-TYPE is one of :GET, :POST, or :BOTH.

COMPUTE-REAL-NAME (SYMBOL)

Computes the `real' paramater name (a string) from the Lisp symbol SYMBOL. Used in cases where no parameter name is provided.

COMPUTE-SIMPLE-PARAMETER (PARAMETER-NAME TYPE PARAMETER-READER)

Retrieves the parameter named PARAMETER-NAME using the reader PARAMETER-READER and converts it to TYPE.

CONVERT-HACK (STRING EXTERNAL-FORMAT)

The rfc2388 package is buggy in that it operates on a character stream and thus only accepts encodings which are 8 bit transparent. In order to support different encodings for parameter values submitted, we post process whatever string values the rfc2388 package has returned.

CONVERT-PARAMETER (ARGUMENT TYPE)

Converts the string ARGUMENT to TYPE where TYPE is one of the symbols STRING, CHARACTERS, INTEGER, KEYWORD, or BOOLEAN - or otherwise a function designator for a function of one argument. ARGUMENT can also be NIL in which case this function also returns NIL unconditionally.

COOKIES-TO-ALIST (COOKIES)

Converts a list of cookies of the form "key=value" to an alist. No character set processing is done.

CREATE-RANDOM-STRING (&OPTIONAL (N 10) (BASE 16))

Returns a random number (as a string) with base BASE and N digits.

ENCODE-SESSION-STRING (ID USER-AGENT REMOTE-ADDR START)

Creates a uniquely encoded session string based on the values ID, USER-AGENT, REMOTE-ADDR, and START

EXTERNAL-FORMAT-FROM-CONTENT-TYPE (CONTENT-TYPE)

Creates and returns an external format corresponding to the value of the content type header provided in CONTENT-TYPE. If the content type was not set or if the character set specified was invalid, NIL is returned.

FORM-URL-ENCODED-LIST-TO-ALIST (FORM-URL-ENCODED-LIST &OPTIONAL (EXTERNAL-FORMAT *HUNCHENTOOT-DEFAULT-EXTERNAL-FORMAT*))

Converts a list FORM-URL-ENCODED-LIST of name/value pairs into an alist. Both names and values are url-decoded while doing this.

GET-BACKTRACE

Returns a string with a backtrace of what the Lisp system thinks is the "current" error.

GET-LOCAL-ADDRESS-AND-PORT (SOCKET)

Returns the local address and port of the socket SOCKET as two values. The address is returned as a string in dotted IP address notation.

GET-PEER-ADDRESS-AND-PORT (SOCKET)

Returns the peer address and port of the socket SOCKET as two values. The address is returned as a string in dotted IP address notation.

GET-POST-DATA (&KEY (REQUEST *REQUEST*) WANT-STREAM (ALREADY-READ 0))

Reads the request body from the stream and stores the raw contents (as an array of octets) in the corresponding slot of the REQUEST object. Returns just the stream if WANT-STREAM is true. If there's a Content-Length header, it is assumed, that ALREADY-READ octets have already been read.

GET-REQUEST-DATA (STREAM)

Reads incoming headers from the client via STREAM. Returns as multiple values the headers as an alist, the method, the URI, and the protocol of the request.

GET-STORED-SESSION (ID)

Returns the SESSION object corresponding to the number ID if the session has not expired. Will remove the session if it has expired but will not create a new one.

HEADER-OUT-SET-P (NAME &OPTIONAL (REPLY *REPLY*))

Returns a true value if the outgoing http header named NAME has been specified already. NAME should be a keyword or a string.

HUNCHENTOOT-WARN (FORMAT-CONTROL &REST FORMAT-ARGUMENTS)

Signals a warning of type HUNCHENTOOT-SIMPLE-WARNING with the provided format control and arguments.

INPUT-CHUNKING-P

Whether input chunking is currently switched on for *HUNCHENTOOT-STREAM* - note that this will return NIL if the stream not a chunked stream.

ISO-TIME (&OPTIONAL (TIME (GET-UNIVERSAL-TIME)))

Returns the universal time TIME as a string in full ISO format.

KEEP-ALIVE-P (REQUEST)

Returns a true value unless the incoming request's headers or the server's PERSISTENT-CONNECTIONS-P setting obviate a keep-alive reply. The second return value denotes whether the client has explicitly asked for a persistent connection.

MAKE-DEFUN-PARAMETER (DESCRIPTION DEFAULT-PARAMETER-TYPE DEFAULT-REQUEST-TYPE)

Creates a keyword parameter to be used by DEFINE-EASY-HANDLER. DESCRIPTION is one of the elements of DEFINE-EASY-HANDLER's LAMBDA-LIST and DEFAULT-PARAMETER-TYPE and DEFAULT-REQUEST-TYPE are the global default values.

MAKE-LOCK (NAME)

Simple wrapper to allow LispWorks and Bordeaux Threads to coexist.

MAKE-SOCKET-STREAM (SOCKET ACCEPTOR)

Returns a stream for the socket SOCKET. The ACCEPTOR argument is ignored.

MAKE-TMP-FILE-NAME (&OPTIONAL (PREFIX hunchentoot))

Generates a unique name for a temporary file. This function is called from the RFC2388 library when a file is uploaded.

MAYBE-ADD-CHARSET-TO-CONTENT-TYPE-HEADER (CONTENT-TYPE EXTERNAL-FORMAT)

Given the contents of a CONTENT-TYPE header, add a charset= attribute describing the given EXTERNAL-FORMAT if no charset= attribute is already present and the content type is a text content type. Returns the augmented content type.

MAYBE-HANDLE-RANGE-HEADER (FILE)

Helper function for handle-static-file. Determines whether the requests specifies a Range header. If so, parses the header and position the already opened file to the location specified. Returns the number of bytes to transfer from the file. Invalid specified ranges are reported to the client with a HTTP 416 status code.

MAYBE-READ-POST-PARAMETERS (&KEY (REQUEST *REQUEST*) FORCE EXTERNAL-FORMAT)

Make surce that any POST parameters in the REQUEST are parsed. The body of the request must be either application/x-www-form-urlencoded or multipart/form-data to be considered as containing POST parameters. If FORCE is true, parsing is done unconditionally. Otherwise, parsing will only be done if the RAW-POST-DATA slot in the REQUEST is false. EXTERNAL-FORMAT specifies the external format of the data in the request body. By default, the encoding is determined from the Content-Type header of the request or from *HUNCHENTOOT-DEFAULT-EXTERNAL-FORMAT* if none is found.

MAYBE-REWRITE-URLS-FOR-SESSION (HTML &KEY (COOKIE-NAME (SESSION-COOKIE-NAME *ACCEPTOR*)) (VALUE (WHEN-LET (SESSION (SESSION *REQUEST*)) (SESSION-COOKIE-VALUE SESSION))))

Rewrites the HTML page HTML such that the name/value pair COOKIE-NAME/COOKIE-VALUE is inserted if the client hasn't sent a cookie of the same name but only if *REWRITE-FOR-SESSION-URLS* is true. See the docs for URL-REWRITE:REWRITE-URLS.

MD5-HEX (STRING)

Calculates the md5 sum of the string STRING and returns it as a hex string.

NOT-IMPLEMENTED (NAME)

Used to signal an error if an operation named NAME is not implemented.

PARSE-CONTENT-TYPE (CONTENT-TYPE-HEADER)

Reads and parses a `Content-Type' header and returns it as three values - the type, the subtype, and the requests' character set as specified in the 'charset' parameter in the header, if there is one and if the content type is "text". CONTENT-TYPE-HEADER is supposed to be the corresponding header value as a string.

PARSE-MULTIPART-FORM-DATA (REQUEST EXTERNAL-FORMAT)

Parse the REQUEST body as multipart/form-data, assuming that its content type has already been verified. Returns the form data as alist or NIL if there was no data or the data could not be parsed.

PARSE-PATH (PATH)

Return a relative pathname that has been verified to not contain any directory traversals or explicit device or host fields. Returns NIL if the path is not acceptable.

PARSE-RFC2388-FORM-DATA (STREAM CONTENT-TYPE-HEADER EXTERNAL-FORMAT)

Creates an alist of POST parameters from the stream STREAM which is supposed to be of content type 'multipart/form-data'.

QUOTE-STRING (STRING)

Quotes string according to RFC 2616's definition of `quoted-string'.

READ-INITIAL-REQUEST-LINE (STREAM)

Reads and returns the initial HTTP request line, catching permitted errors and handling *BREAK-EVEN-WHILE-READING-REQUEST-TYPE-P*. If no request could be read, returns NIL. At this point, both an end-of-file as well as a timeout condition are normal; end-of-file will occur when the client has decided to not send another request but to close the connection instead, a timeout indicates that the connection timeout established by Hunchentoot has expired and we do not want to wait for another request any longer.

SCANNER-FOR-GET-PARAM (PARAM-NAME)

Returns a CL-PPCRE scanner which matches a GET parameter in a URL. Scanners are memoized in SCANNER-HASH once they are created.

SEND-BAD-REQUEST-RESPONSE (STREAM &OPTIONAL ADDITIONAL-INFO)

Send a ``Bad Request'' response to the client.

SEND-RESPONSE (ACCEPTOR STREAM STATUS-CODE &KEY HEADERS COOKIES CONTENT)

Send a HTTP response to the STREAM and log the event in ACCEPTOR. STATUS-CODE is the HTTP status code used in the response. HEADERS and COOKIES are used to create the response header. If CONTENT is provided, it is sent as the response body. If *HEADER-STREAM* is not NIL, the response headers are written to that stream when they are written to the client. STREAM is returned.

SEND-SERVICE-UNAVAILABLE-REPLY (TASKMASTER SOCKET)

A helper function to send out a quick error reply, before any state is set up via PROCESS-REQUEST.

SET-TIMEOUTS (USOCKET READ-TIMEOUT WRITE-TIMEOUT)

Sets up timeouts on the given USOCKET object. READ-TIMEOUT is the read timeout period, WRITE-TIMEOUT is the write timeout, specified in (fractional) seconds. The timeouts can either be implemented using the low-level socket options SO_RCVTIMEO and SO_SNDTIMEO or some other, implementation specific mechanism. On platforms that do not support separate read and write timeouts, both must be equal or an error will be signaled. READ-TIMEOUT and WRITE-TIMEOUT may be NIL, which means that the corresponding socket timeout value will not be set.

START-OUTPUT (RETURN-CODE &OPTIONAL (CONTENT NIL CONTENT-PROVIDED-P))

Sends all headers and maybe the content body to *HUNCHENTOOT-STREAM*. Returns immediately and does nothing if called more than once per request. Called by PROCESS-REQUEST and/or SEND-HEADERS. The RETURN-CODE argument represents the integer return code of the request. The corresponding reason phrase is determined by calling the REASON-PHRASE function. The CONTENT provided represents the body data to send to the client, if any. If it is not specified, no body is written to the client. The handler function is expected to directly write to the stream in this case. Returns the stream that is connected to the client.

STARTS-WITH-ONE-OF-P (SEQ SUBSEQ-LIST &KEY (TEST 'EQL))

Tests whether the sequence SEQ starts with one of the sequences in SUBSEQ-LIST. Individual elements are compared with TEST.

STARTS-WITH-P (SEQ SUBSEQ &KEY (TEST 'EQL))

Tests whether the sequence SEQ starts with the sequence SUBSEQ. Individual elements are compared with TEST.

STRING-AS-KEYWORD (STRING)

Intern STRING as keyword using the reader so that case conversion is done with the reader defaults.

STRINGIFY-SESSION (SESSION)

Creates a string representing the SESSION object SESSION. See ENCODE-SESSION-STRING.

Undocumented

CONDITION-VARIABLE-SIGNAL (CONDITION-VARIABLE)

CONDITION-VARIABLE-WAIT (CONDITION-VARIABLE LOCK)

DO-WITH-ACCEPTOR-REQUEST-COUNT-INCREMENTED (*ACCEPTOR* FUNCTION)

HYPERDOC-LOOKUP (SYMBOL TYPE)

MAKE-CONDITION-VARIABLE (&KEY NAME)

MAKE-COOKED-MESSAGE (HTTP-STATUS-CODE &KEY ERROR BACKTRACE)

PRINTABLE-ASCII-CHAR-P (CHAR)

MACRO

Public

DEFINE-EASY-HANDLER (DESCRIPTION LAMBDA-LIST &BODY BODY)

Defines a handler with the body BODY and optionally registers it with a URI so that it will be found by DISPATCH-EASY-HANDLERS. DESCRIPTION is either a symbol NAME or a list matching the destructuring lambda list (name &key uri acceptor-names default-parameter-type default-request-type). LAMBDA-LIST is a list the elements of which are either a symbol VAR or a list matching the destructuring lambda list (var &key real-name parameter-type init-form request-type). The resulting handler will be a Lisp function with the name NAME and keyword parameters named by the VAR symbols. Each VAR will be bound to the value of the GET or POST parameter called REAL-NAME (a string) before BODY is executed. If REAL-NAME is not provided, it will be computed by downcasing the symbol name of VAR. If URI (which is evaluated) is provided, then it must be a string or a function designator for a function of one argument. In this case, the handler will be returned by DISPATCH-EASY-HANDLERS, if URI is a string and the script name of a request is URI, or if URI designates a function and applying this function to the current request object returns a true value. ACCEPTOR-NAMES (which is evaluated) can be a list of symbols which means that the handler will be returned by DISPATCH-EASY-HANDLERS in acceptors which have one of these names (see ACCEPTOR-NAME). ACCEPTOR-NAMES can also be the symbol T which means that the handler will be returned by DISPATCH-EASY-HANDLERS in every acceptor. Whether the GET or POST parameter (or both) will be taken into consideration, depends on REQUEST-TYPE which can be :GET, :POST, :BOTH, or NIL. In the last case, the value of DEFAULT-REQUEST-TYPE (the default of which is :BOTH) will be used. The value of VAR will usually be a string (unless it resulted from a file upload in which case it won't be converted at all), but if PARAMETER-TYPE (which is evaluated) is provided, the string will be converted to another Lisp type by the following rules: If the corresponding GET or POST parameter wasn't provided by the client, VAR's value will be NIL. If PARAMETER-TYPE is 'STRING, VAR's value remains as is. If PARAMETER-TYPE is 'INTEGER and the parameter string consists solely of decimal digits, VAR's value will be the corresponding integer, otherwise NIL. If PARAMETER-TYPE is 'KEYWORD, VAR's value will be the keyword obtained by interning the upcased parameter string into the keyword package. If PARAMETER-TYPE is 'CHARACTER and the parameter string is of length one, VAR's value will be the single character of this string, otherwise NIL. If PARAMETER-TYPE is 'BOOLEAN, VAR's value will always be T (unless it is NIL by the first rule above, of course). If PARAMETER-TYPE is any other atom, it is supposed to be a function designator for a unary function which will be called to convert the string to something else. Those were the rules for `simple' types, but PARAMETER-TYPE can also be a list starting with one of the symbols LIST, ARRAY, or HASH-TABLE. The second value of the list must always be a simple parameter type as in the last paragraph - we'll call it the `inner type' below. In the case of 'LIST, all GET/POST parameters called REAL-NAME will be collected, converted to the inner type, and assembled into a list which will be the value of VAR. In the case of 'ARRAY, all GET/POST parameters which have a name like the result of (format nil "~A[~A]" real-name n) where N is a non-negative integer, will be assembled into an array where the Nth element will be set accordingly, after conversion to the inner type. The array, which will become the value of VAR, will be big enough to hold all matching parameters, but not bigger. Array elements not set as described above will be NIL. Note that VAR will always be bound to an array, which may be empty, so it will never be NIL, even if no appropriate GET/POST parameters are found. The full form of a 'HASH-TABLE parameter type is (hash-table inner-type key-type test-function), but KEY-TYPE and TEST-FUNCTION can be left out in which case they default to 'STRING and 'EQUAL, respectively. For this parameter type, all GET/POST parameters which have a name like the result of (format nil "~A{~A}" real-name key) (where KEY is a string that doesn't contain curly brackets) will become the values (after conversion to INNER-TYPE) of a hash table with test function TEST-FUNCTION where KEY (after conversion to KEY-TYPE) will be the corresponding key. Note that VAR will always be bound to a hash table, which may be empty, so it will never be NIL, even if no appropriate GET/POST parameters are found. To make matters even more complicated, the three compound parameter types also have an abbreviated form - just one of the symbols LIST, ARRAY, or HASH-TABLE. In this case, the inner type will default to 'STRING. If PARAMETER-TYPE is not provided or NIL, DEFAULT-PARAMETER-TYPE (the default of which is 'STRING) will be used instead. If the result of the computations above would be that VAR would be bound to NIL, then INIT-FORM (if provided) will be evaluated instead, and VAR will be bound to the result of this evaluation. Handlers built with this macro are constructed in such a way that the resulting Lisp function is useful even outside of Hunchentoot. Specifically, all the parameter computations above will only happen if *REQUEST* is bound, i.e. if we're within a Hunchentoot request. Otherwise, VAR will always be bound to the result of evaluating INIT-FORM unless a corresponding keyword argument is provided.

Private

DEF-HTTP-RETURN-CODE (NAME VALUE REASON-PHRASE)

Shortcut to define constants for return codes. NAME is a Lisp symbol, VALUE is the numerical value of the return code, and REASON-PHRASE is the phrase (a string) to be shown in the server's status line.

DEFCONSTANT (NAME VALUE &OPTIONAL DOC)

Make sure VALUE is evaluated only once (to appease SBCL).

DEFVAR-UNBOUND (NAME &OPTIONAL (DOC-STRING ))

Convenience macro to declare unbound special variables with a documentation string.

HANDLER-CASE* (EXPRESSION &REST CLAUSES)

Like HANDLER-CASE, but observes *CATCH-ERRORS-P*.

IGNORE-ERRORS* (&BODY BODY)

Like IGNORE-ERRORS, but observes *CATCH-ERRORS-P*.

UPGRADE-VECTOR (VECTOR NEW-TYPE &KEY CONVERTER)

Returns a vector with the same length and the same elements as VECTOR (a variable holding a vector) but having element type NEW-TYPE. If CONVERTER is not NIL, it should designate a function which will be applied to each element of VECTOR before the result is stored in the new vector. The resulting vector will have a fill pointer set to its end. The macro also uses SETQ to store the new vector in VECTOR.

WHEN-LET ((VAR FORM) &BODY BODY)

Evaluates FORM and binds VAR to the result, then executes BODY if VAR has a true value.

WITH-ACCEPTOR-REQUEST-COUNT-INCREMENTED ((ACCEPTOR) &BODY BODY)

Execute BODY with ACCEPTOR-REQUESTS-IN-PROGRESS of ACCEPTOR incremented by one. If the ACCEPTOR-SHUTDOWN-P returns true after the BODY has been executed, the ACCEPTOR-SHUTDOWN-QUEUE condition variable of the ACCEPTOR is signalled in order to finish shutdown processing.

WITH-CONDITIONS-CAUGHT-AND-LOGGED (NIL &BODY BODY)

Run BODY with conditions caught and logged by the *ACCEPTOR*. Errors are stopped right away so no other part of the software is impacted by them.

WITH-DEBUGGER (&BODY BODY)

Executes BODY and invokes the debugger if an error is signaled and *CATCH-ERRORS-P* is NIL.

WITH-LOCK-HELD ((LOCK) &BODY BODY)

Simple wrapper to allow LispWorks and Bordeaux Threads to coexist.

WITH-LOG-STREAM ((STREAM-VAR DESTINATION LOCK) &BODY BODY)

Helper macro to write log entries. STREAM-VAR is a symbol that will be bound to the logging stream during the execution of BODY. DESTINATION is the logging destination, which can be either a pathname designator of the log file, a symbol designating an open stream or NIL if no logging should be done. LOCK refers to the lock that should be held during the logging operation. If DESTINATION is a pathname, a flexi stream with UTF-8 encoding will be created and bound to STREAM-VAR. If an error occurs while writing to the log file, that error will be logged to *ERROR-OUTPUT*. Note that logging to a file involves opening and closing the log file for every logging operation, which is overall costly. Web servers with high throughput demands should make use of a specialized logging function rather than relying on Hunchentoot's default logging facility.

WITH-MAPPED-CONDITIONS (NIL &BODY BODY)

Run BODY with usocket condition mapping in effect, i.e. platform specific network errors will be signalled as usocket conditions. For Lispworks, no mapping is performed.

WITH-REBINDING (BINDINGS &BODY BODY)

Syntax: WITH-REBINDING ( { var | (var prefix) }* ) form* Evaluates a series of forms in the lexical environment that is formed by adding the binding of each VAR to a fresh, uninterned symbol, and the binding of that fresh, uninterned symbol to VAR's original value, i.e., its value in the current lexical environment. The uninterned symbol is created as if by a call to GENSYM with the string denoted by PREFIX - or, if PREFIX is not supplied, the string denoted by VAR - as argument. The forms are evaluated in order, and the values of all but the last are discarded (that is, the body is an implicit PROGN).

WITH-SESSION-LOCK-HELD ((LOCK) &BODY BODY)

This is like WITH-LOCK-HELD except that it will accept NIL as a "lock" and just execute BODY in this case.

WITH-UNIQUE-NAMES ((&REST BINDINGS) &BODY BODY)

Syntax: WITH-UNIQUE-NAMES ( { var | (var x) }* ) declaration* form* Executes a series of forms with each VAR bound to a fresh, uninterned symbol. The uninterned symbol is as if returned by a call to GENSYM with the string denoted by X - or, if X is not supplied, the string denoted by VAR - as argument. The variable bindings created are lexical unless special declarations are specified. The scopes of the name bindings and declarations do not include the Xs. The forms are evaluated in order, and the values of all but the last are discarded (that is, the body is an implicit PROGN).

GENERIC-FUNCTION

Public

ACCEPT-CONNECTIONS (ACCEPTOR)

In a loop, accepts a connection and hands it over to the acceptor's taskmaster for processing using HANDLE-INCOMING-CONNECTION. On LispWorks, this function returns immediately, on other Lisps it retusn only once the acceptor has been stopped.

ACCEPTOR-DISPATCH-REQUEST (ACCEPTOR REQUEST)

This function is called to actually dispatch the request once the standard logging and error handling has been set up. ACCEPTOR subclasses implement methods for this function in order to perform their own request routing. If a method does not want to handle the request, it is supposed to invoke CALL-NEXT-METHOD so that the next ACCEPTOR in the inheritance chain gets a chance to handle the request.

ACCEPTOR-LOG-ACCESS (ACCEPTOR &KEY RETURN-CODE)

Function to call to log access to the acceptor. The RETURN-CODE, CONTENT and CONTENT-LENGTH keyword arguments contain additional information about the request to log. In addition, it can use the standard request accessor functions that are available to handler functions to find out more information about the request.

ACCEPTOR-LOG-MESSAGE (ACCEPTOR LOG-LEVEL FORMAT-STRING &REST FORMAT-ARGUMENTS)

Function to call to log messages by the ACCEPTOR. It must accept a severity level for the message, which will be one of :ERROR, :INFO, or :WARNING, a format string and an arbitary number of formatting arguments.

ACCEPTOR-REMOVE-SESSION (ACCEPTOR SESSION)

This function is called whenever a session in ACCEPTOR is being destroyed because of a session timout or an explicit REMOVE-SESSION call.

ACCEPTOR-SSL-P (ACCEPTOR)

Returns a true value if ACCEPTOR uses SSL connections. The default is to unconditionally return NIL and subclasses of ACCEPTOR must specialize this method to signal that they're using secure connections - see the SSL-ACCEPTOR class.

ACCEPTOR-STATUS-MESSAGE (ACCEPTOR HTTP-STATUS-CODE &ALLOW-OTHER-KEYS)

This function is called after the request's handler has been invoked to convert the HTTP-STATUS-CODE to a HTML message to be displayed to the user. If this function returns a string, that string is sent to the client instead of the content produced by the handler, if any. If an ERROR-TEMPLATE-DIRECTORY is set in the current acceptor and the directory contains a file corresponding to HTTP-STATUS-CODE named <code>.html, that file is sent to the client after variable substitution. Variables are referenced by ${<variable-name>}. Additional keyword arguments may be provided which are made available to the templating logic as substitution variables. These variables can be interpolated into error message templates in, which contains the current URL relative to the server and without GET parameters. In addition to the variables corresponding to keyword arguments, the script-name, lisp-implementation-type, lisp-implementation-version and hunchentoot-version variables are available.

CREATE-REQUEST-HANDLER-THREAD (TASKMASTER SOCKET)

Create a new thread in which to process the request. This thread will call PROCESS-CONNECTION to process the request.

DECREMENT-TASKMASTER-THREAD-COUNT (TASKMASTER)

Atomically decrement the number of taskmaster requests

EXECUTE-ACCEPTOR (TASKMASTER)

This is a callback called by the acceptor once it has performed all initial processing to start listening for incoming connections (see START-LISTENING). It usually calls the ACCEPT-CONNECTIONS method of the acceptor, but depending on the taskmaster instance the method might be called from a new thread.

HANDLE-INCOMING-CONNECTION (TASKMASTER SOCKET)

This function is called by the acceptor to start processing of requests on a new incoming connection. SOCKET is the usocket instance that represents the new connection (or a socket handle on LispWorks). The taskmaster starts processing requests on the incoming connection by calling the PROCESS-CONNECTION method of the acceptor instance. The SOCKET argument is passed to PROCESS-CONNECTION as an argument.

HANDLE-REQUEST (ACCEPTOR REQUEST)

This function is called once the request has been read and a REQUEST object has been created. Its job is to set up standard error handling and request logging. Might be a good place for around methods specialized for your subclass of ACCEPTOR which bind or rebind special variables which can then be accessed by your handlers.

HEADER-IN (NAME REQUEST)

Returns the incoming header with name NAME. NAME can be a keyword (recommended) or a string.

SETFHEADER-OUT (NEW-VALUE NAME &OPTIONAL REPLY)

Changes the current value of the outgoing http header named NAME (a keyword or a string). If a header with this name doesn't exist, it is created.

INCREMENT-TASKMASTER-THREAD-COUNT (TASKMASTER)

Atomically increment the number of taskmaster requests.

INITIALIZE-CONNECTION-STREAM (ACCEPTOR STREAM)

Can be used to modify the stream which is used to communicate between client and server before the request is read. The default method of ACCEPTOR does nothing, but see for example the method defined for SSL-ACCEPTOR. All methods of this generic function must return the stream to use.

MAYBE-INVOKE-DEBUGGER (CONDITION)

This generic function is called whenever a condition CONDITION is signaled in Hunchentoot. You might want to specialize it on specific condition classes for debugging purposes.

NEXT-SESSION-ID (ACCEPTOR)

Returns the next sequential session ID, an integer, which should be unique per session. The default method uses a simple global counter and isn't guarded by a lock. For a high-performance production environment you might consider using a more robust implementation.

PROCESS-CONNECTION (ACCEPTOR SOCKET)

This function is called by the taskmaster when a new client connection has been established. Its arguments are the ACCEPTOR object and a LispWorks socket handle or a usocket socket stream object in SOCKET. It reads the request headers, sets up the request and reply objects, and hands over to PROCESS-REQUEST. This is done in a loop until the stream has to be closed or until a connection timeout occurs. It is probably not a good idea to re-implement this method until you really, really know what you're doing.

PROCESS-REQUEST (REQUEST)

This function is called by PROCESS-CONNECTION after the incoming headers have been read. It calls HANDLE-REQUEST to select and call a handler and sends the output of this handler to the client using START-OUTPUT. Note that PROCESS-CONNECTION is called once per connection and loops in case of a persistent connection while PROCESS-REQUEST is called anew for each request. Essentially, you can view process-request as a thin wrapper around HANDLE-REQUEST. The return value of this function is ignored.

RESET-CONNECTION-STREAM (ACCEPTOR STREAM)

Resets the stream which is used to communicate between client and server after one request has been served so that it can be used to process the next request. This generic function is called after a request has been processed and must return the stream.

SESSION-CREATED (ACCEPTOR NEW-SESSION)

This function is called whenever a new session has been created. There's a default method which might trigger a session GC based on the value of *SESSION-GC-FREQUENCY*. The return value is ignored.

SESSION-DB (ACCEPTOR)

Returns the current session database which is an alist where each car is a session's ID and the cdr is the corresponding SESSION object itself. The default is to use a global list for all acceptors.

SETFSESSION-DB (NEW-VALUE ACCEPTOR)

Modifies the current session database. See SESSION-DB.

SESSION-DB-LOCK (ACCEPTOR &KEY WHOLE-DB-P (WHOLE-DB-P T))

A function which returns a lock that will be used to prevent concurrent access to sessions. The first argument will be the acceptor that handles the current request, the second argument is true if the whole (current) session database is modified. If it is NIL, only one existing session in the database is modified. This function can return NIL which means that sessions or session databases will be modified without a lock held (for example for single-threaded environments). The default is to always return a global lock (ignoring the ACCEPTOR argument) for Lisps that support threads and NIL otherwise.

SESSION-VERIFY (REQUEST)

Tries to get a session identifier from the cookies (or alternatively from the GET parameters) sent by the client (see SESSION-COOKIE-NAME and SESSION-COOKIE-VALUE). This identifier is then checked for validity against the REQUEST object REQUEST. On success the corresponding session object (if not too old) is returned (and updated). Otherwise NIL is returned. A default method is provided and you only need to write your own one if you want to maintain your own sessions.

SHUTDOWN (TASKMASTER)

Shuts down the taskmaster, i.e. frees all resources that were set up by it. For example, a multi-threaded taskmaster might terminate all threads that are currently associated with it. This function is called by the acceptor's STOP method.

START (ACCEPTOR)

Starts the ACCEPTOR so that it begins accepting connections. Returns the acceptor.

START-LISTENING (ACCEPTOR)

Sets up a listen socket for the given ACCEPTOR and enables it to listen to incoming connections. This function is called from the thread that starts the acceptor initially and may return errors resulting from the listening operation (like 'address in use' or similar).

START-THREAD (TASKMASTER THUNK &KEY NAME)

Start a name thread in which to call the THUNK, in the context of the given TASKMASTER. Keyword arguments provide TASKMASTER-dependent options. Return a thread object. Hunchentoot taskmaster methods will call it with the taskmaster as the context, allowing hunchentoot extensions to define specialized methods that may e.g. wrap the thunk within a proper set of bindings and condition handlers.

STOP (ACCEPTOR &KEY SOFT)

Stops the ACCEPTOR so that it no longer accepts requests. If SOFT is true, and there are any requests in progress, wait until all requests are fully processed, but meanwhile do not accept new requests. Note that SOFT must not be set when calling STOP from within a request handler, as that will deadlock.

TOO-MANY-TASKMASTER-REQUESTS (TASKMASTER SOCKET)

Signal a "too many requests" error, just prior to closing the connection.

Private

ACCEPTOR-SERVER-NAME (ACCEPTOR)

Returns a string which can be used for 'Server' headers.

ASSOC* (THING ALIST)

Similar to CL:ASSOC, but 'does the right thing' if THING is a string or a symbol.

WRITE-HEADER-LINE (KEY VALUE STREAM)

Accepts a string KEY and a Lisp object VALUE and writes them directly to the client as an HTTP header line.

Undocumented

DECREMENT-TASKMASTER-ACCEPT-COUNT (TASKMASTER)

HANDLE-INCOMING-CONNECTION% (TASKMASTER SOCKET)

HUNCHENTOOT-OPERATION-NOT-IMPLEMENTED-OPERATION (CONDITION)

INCREMENT-TASKMASTER-ACCEPT-COUNT (TASKMASTER)

NOTE-FREE-CONNECTION (TASKMASTER)

WAIT-FOR-FREE-CONNECTION (TASKMASTER)

SLOT-ACCESSOR

Public

ACCEPTOR-ACCESS-LOG-DESTINATION (OBJECT)

Destination of the access log which contains one log entry per request handled in a format similar to Apache's access.log. Can be set to a pathname or string designating the log file, to a open output stream or to NIL to suppress logging.

SETFACCEPTOR-ACCESS-LOG-DESTINATION (NEW-VALUE OBJECT)

Destination of the access log which contains one log entry per request handled in a format similar to Apache's access.log. Can be set to a pathname or string designating the log file, to a open output stream or to NIL to suppress logging.

ACCEPTOR-ADDRESS (OBJECT)

The address the acceptor is listening on. If address is a string denoting an IP address, then the server only receives connections for that address. This must be one of the addresses associated with the machine and allowed values are host names such as "www.zappa.com" and address strings such as "72.3.247.29". If address is NIL, then the server will receive connections to all IP addresses on the machine. This is the default.

ACCEPTOR-DOCUMENT-ROOT (OBJECT)

Directory pathname that points to files that are served by the acceptor if no more specific acceptor-dispatch-request method handles the request.

SETFACCEPTOR-DOCUMENT-ROOT (NEW-VALUE OBJECT)

Directory pathname that points to files that are served by the acceptor if no more specific acceptor-dispatch-request method handles the request.

ACCEPTOR-ERROR-TEMPLATE-DIRECTORY (OBJECT)

Directory pathname that contains error message template files for server-generated error messages. Files must be named <return-code>.html with <return-code> representing the HTTP return code that the file applies to, i.e. 404.html would be used as the content for a HTTP 404 Not found response.

SETFACCEPTOR-ERROR-TEMPLATE-DIRECTORY (NEW-VALUE OBJECT)

Directory pathname that contains error message template files for server-generated error messages. Files must be named <return-code>.html with <return-code> representing the HTTP return code that the file applies to, i.e. 404.html would be used as the content for a HTTP 404 Not found response.

ACCEPTOR-INPUT-CHUNKING-P (OBJECT)

A generalized boolean denoting whether the acceptor may use chunked encoding for input, i.e. when accepting request bodies from the client. The default is T and there's usually no reason to change this to NIL.

SETFACCEPTOR-INPUT-CHUNKING-P (NEW-VALUE OBJECT)

A generalized boolean denoting whether the acceptor may use chunked encoding for input, i.e. when accepting request bodies from the client. The default is T and there's usually no reason to change this to NIL.

ACCEPTOR-LISTEN-BACKLOG (OBJECT)

Number of pending connections allowed in the listen socket before the kernel rejects further incoming connections.

ACCEPTOR-MESSAGE-LOG-DESTINATION (OBJECT)

Destination of the server error log which is used to log informational, warning and error messages in a free-text format intended for human inspection. Can be set to a pathname or string designating the log file, to a open output stream or to NIL to suppress logging.

SETFACCEPTOR-MESSAGE-LOG-DESTINATION (NEW-VALUE OBJECT)

Destination of the server error log which is used to log informational, warning and error messages in a free-text format intended for human inspection. Can be set to a pathname or string designating the log file, to a open output stream or to NIL to suppress logging.

ACCEPTOR-NAME (OBJECT)

The optional name of the acceptor, a symbol. This name can be utilized when defining "easy handlers" - see DEFINE-EASY-HANDLER. The default name is an uninterned symbol as returned by GENSYM.

SETFACCEPTOR-NAME (NEW-VALUE OBJECT)

The optional name of the acceptor, a symbol. This name can be utilized when defining "easy handlers" - see DEFINE-EASY-HANDLER. The default name is an uninterned symbol as returned by GENSYM.

ACCEPTOR-OUTPUT-CHUNKING-P (OBJECT)

A generalized boolean denoting whether the acceptor may use chunked encoding for output, i.e. when sending data to the client. The default is T and there's usually no reason to change this to NIL.

SETFACCEPTOR-OUTPUT-CHUNKING-P (NEW-VALUE OBJECT)

A generalized boolean denoting whether the acceptor may use chunked encoding for output, i.e. when sending data to the client. The default is T and there's usually no reason to change this to NIL.

ACCEPTOR-PERSISTENT-CONNECTIONS-P (OBJECT)

A generalized boolean denoting whether the acceptor supports persistent connections, which is the default for threaded acceptors. If this property is NIL, Hunchentoot closes each incoming connection after having processed one request. This is the default for non-threaded acceptors.

SETFACCEPTOR-PERSISTENT-CONNECTIONS-P (NEW-VALUE OBJECT)

A generalized boolean denoting whether the acceptor supports persistent connections, which is the default for threaded acceptors. If this property is NIL, Hunchentoot closes each incoming connection after having processed one request. This is the default for non-threaded acceptors.

ACCEPTOR-PORT (OBJECT)

The port the acceptor is listening on. The default is 80. Note that depending on your operating system you might need special privileges to listen on port 80.

ACCEPTOR-READ-TIMEOUT (OBJECT)

The read timeout of the acceptor, specified in (fractional) seconds. The precise semantics of this parameter is determined by the underlying Lisp's implementation of socket timeouts. NIL means no timeout.

ACCEPTOR-REPLY-CLASS (OBJECT)

Determines which class of reply objects is created when a request is served in and should be (a symbol naming) a class which inherits from REPLY. The default is the symbol REPLY.

SETFACCEPTOR-REPLY-CLASS (NEW-VALUE OBJECT)

Determines which class of reply objects is created when a request is served in and should be (a symbol naming) a class which inherits from REPLY. The default is the symbol REPLY.

ACCEPTOR-REQUEST-CLASS (OBJECT)

Determines which class of request objects is created when a request comes in and should be (a symbol naming) a class which inherits from REQUEST. The default is the symbol REQUEST.

SETFACCEPTOR-REQUEST-CLASS (NEW-VALUE OBJECT)

Determines which class of request objects is created when a request comes in and should be (a symbol naming) a class which inherits from REQUEST. The default is the symbol REQUEST.

ACCEPTOR-SSL-CERTIFICATE-FILE (OBJECT)

A pathname designator for a certificate file in PEM format.

ACCEPTOR-SSL-PRIVATEKEY-FILE (OBJECT)

A pathname designator for a private key file in PEM format, or (only on LispWorks) NIL if the certificate file contains the private key.

ACCEPTOR-SSL-PRIVATEKEY-PASSWORD (OBJECT)

The password for the private key file or NIL for no password.

ACCEPTOR-WRITE-TIMEOUT (OBJECT)

The write timeout of the acceptor, specified in (fractional) seconds. The precise semantics of this parameter is determined by the underlying Lisp's implementation of socket timeouts. NIL means no timeout.

CONTENT-LENGTH (OBJECT)

The outgoing 'Content-Length' http header which defaults NIL. If this is NIL, Hunchentoot will compute the content length.

CONTENT-TYPE (OBJECT)

The outgoing 'Content-Type' http header which defaults to the value of *DEFAULT-CONTENT-TYPE*.

COOKIES-IN (OBJECT)

An alist of the cookies sent by the client.

COOKIES-OUT (OBJECT)

The outgoing cookies. This slot's value should only be modified by the functions defined in cookies.lisp.

SETFCOOKIES-OUT (NEW-VALUE OBJECT)

The outgoing cookies. This slot's value should only be modified by the functions defined in cookies.lisp.

GET-PARAMETERS (OBJECT)

An alist of the GET parameters sent by the client.

HEADERS-IN (OBJECT)

An alist of the incoming headers.

HEADERS-OUT (OBJECT)

An alist of the outgoing http headers not including the 'Set-Cookie', 'Content-Length', and 'Content-Type' headers. Use the functions HEADER-OUT and (SETF HEADER-OUT) to modify this slot.

LOCAL-ADDR (OBJECT)

The IP address of the local system that the client connected to.

LOCAL-PORT (OBJECT)

The TCP port number of the local system that the client connected to.

POST-PARAMETERS (OBJECT)

An alist of the POST parameters sent by the client.

QUERY-STRING (OBJECT)

The query string of this request.

REMOTE-ADDR (OBJECT)

The IP address of the client that initiated this request.

REMOTE-PORT (OBJECT)

The TCP port number of the client socket from which this request originated.

REPLY-EXTERNAL-FORMAT (OBJECT)

The external format of the reply - used for character output.

SETFREPLY-EXTERNAL-FORMAT (NEW-VALUE OBJECT)

The external format of the reply - used for character output.

REQUEST-ACCEPTOR (OBJECT)

The acceptor which created this request object.

REQUEST-METHOD (OBJECT)

The request method as a keyword.

REQUEST-URI (OBJECT)

The request URI as a string.

RETURN-CODE (OBJECT)

The http return code of this reply. The return codes Hunchentoot can handle are defined in specials.lisp.

SETFRETURN-CODE (NEW-VALUE OBJECT)

The http return code of this reply. The return codes Hunchentoot can handle are defined in specials.lisp.

SCRIPT-NAME (OBJECT)

The URI requested by the client without the query string.

SERVER-PROTOCOL (OBJECT)

The HTTP protocol as a keyword.

SESSION (OBJECT)

The session object associated with this request.

SETFSESSION (NEW-VALUE OBJECT)

The session object associated with this request.

SESSION-ID (OBJECT)

The unique ID (an INTEGER) of the session.

SESSION-MAX-TIME (OBJECT)

The time (in seconds) after which this session expires if it's not used.

SETFSESSION-MAX-TIME (NEW-VALUE OBJECT)

The time (in seconds) after which this session expires if it's not used.

SESSION-REMOTE-ADDR (OBJECT)

The remote IP address of the client when this session was started as returned by REAL-REMOTE-ADDR.

SESSION-START (OBJECT)

The time this session was started.

SESSION-USER-AGENT (OBJECT)

The incoming 'User-Agent' header that was sent when this session was created.

TASKMASTER-ACCEPTOR (OBJECT)

A backpointer to the acceptor instance this taskmaster works for.

SETFTASKMASTER-ACCEPTOR (NEW-VALUE OBJECT)

A backpointer to the acceptor instance this taskmaster works for.

TASKMASTER-MAX-ACCEPT-COUNT (TASKMASTER)

The The maximum number of connections this taskmaster will accept before refusing new connections. If supplied, this must be greater than MAX-THREAD-COUNT. The number of queued requests is the difference between MAX-ACCEPT-COUNT and MAX-THREAD-COUNT.

SETFTASKMASTER-MAX-ACCEPT-COUNT (NEW-VALUE OBJECT)

Set the The maximum number of connections this taskmaster will accept before refusing new connections. If supplied, this must be greater than MAX-THREAD-COUNT. The number of queued requests is the difference between MAX-ACCEPT-COUNT and MAX-THREAD-COUNT.

TASKMASTER-MAX-THREAD-COUNT (TASKMASTER)

The The maximum number of request threads this taskmaster will simultaneously run before refusing or queueing new connections requests. If the value is null, then there is no limit.

SETFTASKMASTER-MAX-THREAD-COUNT (NEW-VALUE OBJECT)

Set the The maximum number of request threads this taskmaster will simultaneously run before refusing or queueing new connections requests. If the value is null, then there is no limit.

TASKMASTER-THREAD-COUNT (TASKMASTER)

The Returns the current number of taskmaster requests.

SETFTASKMASTER-THREAD-COUNT (NEW-VALUE OBJECT)

Set the Returns the current number of taskmaster requests.

Private

ACCEPTOR-LISTEN-SOCKET (OBJECT)

The socket listening for incoming connections.

SETFACCEPTOR-LISTEN-SOCKET (NEW-VALUE OBJECT)

The socket listening for incoming connections.

ACCEPTOR-PROCESS (OBJECT)

A process that accepts incoming connections and hands them off to new processes for request handling.

SETFACCEPTOR-PROCESS (NEW-VALUE OBJECT)

A process that accepts incoming connections and hands them off to new processes for request handling.

ACCEPTOR-SHUTDOWN-LOCK (OBJECT)

The lock protecting the shutdown-queue condition variable and the requests-in-progress counter.

SETFACCEPTOR-SHUTDOWN-LOCK (NEW-VALUE OBJECT)

The lock protecting the shutdown-queue condition variable and the requests-in-progress counter.

ACCEPTOR-SHUTDOWN-P (OBJECT)

A flag that makes the acceptor shutdown itself when set to something other than NIL.

SETFACCEPTOR-SHUTDOWN-P (NEW-VALUE OBJECT)

A flag that makes the acceptor shutdown itself when set to something other than NIL.

ACCEPTOR-SHUTDOWN-QUEUE (OBJECT)

A condition variable used with soft shutdown, signaled when all requests have been processed.

SETFACCEPTOR-SHUTDOWN-QUEUE (NEW-VALUE OBJECT)

A condition variable used with soft shutdown, signaled when all requests have been processed.

ACCEPTOR-TASKMASTER (OBJECT)

The taskmaster (i.e. an instance of a subclass of TASKMASTER) that is responsible for scheduling the work for this acceptor. The default depends on the MP capabilities of the underlying Lisp.

ACCESSOR-REQUESTS-IN-PROGRESS (OBJECT)

The number of requests currently in progress.

SETFACCESSOR-REQUESTS-IN-PROGRESS (NEW-VALUE OBJECT)

The number of requests currently in progress.

AUX-DATA (OBJECT)

Used to keep a user-modifiable alist with arbitrary data during the request.

SETFAUX-DATA (NEW-VALUE OBJECT)

Used to keep a user-modifiable alist with arbitrary data during the request.

CONTENT-STREAM (OBJECT)

A stream from which the request body can be read if there is one.

SESSION-DATA (OBJECT)

Data associated with this session - see SESSION-VALUE.

SESSION-LAST-CLICK (OBJECT)

The last time this session was used.

SESSION-STRING (OBJECT)

The session string encodes enough data to safely retrieve this session. It is sent to the browser as a cookie value or as a GET parameter.

TASKMASTER-ACCEPT-COUNT (OBJECT)

The number of connection currently accepted by the taskmaster. These connections are not ensured to be processed, thay may be waiting for an empty processing slot or rejected because the load is too heavy.

SETFTASKMASTER-ACCEPT-COUNT (NEW-VALUE OBJECT)

The number of connection currently accepted by the taskmaster. These connections are not ensured to be processed, thay may be waiting for an empty processing slot or rejected because the load is too heavy.

TASKMASTER-ACCEPT-COUNT-LOCK (OBJECT)

In the absence of 'atomic-incf', we need this to atomically increment and decrement the accept count.

TASKMASTER-THREAD-COUNT-LOCK (OBJECT)

In the absence of 'atomic-incf', we need this to atomically increment and decrement the request count.

TASKMASTER-WAIT-LOCK (OBJECT)

The lock for the connection wait queue.

TASKMASTER-WAIT-QUEUE (OBJECT)

A queue that we use to wait for a free connection.

Undocumented

TASKMASTER-WORKER-THREAD-NAME-FORMAT (OBJECT)

SETFTASKMASTER-WORKER-THREAD-NAME-FORMAT (NEW-VALUE OBJECT)

VARIABLE

Public

*CATCH-ERRORS-P*

Whether Hunchentoot should catch and log errors (or rather invoke the debugger).

*CONTENT-TYPES-FOR-URL-REWRITE*

The content types for which url-rewriting is OK. See *REWRITE-FOR-SESSION-URLS*.

*DEFAULT-CONNECTION-TIMEOUT*

The default connection timeout used when an acceptor is reading from and writing to a socket stream.

*DEFAULT-CONTENT-TYPE*

The default content-type header which is returned to the client. If this is text content type, the character set used for encoding the response will automatically be added to the content type in a ``charset'' attribute.

*DISPATCH-TABLE*

A global list of dispatch functions.

*FILE-UPLOAD-HOOK*

If this is not NIL, it should be a unary function which will be called with a pathname for each file which is uploaded to Hunchentoot. The pathname denotes the temporary file to which the uploaded file is written. The hook is called directly before the file is created.

*HEADER-STREAM*

If this variable is not NIL, it should be bound to a stream to which incoming and outgoing headers will be written for debugging purposes.

*HUNCHENTOOT-DEFAULT-EXTERNAL-FORMAT*

The external format used to compute the REQUEST object.

*LISP-ERRORS-LOG-LEVEL*

Log level for Lisp errors. Should be one of :ERROR (the default), :WARNING, or :INFO.

*LISP-WARNINGS-LOG-LEVEL*

Log level for Lisp warnings. Should be one of :ERROR, :WARNING (the default), or :INFO.

*LOG-LISP-BACKTRACES-P*

Whether Lisp backtraces should be logged. Only has an effect if *LOG-LISP-ERRORS-P* is true as well.

*LOG-LISP-ERRORS-P*

Whether Lisp errors in request handlers should be logged.

*LOG-LISP-WARNINGS-P*

Whether Lisp warnings in request handlers should be logged.

*METHODS-FOR-POST-PARAMETERS*

A list of the request method types (as keywords) for which Hunchentoot will try to compute POST-PARAMETERS.

*REWRITE-FOR-SESSION-URLS*

Whether HTML pages should possibly be rewritten for cookie-less session-management.

*SESSION-GC-FREQUENCY*

A session GC (see function SESSION-GC) will happen every *SESSION-GC-FREQUENCY* requests (counting only requests which create a new session) if this variable is not NIL. See SESSION-CREATED.

*SESSION-MAX-TIME*

The default time (in seconds) after which a session times out.

*SHOW-LISP-BACKTRACES-P*

Whether Lisp errors shown in HTML output should contain backtrace information.

*SHOW-LISP-ERRORS-P*

Whether Lisp errors in request handlers should be shown in HTML output.

*TMP-DIRECTORY*

Directory for temporary files created by MAKE-TMP-FILE-NAME.

*USE-REMOTE-ADDR-FOR-SESSIONS*

Whether the client's remote IP (as returned by REAL-REMOTE-ADDR) should be encoded into the session string. If this value is true, a session will cease to be accessible if the client's remote IP changes. This might for example be an issue if the client uses a proxy server which doesn't send correct 'X_FORWARDED_FOR' headers.

*USE-USER-AGENT-FOR-SESSIONS*

Whether the 'User-Agent' header should be encoded into the session string. If this value is true, a session will cease to be accessible if the client sends a different 'User-Agent' header.

Undocumented

*HUNCHENTOOT-VERSION*

Private

*ACCESS-LOG-LOCK*

A global lock to prevent concurrent access to the log file used by the ACCEPTOR-LOG-ACCESS function.

*CLOSE-HUNCHENTOOT-STREAM*

Will be set to T if the Hunchentoot socket stream has to be closed at the end of the request.

*EASY-HANDLER-ALIST*

An alist of (URI acceptor-names function) lists defined by DEFINE-EASY-HANDLER.

*GLOBAL-SESSION-DB-LOCK*

A global lock to prevent two threads from modifying *session-db* at the same time (or NIL for Lisps which don't have threads).

*HEADERS-SENT*

Used internally to check whether the reply headers have already been sent for this request.

*HTTP-REASON-PHRASE-MAP*

Used to map numerical return codes to reason phrases.

*MESSAGE-LOG-LOCK*

A global lock to prevent concurrent access to the log file used by the ACCEPTOR-LOG-MESSAGE function.

*MIME-TYPE-HASH*

A hash table which maps file suffixes to MIME types.

*MIME-TYPE-LIST*

An alist where the cars are MIME types and the cdrs are list of file suffixes for the corresponding type.

*SESSION-DB*

The default (global) session database.

*THE-RANDOM-STATE*

A fresh random state.

*TMP-FILES*

A list of temporary files created while a request was handled.

Undocumented

*DEFAULT-MAX-ACCEPT-COUNT*

*DEFAULT-MAX-THREAD-COUNT*

*HYPERDOC-BASE-URI*

CLASS

Public

ACCEPTOR

To create a Hunchentoot webserver, you make an instance of this class and use the generic function START to start it (and STOP to stop it). Use the :PORT initarg if you don't want to listen on the default http port 80. There are other initargs most of which you probably won't need very often. They are explained in detail in the docstrings of the slot definitions for this class. Unless you are in a Lisp without MP capabilities, you can have several active instances of ACCEPTOR (listening on different ports) at the same time.

EASY-ACCEPTOR

This is the acceptor of the ``easy'' Hunchentoot framework.

EASY-SSL-ACCEPTOR

This is an acceptor that mixes the ``easy'' Hunchentoot with SSL connections.

MULTI-THREADED-TASKMASTER

An abstract class for taskmasters that use multiple threads. For a concrete class to instantiate, use one-thread-per-connection-taskmaster.

ONE-THREAD-PER-CONNECTION-TASKMASTER

A taskmaster that starts one thread for listening to incoming requests and one new thread for each incoming connection. If MAX-THREAD-COUNT is null, a new thread will always be created for each request. If MAX-THREAD-COUNT is supplied, the number of request threads is limited to that. Furthermore, if MAX-ACCEPT-COUNT is not supplied, an HTTP 503 will be sent if the thread limit is exceeded. Otherwise, if MAX-ACCEPT-COUNT is supplied, it must be greater than MAX-THREAD-COUNT; in this case, requests are accepted up to MAX-ACCEPT-COUNT, and only then is HTTP 503 sent. It is important to note that MAX-ACCEPT-COUNT and the HTTP 503 behavior described above is racing with the acceptor listen backlog. If we are receiving requests faster than threads can be spawned and 503 sent, the requests will be silently rejected by the kernel. In a load-balanced environment with multiple Hunchentoot servers, it's reasonable to provide MAX-THREAD-COUNT but leave MAX-ACCEPT-COUNT null. This will immediately result in HTTP 503 when one server is out of resources, so the load balancer can try to find another server. In an environment with a single Hunchentoot server, it's reasonable to provide both MAX-THREAD-COUNT and a somewhat larger value for MAX-ACCEPT-COUNT. This will cause a server that's almost out of resources to wait a bit; if the server is completely out of resources, then the reply will be HTTP 503. This is the default taskmaster implementation for multi-threaded Lisp implementations.

REPLY

Objects of this class hold all the information about an outgoing reply. They are created automatically by Hunchentoot and can be accessed and modified by the corresponding handler. You should not mess with the slots of these objects directly, but you can subclass REPLY in order to implement your own behaviour. See the REPLY-CLASS slot of the ACCEPTOR class.

REQUEST

Objects of this class hold all the information about an incoming request. They are created automatically by acceptors and can be accessed by the corresponding handler. You should not mess with the slots of these objects directly, but you can subclass REQUEST in order to implement your own behaviour. See the REQUEST-CLASS slot of the ACCEPTOR class.

SESSION (OBJECT)

SESSION objects are automatically maintained by Hunchentoot. They should not be created explicitly with MAKE-INSTANCE but implicitly with START-SESSION and they should be treated as opaque objects. You can ignore Hunchentoot's SESSION objects altogether and implement your own sessions if you provide corresponding methods for SESSION-COOKIE-VALUE and SESSION-VERIFY.

SINGLE-THREADED-TASKMASTER

A taskmaster that runs synchronously in the thread where the START function was invoked (or in the case of LispWorks in the thread started by COMM:START-UP-SERVER). This is the simplest possible taskmaster implementation in that its methods do nothing but calling their acceptor "sister" methods - EXECUTE-ACCEPTOR calls ACCEPT-CONNECTIONS, HANDLE-INCOMING-CONNECTION calls PROCESS-CONNECTION.

SSL-ACCEPTOR

Create and START an instance of this class (instead of ACCEPTOR) if you want an https server. There are two required initargs, :SSL-CERTIFICATE-FILE and :SSL-PRIVATEKEY-FILE, for pathname designators denoting the certificate file and the key file in PEM format. On LispWorks, you can have both in one file in which case the second initarg is optional. You can also use the :SSL-PRIVATEKEY-PASSWORD initarg to provide a password (as a string) for the key file (or NIL, the default, for no password). The default port for SSL-ACCEPTOR instances is 443 instead of 80

TASKMASTER

An instance of this class is responsible for distributing the work of handling requests for its acceptor. This is an "abstract" class in the sense that usually only instances of subclasses of TASKMASTER will be used.

Private

CONDITION

Public

HUNCHENTOOT-CONDITION

Superclass for all conditions related to Hunchentoot.

HUNCHENTOOT-ERROR (FORMAT-CONTROL &REST FORMAT-ARGUMENTS)

Superclass for all errors related to Hunchentoot.

HUNCHENTOOT-WARNING

Superclass for all warnings related to Hunchentoot.

PARAMETER-ERROR (FORMAT-CONTROL &REST FORMAT-ARGUMENTS)

Signalled if a function was called with incosistent or illegal parameters.

Private

HUNCHENTOOT-SIMPLE-ERROR

Like HUNCHENTOOT-ERROR but with formatting capabilities.

HUNCHENTOOT-SIMPLE-WARNING

Like HUNCHENTOOT-WARNING but with formatting capabilities.

OPERATION-NOT-IMPLEMENTED

This warning is signalled when an operation (like SETUID for example) is not implemented for a specific Lisp.

CONSTANT

Public

+HTTP-ACCEPTED+

HTTP return code (202) for 'Accepted'.

+HTTP-AUTHORIZATION-REQUIRED+

HTTP return code (401) for 'Authorization Required'.

+HTTP-BAD-GATEWAY+

HTTP return code (502) for 'Bad Gateway'.

+HTTP-BAD-REQUEST+

HTTP return code (400) for 'Bad Request'.

+HTTP-CONFLICT+

HTTP return code (409) for 'Conflict'.

+HTTP-CONTINUE+

HTTP return code (100) for 'Continue'.

+HTTP-CREATED+

HTTP return code (201) for 'Created'.

+HTTP-EXPECTATION-FAILED+

HTTP return code (417) for 'Expectation Failed'.

+HTTP-FAILED-DEPENDENCY+

HTTP return code (424) for 'Failed Dependency'.

+HTTP-FORBIDDEN+

HTTP return code (403) for 'Forbidden'.

+HTTP-GATEWAY-TIME-OUT+

HTTP return code (504) for 'Gateway Time-out'.

+HTTP-GONE+

HTTP return code (410) for 'Gone'.

+HTTP-INTERNAL-SERVER-ERROR+

HTTP return code (500) for 'Internal Server Error'.

+HTTP-LENGTH-REQUIRED+

HTTP return code (411) for 'Length Required'.

+HTTP-METHOD-NOT-ALLOWED+

HTTP return code (405) for 'Method Not Allowed'.

+HTTP-MOVED-PERMANENTLY+

HTTP return code (301) for 'Moved Permanently'.

+HTTP-MOVED-TEMPORARILY+

HTTP return code (302) for 'Moved Temporarily'.

+HTTP-MULTI-STATUS+

HTTP return code (207) for 'Multi-Status'.

+HTTP-MULTIPLE-CHOICES+

HTTP return code (300) for 'Multiple Choices'.

+HTTP-NO-CONTENT+

HTTP return code (204) for 'No Content'.

+HTTP-NON-AUTHORITATIVE-INFORMATION+

HTTP return code (203) for 'Non-Authoritative Information'.

+HTTP-NOT-ACCEPTABLE+

HTTP return code (406) for 'Not Acceptable'.

+HTTP-NOT-FOUND+

HTTP return code (404) for 'Not Found'.

+HTTP-NOT-IMPLEMENTED+

HTTP return code (501) for 'Not Implemented'.

+HTTP-NOT-MODIFIED+

HTTP return code (304) for 'Not Modified'.

+HTTP-OK+

HTTP return code (200) for 'OK'.

+HTTP-PARTIAL-CONTENT+

HTTP return code (206) for 'Partial Content'.

+HTTP-PAYMENT-REQUIRED+

HTTP return code (402) for 'Payment Required'.

+HTTP-PRECONDITION-FAILED+

HTTP return code (412) for 'Precondition Failed'.

+HTTP-PROXY-AUTHENTICATION-REQUIRED+

HTTP return code (407) for 'Proxy Authentication Required'.

+HTTP-REQUEST-ENTITY-TOO-LARGE+

HTTP return code (413) for 'Request Entity Too Large'.

+HTTP-REQUEST-TIME-OUT+

HTTP return code (408) for 'Request Time-out'.

+HTTP-REQUEST-URI-TOO-LARGE+

HTTP return code (414) for 'Request-URI Too Large'.

+HTTP-REQUESTED-RANGE-NOT-SATISFIABLE+

HTTP return code (416) for 'Requested range not satisfiable'.

+HTTP-RESET-CONTENT+

HTTP return code (205) for 'Reset Content'.

+HTTP-SEE-OTHER+

HTTP return code (303) for 'See Other'.

+HTTP-SERVICE-UNAVAILABLE+

HTTP return code (503) for 'Service Unavailable'.

+HTTP-SWITCHING-PROTOCOLS+

HTTP return code (101) for 'Switching Protocols'.

+HTTP-TEMPORARY-REDIRECT+

HTTP return code (307) for 'Temporary Redirect'.

+HTTP-UNSUPPORTED-MEDIA-TYPE+

HTTP return code (415) for 'Unsupported Media Type'.

+HTTP-USE-PROXY+

HTTP return code (305) for 'Use Proxy'.

+HTTP-VERSION-NOT-SUPPORTED+

HTTP return code (505) for 'Version not supported'.

Private

+BUFFER-LENGTH+

Length of buffers used for internal purposes.

+CRLF+

A 2-element array consisting of the character codes for a CRLF sequence.

+DAY-NAMES+

The three-character names of the seven days of the week - needed for cookie date format.

+LATIN-1+

A FLEXI-STREAMS external format used for `faithful' input and output of binary data.

+MONTH-NAMES+

The three-character names of the twelve months - needed for cookie date format.

+NEW-CONNECTION-WAIT-TIME+

Time in seconds to wait for a new connection to arrive before performing a cleanup run.

+UTF-8+

A FLEXI-STREAMS external format used internally for logging and to encode cookie values.