[Python-checkins] python/nondist/peps pep-0333.txt,1.21,1.22
pje at users.sourceforge.net
pje at users.sourceforge.net
Sun Oct 17 15:34:34 CEST 2004
Update of /cvsroot/python/python/nondist/peps
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21685
Modified Files:
pep-0333.txt
Log Message:
Add SERVER_PROTOCOL as a required variable, since it's needed in order to
obey the RFC's. Note that 'wsgi.errors' should be a "text mode" file. Fix
a problem with the "URL reconstruction" algorithm: HTTP_HOST can contain
a port number, so don't try to add SERVER_PORT if you use HTTP_HOST.
Index: pep-0333.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0333.txt,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- pep-0333.txt 6 Oct 2004 06:23:54 -0000 1.21
+++ pep-0333.txt 17 Oct 2004 13:34:31 -0000 1.22
@@ -531,6 +531,16 @@
section below for more detail. ``SERVER_NAME`` and ``SERVER_PORT``
can never be empty strings, and so are always required.
+``SERVER_PROTOCOL``
+ The version of the protocol the client used to send the request.
+ Typically this will be something like ``"HTTP/1.0"`` or ``"HTTP/1.1"``
+ and may be used by the application to determine how to treat any
+ HTTP request headers. (This variable should probably be called
+ ``REQUEST_PROTOCOL``, since it denotes the protocol used in the
+ request, and is not necessarily the protocol that will be used in the
+ server's response. However, for compatibility with CGI we have to
+ keep the existing name.)
+
``HTTP_`` Variables
Variables corresponding to the client-supplied HTTP request headers
(i.e., variables whose names begin with ``"HTTP_"``). The presence or
@@ -541,7 +551,7 @@
variables as are applicable. In addition, if SSL is in use, the server
or gateway **should** also provide as many of the Apache SSL environment
variables [5]_ as are applicable, such as ``HTTPS=on`` and
-``SSL_PROTOCOL``. Note, however, an application that uses any CGI
+``SSL_PROTOCOL``. Note, however, that an application that uses any CGI
variables other than the ones listed above are necessarily non-portable
to web servers that do not support the relevant extensions. (For
example, web servers that do not publish files will not be able to
@@ -586,16 +596,19 @@
error output can be written, for the purpose of
recording program or other errors in a
standardized and possibly centralized location.
- For many servers, this will be the server's
- main error log.
+ This should be a "text mode" stream; i.e.,
+ applications should use ``"\n"`` as a line
+ ending, and assume that it will be converted to
+ the correct line ending by the server/gateway.
- Alternatively, this may be ``sys.stderr``, or
- a log file of some sort. The server's
- documentation should include an explanation of
- how to configure this or where to find the
- recorded output. A server or gateway may
- supply different error streams to different
- applications, if this is desired.
+ For many servers, ``wsgi.errors`` will be the
+ server's main error log. Alternatively, this
+ may be ``sys.stderr``, or a log file of some
+ sort. The server's documentation should
+ include an explanation of how to configure this
+ or where to find the recorded output. A server
+ or gateway may supply different error streams
+ to different applications, if this is desired.
``wsgi.multithread`` This value should evaluate true if the
application object may be simultaneously
@@ -938,7 +951,7 @@
words, before ``write()`` returns, it must guarantee that the
passed-in string was either completely sent to the client, or
that it is buffered for transmission while the application
-proceeds forward.
+proceeds onward.
An application **must** return an iterable object, even if it
uses ``write()`` to produce all or part of its response body.
@@ -1247,12 +1260,12 @@
else:
url += environ['SERVER_NAME']
- if environ['wsgi.url_scheme'] == 'https':
- if environ['SERVER_PORT'] != '443':
- url += ':' + environ['SERVER_PORT']
- else:
- if environ['SERVER_PORT'] != '80':
- url += ':' + environ['SERVER_PORT']
+ if environ['wsgi.url_scheme'] == 'https':
+ if environ['SERVER_PORT'] != '443':
+ url += ':' + environ['SERVER_PORT']
+ else:
+ if environ['SERVER_PORT'] != '80':
+ url += ':' + environ['SERVER_PORT']
url += quote(environ.get('SCRIPT_NAME',''))
url += quote(environ.get('PATH_INFO',''))
More information about the Python-checkins
mailing list