This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients Rotkraut, demian.brecht, eryksun, harobed, martin.panter, matrixise, orsenthil, petri.lehtinen, piotr.dobrogost, pitrou, python-dev, vstinner, whitemice
Date 2016-08-24.12:11:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1472040663.97.0.0889952127496.issue12319@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-08-24 12:11:04martin.pantersetrecipients: + martin.panter, orsenthil, pitrou, vstinner, harobed, python-dev, petri.lehtinen, piotr.dobrogost, eryksun, demian.brecht, matrixise, whitemice, Rotkraut
2016-08-24 12:11:03martin.pantersetmessageid: <1472040663.97.0.0889952127496.issue12319@psf.upfronthosting.co.za>
2016-08-24 12:11:03martin.panterlinkissue12319 messages
2016-08-24 12:11:03martin.pantercreate