summaryrefslogtreecommitdiffstats
path: root/Doc/library/urllib.request.rst
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-08-27 01:39:26 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-08-27 01:39:26 (GMT)
commitef91bb26604ddfae22aac56b3cfdaabf237db37a (patch)
tree491cbeadc0488a4e203de39ca42f8b132653195f /Doc/library/urllib.request.rst
parent8f96a30630b5f6a984af3ee53c63bce3b16077e0 (diff)
downloadcpython-ef91bb26604ddfae22aac56b3cfdaabf237db37a.zip
cpython-ef91bb26604ddfae22aac56b3cfdaabf237db37a.tar.gz
cpython-ef91bb26604ddfae22aac56b3cfdaabf237db37a.tar.bz2
Issue #12319: Always send file request bodies using chunked encoding
The previous attempt to determine the file’s Content-Length gave a false positive for pipes on Windows. Also, drop the special case for sending zero-length iterable bodies.
Diffstat (limited to 'Doc/library/urllib.request.rst')
-rw-r--r--Doc/library/urllib.request.rst15
1 files changed, 7 insertions, 8 deletions
diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst
index e619cc1..d288165 100644
--- a/Doc/library/urllib.request.rst
+++ b/Doc/library/urllib.request.rst
@@ -187,12 +187,11 @@ The following classes are provided:
server, or ``None`` if no such data is needed. Currently HTTP
requests are the only ones that use *data*. The supported object
types include bytes, file-like objects, and iterables. If no
- ``Content-Length`` header has been provided, :class:`HTTPHandler` will
- try to determine the length of *data* and set this header accordingly.
- If this fails, ``Transfer-Encoding: chunked`` as specified in
- :rfc:`7230`, Section 3.3.1 will be used to send the data. See
- :meth:`http.client.HTTPConnection.request` for details on the
- supported object types and on how the content length is determined.
+ ``Content-Length`` nor ``Transfer-Encoding`` header field
+ has been provided, :class:`HTTPHandler` will set these headers according
+ to the type of *data*. ``Content-Length`` will be used to send
+ bytes objects, while ``Transfer-Encoding: chunked`` as specified in
+ :rfc:`7230`, Section 3.3.1 will be used to send files and other iterables.
For an HTTP POST request method, *data* should be a buffer in the
standard :mimetype:`application/x-www-form-urlencoded` format. The
@@ -256,8 +255,8 @@ The following classes are provided:
.. versionchanged:: 3.6
Do not raise an error if the ``Content-Length`` has not been
- provided and could not be determined. Fall back to use chunked
- transfer encoding instead.
+ provided and *data* is neither ``None`` nor a bytes object.
+ Fall back to use chunked transfer encoding instead.
.. class:: OpenerDirector()