The HTTP-SERVER library#

The HTTP-SERVER module#

*command-line-parser* Variable#
*log-content?* Variable#
<abstract-resource> Open Abstract Class#
Superclasses:

<object>

<abstract-rewrite-rule> Open Abstract Class#
Superclasses:

<object>

Init-Keywords:
  • redirect-code

  • terminal?

<abstract-router> Open Abstract Class#
Superclasses:

<object>

<configuration-error> Class#
Superclasses:

<http-server-api-error>

<directory-resource> Open Class#
Superclasses:

<resource>

Init-Keywords:
  • allow-directory-listing?

  • allow-multi-views?

  • default-documents

  • directory

  • follow-symlinks?

<function-resource> Open Class#
Superclasses:

<resource>

Init-Keywords:
  • function

  • methods

<http-server> Open Class#
Superclasses:

<multi-logger-mixin>:httpi, <abstract-router>

Init-Keywords:
  • clients-shutdown-notification

  • debug

  • default-virtual-host

  • listeners

  • listeners-shutdown-notification

  • lock

  • media-type-map

  • server-root

  • session-id

  • session-max-age

  • use-default-virtual-host?

  • virtual-hosts

<http-server-api-error> Open Class#
Superclasses:

<http-server-error>:httpi

<page-context> Class#
Superclasses:

<attributes-mixin>:http-common:http-common

<redirecting-resource> Class#
Superclasses:

<resource>

Init-Keywords:
  • target

<request> Open Primary Class#
Superclasses:

<chunking-input-stream>:http-common:http-common, <base-http-request>:http-common:http-common

<resource> Open Class#
Superclasses:

<abstract-resource>, <abstract-router>

<response> Open Primary Class#
Superclasses:

<string-stream>:streams:io, <base-http-response>:http-common:http-common

Init-Keywords:
  • direction

<rewrite-rule> Class#
Superclasses:

<abstract-rewrite-rule>

Init-Keywords:
  • regex

  • replacement

<session> Open Primary Class#
Superclasses:

<attributes-mixin>:http-common:http-common

Init-Keywords:
  • id

  • server

<virtual-host> Class#
Superclasses:

<multi-logger-mixin>:httpi, <abstract-router>, <abstract-resource>

Init-Keywords:
  • router

Signature:

