summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2011-03-31 16:36:01 +0200
committerAndy Wingo <wingo@pobox.com>2011-03-31 16:36:01 +0200
commit09b7459b49f699a0ef95223bd35a0e88b8437a56 (patch)
tree265deddf70360b284410b1aa60d600ecefa8eaea
parent2ebdf6b5551646804e3adc2fc4a9acb896210f89 (diff)
downloadguile-09b7459b49f699a0ef95223bd35a0e88b8437a56.tar.gz
web.texi: handler return types documentation
* doc/ref/web.texi (Web Server): More docs on handler return types.
-rw-r--r--doc/ref/web.texi21
1 files changed, 14 insertions, 7 deletions
diff --git a/doc/ref/web.texi b/doc/ref/web.texi
index dd2e3962d..46d4cfbdd 100644
--- a/doc/ref/web.texi
+++ b/doc/ref/web.texi
@@ -1325,13 +1325,20 @@ If the read failed, the @code{read} hook may return #f for the client
socket, request, and body.
@item
-A user-provided handler procedure is called, with the request
-and body as its arguments. The handler should return two
-values: the response, as a @code{<response>} record from @code{(web
-response)}, and the response body as a string, bytevector, or
-@code{#f} if not present. We also allow the response to be simply an
-alist of headers, in which case a default response object is
-constructed with those headers.
+A user-provided handler procedure is called, with the request and body
+as its arguments. The handler should return two values: the response,
+as a @code{<response>} record from @code{(web response)}, and the
+response body as bytevector, or @code{#f} if not present.
+
+The respose and response body are run through @code{sanitize-response},
+documented below. This allows the handler writer to take some
+convenient shortcuts: for example, instead of a @code{<response>}, the
+handler can simply return an alist of headers, in which case a default
+response object is constructed with those headers. Instead of a
+bytevector for the body, the handler can return a string, which will be
+serialized into an appropriate encoding; or it can return a procedure,
+which will be called on a port to write out the data. See the
+@code{sanitize-response} documentation, for more.
@item
The @code{write} hook is called with three arguments: the client