Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3df4621

Browse files
committed
Add PEP 3333 to whatsnew.
1 parent 4bd8172 commit 3df4621

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

Doc/whatsnew/3.2.rst

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,37 @@ module::
362362
:pep:`3149` - ABI Version Tagged .so Files
363363
PEP written by Barry Warsaw.
364364

365+
PEP 3333: Python Web Server Gateway Interface v1.0.1
366+
=====================================================
367+
368+
This informational PEP clarifies how bytes/text issues are to be handled by the
369+
WGSI protocol. The challenge is that string handling in Python 3 is most
370+
conveniently handled with the :class:`str` type eventhough the HTTP protocol
371+
is itself bytes oriented.
372+
373+
The PEP differentiates so-called *native strings* that are used for
374+
request/response headers and metadata versus *byte strings* which are used for
375+
the bodies of requests and responses.
376+
377+
The *native strings* are always of type :class:`str` but are restricted to code
378+
points between *u0000* through *u00FF* which are translatable to bytes using
379+
*Latin-1* encoding. These strings are used with :func:`start_response` as
380+
response headers or statuses and must follow :rfc:`2616` with respect to
381+
encoding. That is, they must either be *ISO-8859-1* characters or use
382+
:rfc:`2047` MIME encoding.
383+
384+
To make the environment accessible using native strings, the :mod:`wsgiref`
385+
module has a new function, :func:`wsgiref.handlers.read_environ` which
386+
transcodes CGI variables from :attr:`os.environ` into native strings and returns
387+
a new dictionary. This function provides a WSGI native string friendly
388+
abstraction which is especially helpful given that the environment variables are
389+
handled differently on various operating systems (native unicode on Windows or
390+
UTF-8 encoded bytes on some Unix installations).
391+
392+
.. seealso::
393+
394+
:pep:`3333` - Python Web Server Gateway Interface v1.0.1
395+
PEP written by Phillip Eby.
365396

366397
Other Language Changes
367398
======================
@@ -1399,7 +1430,7 @@ reading directly from dictionaries and strings.
13991430
- bytes input support
14001431
- non-UTF8 percent encoding of non-ASCII characters
14011432
Issue 2987 for IPv6 (RFC2732) support in urlparse
1402-
.. XXX: Any updates to the WSGI bytes versus text problem?
1433+
14031434
14041435
Multi-threading
14051436
===============

0 commit comments

Comments
 (0)