2002-03-03 07:06:35 -05:00
|
|
|
\section{CGI server}\label{sec:cgi-server}
|
2002-02-12 06:50:54 -05:00
|
|
|
%
|
|
|
|
\begin{description}
|
|
|
|
\item[Used files:] cgi-server.scm
|
|
|
|
\item[Name of the package:] cgi-server
|
|
|
|
\end{description}
|
|
|
|
%
|
2002-04-14 13:04:26 -04:00
|
|
|
\subsection{Procedures}
|
|
|
|
|
2002-04-25 05:35:18 -04:00
|
|
|
\begin{defundesc}{cgi-handler}{bin-dir \ovar{cgi-bin-dir}}{path-handler}
|
2002-04-14 13:04:26 -04:00
|
|
|
Returns a path handler (see \ref{httpd:path-handlers} for details
|
|
|
|
about path handlers) for cgi-scripts located in
|
2002-04-25 05:35:18 -04:00
|
|
|
\semvar{bin-dir}. \semvar{cgi-bin-dir} specifies the value of the
|
|
|
|
\ex{PATH} variable of the environment the cgi-scripts run in. It defaults
|
|
|
|
to
|
|
|
|
``\ex{/bin:\ob{}/usr/bin:\ob{}/usr/ucb:\ob{}/usr/bsd:\ob{}/usr/local/bin}''
|
|
|
|
but is overwritten by the current \ex{PATH} environment variable at
|
|
|
|
the time \ex{cgi-handler} ist called. The cgi-scripts are called as
|
|
|
|
specified by CGI/1.1\footnote{see
|
2002-04-14 13:04:26 -04:00
|
|
|
\ex{http://hoohoo.ncsa.uiuc.edu/cgi/interface.html} for a sort of
|
2002-04-25 05:35:18 -04:00
|
|
|
specification.}.
|
2002-04-14 13:04:26 -04:00
|
|
|
|
|
|
|
\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}
|
2002-04-25 05:35:18 -04:00
|
|
|
\end{defundesc}
|