rest25/library/cgihttpserver.rst => rest262/library/cgihttpserver.rst
n1- 
2:mod:`CGIHTTPServer` --- CGI-capable HTTP request handler
3=========================================================
4
5.. module:: CGIHTTPServer
6   :synopsis: This module provides a request handler for HTTP servers which can run CGI
7              scripts.
8.. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il>
n8+ 
9+.. note::
10+   The :mod:`CGIHTTPServer` module has been merged into :mod:`http.server` in
11+   Python 3.0.  The :term:`2to3` tool will automatically adapt imports when
12+   converting your sources to 3.0.
9
10
11The :mod:`CGIHTTPServer` module defines a request-handler class, interface
12compatible with :class:`BaseHTTPServer.BaseHTTPRequestHandler` and inherits
13behavior from :class:`SimpleHTTPServer.SimpleHTTPRequestHandler` but can also
14run CGI scripts.
15
16.. note::
17
n18-   This module can run CGI scripts on Unix and Windows systems; on Mac OS it will
n22+   This module can run CGI scripts on Unix and Windows systems.
19-   only be able to run Python scripts within the same process as itself.
20
21.. note::
22
23   CGI scripts run by the :class:`CGIHTTPRequestHandler` class cannot execute
24   redirects (HTTP code 302), because code 200 (script output follows) is sent
25   prior to execution of the CGI script.  This pre-empts the status code.
26
27The :mod:`CGIHTTPServer` module defines the following class:
38   it guesses it to be a CGI script. Only directory-based CGI are used --- the
39   other common server configuration is to treat special extensions as denoting CGI
40   scripts.
41
42   The :func:`do_GET` and :func:`do_HEAD` functions are modified to run CGI scripts
43   and serve the output, instead of serving files, if the request leads to
44   somewhere below the ``cgi_directories`` path.
45
n46-The :class:`CGIHTTPRequestHandler` defines the following data member:
n49+   The :class:`CGIHTTPRequestHandler` defines the following data member:
47
48
n49-.. attribute:: CGIHTTPRequestHandler.cgi_directories
n52+   .. attribute:: cgi_directories
50
n51-   This defaults to ``['/cgi-bin', '/htbin']`` and describes directories to treat
n54+      This defaults to ``['/cgi-bin', '/htbin']`` and describes directories to
52-   as containing CGI scripts.
55+      treat as containing CGI scripts.
53
n54-The :class:`CGIHTTPRequestHandler` defines the following methods:
n57+   The :class:`CGIHTTPRequestHandler` defines the following methods:
55
56
n57-.. method:: CGIHTTPRequestHandler.do_POST()
n60+   .. method:: do_POST()
58
t59-   This method serves the ``'POST'`` request type, only allowed for CGI scripts.
t62+      This method serves the ``'POST'`` request type, only allowed for CGI
60-   Error 501, "Can only POST to CGI scripts", is output when trying to POST to a
63+      scripts.  Error 501, "Can only POST to CGI scripts", is output when trying
61-   non-CGI url.
64+      to POST to a non-CGI url.
62
63Note that CGI scripts will be run with UID of user nobody, for security reasons.
64Problems with the CGI script will be translated to error 403.
65
66For example usage, see the implementation of the :func:`test` function.
67
68
69.. seealso::
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op