sunet/doc/latex/cgi-server.tex

54 lines
1.9 KiB
TeX

\section{CGI server}\label{sec:cgi-server}
%
\begin{description}
\item[Used files:] cgi-server.scm
\item[Name of the package:] cgi-server
\end{description}
%
\subsection{Variables}
\defvar{cgi-default-bin-path}{string}
\begin{desc}
This variable contains the path for scripts. Its value is
\codex{/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin}
\end{desc}
\subsection{Procedures}
\begin{defundesc}{cgi-handler}{bin-dir}{path-handler}
Returns a path handler (see \ref{httpd:path-handlers} for details
about path handlers) for cgi-scripts located in
\semvar{bin-dir}. The scripts are called as specified by
CGI/1.1\footnote{see
\ex{http://hoohoo.ncsa.uiuc.edu/cgi/interface.html} for a sort of
specification.}.
\begin{itemize}
\item Various environment variables are set (like
\ex{QUERY\_STRING} or \ex{REMOTE\_HOST}).
\item ISINDEX queries get their arguments as command line arguments.
\item Scripts are handled differently according to their name:
\begin{itemize}
\item If the name of the script starts with `\ex{nph-}', its reply
is read, the RFC~822-fields like ``Content-Type'' and ``Status''
are parsed and the client is sent back a real HTTP reply,
containing the rest of the script's output.
\item If the name of the script doesn't start with `\ex{nph-}',
its output is sent back to the client directly. If its return code
is not zero, an error message is generated.
\end{itemize}
\end{itemize}
\end{defundesc}
\begin{defundesc}{initialise-request-invariant-cgi-env}{}{\noreturn}
Initializes the environment variables that are invariant from
cgi-call to cgi-call in order to save calculation time. Call this
procedure before you start your httpd. You have to do this, if you
use cgi-scripts, that read out the environment variables \ex{PATH},
\ex{SERVER\_SOFTWARE}, \ex{SERVER\_NAME} or \ex{GATEWAY\_INTERFACE}.
\end{defundesc}