Message273548
| 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:04 | martin.panter | set | recipients:
+ martin.panter, orsenthil, pitrou, vstinner, harobed, python-dev, petri.lehtinen, piotr.dobrogost, eryksun, demian.brecht, matrixise, whitemice, Rotkraut |
| 2016年08月24日 12:11:03 | martin.panter | set | messageid: <1472040663.97.0.0889952127496.issue12319@psf.upfronthosting.co.za> |
| 2016年08月24日 12:11:03 | martin.panter | link | issue12319 messages |
| 2016年08月24日 12:11:03 | martin.panter | create |
|