add-cookie (response name value) => (#rest results)

Parameters:
  • response – An instance of <object>.

  • name – An instance of <object>.

  • value – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

add-resource Open Generic function#
Signature:

add-resource (router url resource #key #all-keys) => (#rest results)

Parameters:
  • router – An instance of <abstract-router>.

  • url – An instance of <object>.

  • resource – An instance of <abstract-resource>.

Values:
  • #rest results – An instance of <object>.

add-resource-name Open Generic function#
Signature:

add-resource-name (name resource) => (#rest results)

Parameters:
  • name – An instance of <string>.

  • resource – An instance of <resource>.

Values:
  • #rest results – An instance of <object>.

add-virtual-host Open Generic function#
Signature:

add-virtual-host (server fqdn vhost) => ()

Parameters:
  • server – An instance of <http-server>.

  • fqdn – An instance of <string>.

  • vhost – An instance of <virtual-host>.

clear-session Generic function#
Signature:

clear-session (request) => (#rest results)

Parameters:
  • request – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

configure-server Generic function#
Signature:

configure-server (server config-file) => (#rest results)

Parameters:
  • server – An instance of <object>.

  • config-file – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

count-query-values Function#
Signature:

count-query-values () => (count)

Values:
  • count – An instance of <integer>.

current-request Function#
Signature:

current-request () => (request)

Values:
  • request – An instance of <request>.

current-response Function#
Signature:

current-response () => (response)

Values:
  • response – An instance of <response>.

current-server Function#
Signature:

current-server () => (server)

Values:
  • server – An instance of <http-server>.

debugging-enabled? Generic function#
Signature:

debugging-enabled? (object) => (#rest results)

Parameters:
  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

debugging-enabled?-setter Generic function#
Signature:

debugging-enabled?-setter (value object) => (#rest results)

Parameters:
  • value – An instance of <object>.

  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

default-content-type Open Generic function#
Signature:

default-content-type (resource) => (content-type)

Parameters:
  • resource – An instance of <abstract-resource>.

Values:
  • content-type – An instance of type-union(<mime-type>, <string>).

default-documents Generic function#
Signature:

default-documents (object) => (#rest results)

Parameters:
  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

default-virtual-host Generic function#
Signature:

default-virtual-host (object) => (#rest results)

Parameters:
  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

default-virtual-host-setter Generic function#
Signature:

default-virtual-host-setter (value object) => (#rest results)

Parameters:
  • value – An instance of <object>.

  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

do-query-values Generic function#
Signature:

do-query-values (f) => (#rest results)

Parameters:
  • f – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

do-resources Open Generic function#
Signature:

do-resources (router function #key seen) => ()

Parameters:
  • router – An instance of <abstract-router>.

  • function – An instance of <function>.

  • seen (#key) – An instance of <object>.

ensure-session Generic function#
Signature:

ensure-session (request) => (#rest results)

Parameters:
  • request – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

file-contents Function#
Signature:

file-contents (filename #key error?) => (contents)

Parameters:
  • filename – An instance of <pathname>:file-system:system.

  • error? (#key) – An instance of <boolean>.

Values:
  • contents – An instance of false-or(<string>).

find-resource Open Generic function#
Signature:

find-resource (router url) => (resource prefix suffix)

Parameters:
  • router – An instance of <abstract-router>.

  • url – An instance of <object>.

Values:
  • resource – An instance of <abstract-resource>.

  • prefix – An instance of <list>.

  • suffix – An instance of <list>.

find-virtual-host Open Generic function#
Signature:

find-virtual-host (server fqdn) => (vhost)

Parameters:
  • server – An instance of <http-server>.

  • fqdn – An instance of <string>.

Values:
  • vhost – An instance of <virtual-host>.

function-resource Function#
Signature:

function-resource (function #key methods) => (resource)

Parameters:
  • function – An instance of <function>.

  • methods (#key) – An instance of <object>.

Values:
  • resource – An instance of <resource>.

generate-url Open Generic function#
Signature:

generate-url (router name #key #all-keys) => (url)

Parameters:
  • router – An instance of <abstract-router>.

  • name – An instance of <string>.

Values:
  • url – An instance of <object>.

get-attr Generic function#
Signature:

get-attr (node attrib) => (#rest results)

Parameters:
  • node – An instance of <object>.

  • attrib – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

get-query-value Function#
Signature:

get-query-value (key #key as) => (value)

Parameters:
  • key – An instance of <string>.

  • as (#key) – An instance of false-or(<type>).

Values:
  • value – An instance of <object>.

Return the first (and usually the only) query value associated with key, or #f if no value found.

Query values are any values from the query portion of the URL or from POST data for requests encoded as either application/x-www-form-urlencoded or multipart/form-data.

See also: get-query-values

get-query-values Function#
Signature:

get-query-values (key) => (values)

Parameters:
  • key – An instance of <string>.

Values:
  • values – An instance of <sequence>.

Returns all query values associated with key, or an empty sequence if no values are found.

Query values are any values from the query portion of the URL or from POST data for requests encoded as either application/x-www-form-urlencoded or multipart/form-data. In some cases, such as file upload that allows multiple file to be selected, there may be several values for a single key and get-query-values is what you need in that case.

For most common cases, however, get-query-value is the right choice.

get-session Generic function#
Signature:

get-session (request) => (#rest results)

Parameters:
  • request – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

http-server-main Function#
Signature:

http-server-main (#key server description before-startup) => ()

Parameters:
  • server (#key) – An instance of false-or(<http-server>).

  • description (#key) – An instance of false-or(<string>).

  • before-startup (#key) – An instance of false-or(<function>).

log-content Generic function#
Signature:

log-content (content) => (#rest results)

Parameters:
  • content – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

log-debug Constant#
log-error Constant#
log-info Constant#
log-trace Constant#
log-warning Constant#
output Function#
Signature:

output (format-string #rest format-args) => (#rest results)

Parameters:
  • format-string – An instance of <object>.

  • format-args (#rest) – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

page-context Generic function#
Signature:

page-context () => (#rest results)

Values:
  • #rest results – An instance of <object>.

process-config-element Open Generic function#
Signature:

process-config-element (server node name) => (#rest results)

Parameters:
  • server – An instance of <http-server>.

  • node – An instance of <object>.

  • name – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

process-request-content Open Generic function#
Signature:

process-request-content (request content-type) => (#rest results)

Parameters:
  • request – An instance of <request>.

  • content-type – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

redirect-temporarily-to Open Generic function#
Signature:

redirect-temporarily-to (object) => (#rest results)

Parameters:
  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

redirect-to Open Generic function#
Signature:

redirect-to (object) => (#rest results)

Parameters:
  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

request-absolute-url Generic function#
Signature:

request-absolute-url (request) => (#rest results)

Parameters:
  • request – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

request-content-type Function#
Signature:

request-content-type (request) => (#rest results)

Parameters:
  • request – An instance of <request>.

Values:
  • #rest results – An instance of <object>.

request-host Generic function#
Signature:

request-host (object) => (#rest results)

Parameters:
  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

request-query-values Generic function#
Signature:

request-query-values (object) => (#rest results)

Parameters:
  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

request-url-path-prefix Generic function#
Signature:

request-url-path-prefix (object) => (#rest results)

Parameters:
  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

request-url-path-suffix Generic function#
Signature:

request-url-path-suffix (object) => (#rest results)

Parameters:
  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

respond Open Generic function#
Signature:

respond (resource #key #all-keys) => (#rest results)

Parameters:
  • resource – An instance of <abstract-resource>.

Values:
  • #rest results – An instance of <object>.

respond-to-connect Open Generic function#
Signature:

respond-to-connect (resource #key #all-keys) => (#rest results)

Parameters:
  • resource – An instance of <abstract-resource>.

Values:
  • #rest results – An instance of <object>.

respond-to-delete Open Generic function#
Signature:

respond-to-delete (resource #key #all-keys) => (#rest results)

Parameters:
  • resource – An instance of <abstract-resource>.

Values:
  • #rest results – An instance of <object>.

respond-to-get Open Generic function#
Signature:

respond-to-get (resource #key #all-keys) => (#rest results)

Parameters:
  • resource – An instance of <abstract-resource>.

Values:
  • #rest results – An instance of <object>.

respond-to-head Open Generic function#
Signature:

respond-to-head (resource #key #all-keys) => (#rest results)

Parameters:
  • resource – An instance of <abstract-resource>.

Values:
  • #rest results – An instance of <object>.

respond-to-options Open Generic function#
Signature:

respond-to-options (resource #key #all-keys) => (#rest results)

Parameters:
  • resource – An instance of <abstract-resource>.

Values:
  • #rest results – An instance of <object>.

respond-to-post Open Generic function#
Signature:

respond-to-post (resource #key #all-keys) => (#rest results)

Parameters:
  • resource – An instance of <abstract-resource>.

Values:
  • #rest results – An instance of <object>.

respond-to-put Open Generic function#
Signature:

respond-to-put (resource #key #all-keys) => (#rest results)

Parameters:
  • resource – An instance of <abstract-resource>.

Values:
  • #rest results – An instance of <object>.

respond-to-trace Open Generic function#
Signature:

respond-to-trace (resource #key #all-keys) => (#rest results)

Parameters:
  • resource – An instance of <abstract-resource>.

Values:
  • #rest results – An instance of <object>.

rewrite-url Open Generic function#
Signature:

rewrite-url (url rule) => (url extra)

Parameters:
  • url – An instance of <string>.

  • rule – An instance of <object>.

Values:
  • url – An instance of <string>.

  • extra – An instance of <object>.

route-request Generic function#
Signature:

route-request (server request) => (#rest results)

Parameters:
  • server – An instance of <object>.

  • request – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

serve-static-file Generic function#
Signature:

serve-static-file (policy locator) => (#rest results)

Parameters:
  • policy – An instance of <object>.

  • locator – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

server-root Generic function#
Signature:

server-root (object) => (#rest results)

Parameters:
  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

start-server Open Generic function#
Signature:

start-server (server #key background wait) => (started?)

Parameters:
  • server – An instance of <http-server>.

  • background (#key) – An instance of <boolean>.

  • wait (#key) – An instance of <boolean>.

Values:
  • started? – An instance of <boolean>.

stop-server Open Generic function#
Signature:

stop-server (server #key abort) => (#rest results)

Parameters:
  • server – An instance of <http-server>.

  • abort (#key) – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

unmatched-url-suffix Open Generic function#
Signature:

unmatched-url-suffix (resource unmatched-path) => (#rest results)

Parameters:
  • resource – An instance of <abstract-resource>.

  • unmatched-path – An instance of <sequence>.

Values:
  • #rest results – An instance of <object>.

use-default-virtual-host? Generic function#
Signature:

use-default-virtual-host? (object) => (#rest results)

Parameters:
  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

with-query-values Macro#