Martin Panter added the comment:

Thankyou Eryksun for the detailed explanation. Unfortunately, that means that 
uploading an unseekable file via urllib.request, or via http.client, isn’t 
going to work by default on Windows. I see a couple of workarounds with the 
current code:

* Users can force chunked encoding (manually pass Transfer-Encoding: chunked, 
and/or encode_chunked=True, depending on the API)
* Users can pass an iterator that reads the file: iter(partial(file.read, 
CHUNK_SIZE), b"")

But I never liked how so much behaviour depends on specific details of the 
upload body object anyway. Perhaps this is an opportunity to change the 
behaviour so that a file object always triggers chunked encoding. We could add 
a note to 
<https://docs.python.org/3.6/whatsnew/3.6.html#changes-in-the-python-api> to 
warn that uploading files to HTTP 1.0 servers will now require Content-Length 
to be manually specified.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12319>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to