httpd0 API Documentation
httpd0
HTTP/1.0 GET/HEAD server. Server responses are generated by functions implementing the responder function interface:
— Function: <responder> resource if-modified-since
Arguments and Values:
resource—a pathname.
if-modified-since—the value of the If-Modified-Since header represented as a universal time.
Description:
A responder function must produce a response to the request to resource using the helper functions provided by the httpd0.responses package.
See Also:
- If-Modified-Since
- httpd0.responses
*request‑size* (Variable)
Initial Value:
512
Description:
Maximum request size in characters. Requests exceeding *request-size* are dropped by closing the connection.
*request‑timeout* (Variable)
Initial Value:
64
Description:
I/O timeout in seconds. Requests that are stalled by an I/O operation with the client for more than the specified duration are dropped by closing the connection.
destroy‑httpd (Function)
Syntax:
— Function: destroy‑httpd httpd
Arguments and Values:
httpd—an httpd0 instance as returned by make-httpd.
Description:
destory-httpd stops httpd and frees its resources.
make‑httpd (Function)
Syntax:
— Function: make‑httpd responder &key host port n‑threads socket‑backlog
Arguments and Values:
responder—a responder function.
host—the host address to listen on as a string. The default is the wildcard address.
port—a local port number. The default is 8080.
n-threads—a positive integer specifying the number of threads to keep in the thread pool. Must be at least two. The default is 16.
socket-backlog—a positive integer specifying the socket backlog. The default is 32.
Description:
make-httpd creates a httpd0 server instance with responder that listens on the specified host and port.
make‑resource‑responder (Function)
Syntax:
— Function: make‑resource‑responder root
Arguments and Values:
root—a directory pathname.
Description:
make-resource-responder returns a responder function that serves the files under root.
httpd0.responses
Toolkit for writing responder functions. Includes common responses and generic response templates.
*protocol‑version* (Variable)
Initial Value:
NIL
Description:
*protocol-version* is bound to a symbol indicating the protocol version is use when calling a responder function. *protocol-version* can be either :0.9 or :1.0 to indicate HTTP/0.9 or HTTP/1.0 respectively.
*request‑method* (Variable)
Initial Value:
NIL
Description:
*request-method* is bound to a symbol indicating the request method served when calling a responder function. *request-method* can be either :get or :head indicating a GET or HEAD request respectively.
*text‑mime* (Variable)
Initial Value:
("text" "plain; charset=utf-8")
Description:
*text-mime* is bound to a list of two strings that designates a MIME type, to which responses for the text/plain MIME type will be upgraded to.
respond‑moved‑permanently (Function)
Syntax:
— Function: respond‑moved‑permanently location
Arguments and Values:
location—a string denoting a URI.
Description:
respond-moved-permanently responds with HTTP status :moved-permanently to location.
respond‑not‑found (Function)
Syntax:
— Function: respond‑not‑found <no arguments>
Arguments and Values:
None.
Description:
respond-not-found responds with HTTP status :not-found.
respond‑not‑implemented (Function)
Syntax:
— Function: respond‑not‑implemented <no arguments>
Arguments and Values:
None.
Description:
respond-not-implemented responds with HTTP status :not-implemented.
respond‑not‑modified (Function)
Syntax:
— Function: respond‑not‑modified <no arguments>
Arguments and Values:
None.
Description:
respond-not-modified responds with HTTP status :not-modified.
respond‑ok (Macro)
Syntax:
— Macro: respond‑ok (length type write‑date) &body body
Arguments and Values:
length—a non-negative integer.
type—a list of two strings designating a MIME type.
write-date—a universal time.
body—forms that print length bytes to *standard-output*.
Description:
respond-ok responds with HTTP status :ok for an entity of length bytes with MIME type and write-date. The body forms must write the contents of the HTTP entity to *standard-output*.
uri‑encode (Function)
Syntax:
— Function: uri‑encode string
Arguments and Values:
string—a string.
Description:
uri-encode returns an URI safe copy of string. Note that uri-encode will not encode reserved characters.
See Also: