summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew/3.6.rst
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-08-24 06:33:33 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-08-24 06:33:33 (GMT)
commit3c0d0baf2badfad7deb346d1043f7d83bb92691f (patch)
tree968ca71729f519aaf6ebb38477efdc73e5ae3ae9 /Doc/whatsnew/3.6.rst
parenta790fe7ff86f193670b3d8287b22c72cbe675c7b (diff)
downloadcpython-3c0d0baf2badfad7deb346d1043f7d83bb92691f.zip
cpython-3c0d0baf2badfad7deb346d1043f7d83bb92691f.tar.gz
cpython-3c0d0baf2badfad7deb346d1043f7d83bb92691f.tar.bz2
Issue #12319: Support for chunked encoding of HTTP request bodies
When the body object is a file, its size is no longer determined with fstat(), since that can report the wrong result (e.g. reading from a pipe). Instead, determine the size using seek(), or fall back to chunked encoding for unseekable files. Also, change the logic for detecting text files to check for TextIOBase inheritance, rather than inspecting the “mode” attribute, which may not exist (e.g. BytesIO and StringIO). The Content-Length for text files is no longer determined ahead of time, because the original logic could have been wrong depending on the codec and newline translation settings. Patch by Demian Brecht and Rolf Krahl, with a few tweaks by me.
Diffstat (limited to 'Doc/whatsnew/3.6.rst')
-rw-r--r--Doc/whatsnew/3.6.rst19
1 files changed, 19 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst
index 8b85b22..6d5bbc0 100644
--- a/Doc/whatsnew/3.6.rst
+++ b/Doc/whatsnew/3.6.rst
@@ -324,6 +324,15 @@ exceptions: see :func:`faulthandler.enable`. (Contributed by Victor Stinner in
:issue:`23848`.)
+http.client
+-----------
+
+:meth:`HTTPConnection.request() <http.client.HTTPConnection.request>` and
+:meth:`~http.client.HTTPConnection.endheaders` both now support
+chunked encoding request bodies.
+(Contributed by Demian Brecht and Rolf Krahl in :issue:`12319`.)
+
+
idlelib and IDLE
----------------
@@ -500,6 +509,16 @@ The :class:`~unittest.mock.Mock` class has the following improvements:
(Contributed by Amit Saha in :issue:`26323`.)
+urllib.request
+--------------
+
+If a HTTP request has a non-empty body but no Content-Length header
+and the content length cannot be determined up front, rather than
+throwing an error, :class:`~urllib.request.AbstractHTTPHandler` now
+falls back to use chunked transfer encoding.
+(Contributed by Demian Brecht and Rolf Krahl in :issue:`12319`.)
+
+
urllib.robotparser
------------------