From 35ca7dabe9c526199026d25bf6722c9bd06eebf3 Mon Sep 17 00:00:00 2001 From: sperber Date: Tue, 14 Jan 2003 13:36:26 +0000 Subject: [PATCH] Document response bodies and MAKE-REDIRECT-RESPONSE. --- doc/latex/httpd.tex | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/doc/latex/httpd.tex b/doc/latex/httpd.tex index b21b327..4d1d286 100644 --- a/doc/latex/httpd.tex +++ b/doc/latex/httpd.tex @@ -232,6 +232,13 @@ constructing responses lives in the \ex{httpd-responses} structure. represents the body of the response; more on that below. \end{desc} +\defun{make-redirect-response}{location}{response} +\begin{desc} + This is a helper procedure for constructing HTTP redirections. The + server will serve the new file indicated by \var{location}. + \var{Location} must be URI-encoded and begin with a slash. +\end{desc} + \defun{make-error-response}{status-code request [message] extras \ldots}{response} \begin{desc} This is a helper procedure for constructing error responses. @@ -295,6 +302,33 @@ constructing responses lives in the \ex{httpd-responses} structure. \ex{status-code-message} extracts its associated default message. \end{desc} +\section{Response Bodies} +\label{httpd:response-bodies} + +A \textit{response body} represents the body of an HTTP response. +There are several types of response bodies, depending on the +requirements on content generation. + +\defun{make-writer-body}{proc}{body} +\begin{desc} + This constructs a response body from a \textit{writer}---a procedure + that prints the page contents to a port. The \var{proc} argument + must be a procedure accepting an output port (to which \var{proc} + prints the body) and the options value passed to the \ex{httpd} + invocation. +\end{desc} + +\defun{make-reader-writer-body}{proc}{body} +\begin{desc} + This constructs a response body from a \textit{reader/writer}---a + procedure that prints the page contents to a port, possibly after + reading input from the socket of the HTTP connection. The + \var{proc} argument must be a procedure accepting three arguments: + an input port (associated with the HTTP connection socket), an + output port (to which \var{proc} prints the body), and the options + value passed to the \ex{httpd} invocation. +\end{desc} + \section{Request Handlers} \label{httpd:request-handlers} @@ -500,6 +534,9 @@ Dito, but also serve directory indices for directories without \section{CGI Server} +The procedure(s) described here live in the \ex{httpd-cgi-handlers} +structure. + \defun{cgi-handler}{bin-dir [cgi-bin-path]}{request-handler} \begin{desc} Returns a request handler for CGI scripts located in