diff options
author | Fred Drake <fdrake@acm.org> | 1999-06-14 19:47:47 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 1999-06-14 19:47:47 (GMT) |
commit | 21572fdcb60a6ab033a2dff66f871389ca1a89c1 (patch) | |
tree | 87e11d0cd3aecf1717d37d8a6affedfbb2616a37 /Doc/lib/libcgihttp.tex | |
parent | d5258681e7838d8c0e16b9b3448ce4105340ea79 (diff) | |
download | cpython-21572fdcb60a6ab033a2dff66f871389ca1a89c1.zip cpython-21572fdcb60a6ab033a2dff66f871389ca1a89c1.tar.gz cpython-21572fdcb60a6ab033a2dff66f871389ca1a89c1.tar.bz2 |
New sections from Moshe Zadka <moshez@math.huji.ac.il>.
These document CGIHTTPServer, SimpleHTTPServer, and linecache.
Diffstat (limited to 'Doc/lib/libcgihttp.tex')
-rw-r--r-- | Doc/lib/libcgihttp.tex | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/Doc/lib/libcgihttp.tex b/Doc/lib/libcgihttp.tex new file mode 100644 index 0000000..fd8e09b --- /dev/null +++ b/Doc/lib/libcgihttp.tex @@ -0,0 +1,61 @@ +\section{\module{CGIHTTPServer} --- + A Do-Something Request Handler} + + +\declaremodule{standard}{CGIHTTPServer} +\sectionauthor{Moshe Zadka}{mzadka@geocities.com} +\modulesynopsis{This module provides a request handler for HTTP servers + which can run CGI scripts.} + + +The \module{CGIHTTPServer} module defines a request-handler class, +interface compatible with +\class{BaseHTTPServer.BaseHTTPRequestHandler} and inherits behaviour +from \class{SimpleHTTPServer.SimpleHTTPRequestHandler} but can also +run CGI scripts. + +The \module{CGIHTTPServer} module defines the following class: + +\begin{classdesc}{CGIHTTPRequestHandler}{request, client_address, server} +This class is used to serve either files or output of CGI scripts from +the current directory and below. Note that mapping HTTP hierarchic +structure to local directory structure is exactly as in +\class{SimpleHTTPServer.SimpleHTTPRequestHandler}. + +The class will however, run the CGI script, instead of serving it as a +file, if it guesses it to be a CGI script. Only directory-based CGI +are used --- the other common server configuration is to treat special +extensions as denoting CGI scripts. + +The \function{do_GET()} and \function{do_HEAD()} functions are +modified to run CGI scripts and serve the output, instead of serving +files, if the request leads to somewhere below the +\code{cgi_directories} path. +\end{classdesc} + +The \class{CGIHTTPRequestHandler} defines the following data member: + +\begin{memberdesc}{cgi_directories} +This defaults to \code{['/cgi-bin', '/htbin']} and describes +directories to treat as containing CGI scripts. +\end{memberdesc} + +The \class{CGIHTTPRequestHandler} defines the following methods: + +\begin{methoddesc}{do_POST}{} +This method serves the \code{'POST'} request type, only allowed for +CGI scripts. Error 501, "Can only POST to CGI scripts", is output +when trying to POST to a non-CGI url. +\end{methoddesc} + +Note that CGI scripts will be run with UID of user nobody, for security +reasons. Problems with the CGI script will be translated to error 403. + +For example usage, see the implementation of the \function{test()} +function. + + +\begin{seealso} + \seemodule{BaseHTTPServer}{Base class implementation for Web server + and request handler.} +\end{seealso} |