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 Wiktor Niesiobedzki
Recipients Wiktor Niesiobedzki
Date 2015-12-21.20:20:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1450729223.96.0.301570875049.issue25919@psf.upfronthosting.co.za>
In-reply-to
Content
It looks like, when doing PUT together with a file-like object to send, http.client will try to send the whole file before analysing the response from the server.

If you do the following:
$ dd if=/dev/zero of=/tmp/300mb.zero bs=1M count=300

And then run following code in Python 3.4 (tested 3.4.3 on Linux and FreeBSD):
import http.client
conn = http.client.HTTPSConnection('api.onedrive.com')
req = conn.request(
    method='PUT',
    url='https://api.onedrive.com/v1.0/drives/me/root:/test.file:/content',
    body=open("/tmp/300mb.zero", "rb"))
resp = conn.getresponse()

You'll notice the hang. After some time, it will aborted with BrokenPipeError: [Errno 32] Broken pipe. If you run the following code within pdb debugger, and interrupt, you'll probably interrupt somewhere within write loop. You can call self.read() and see, that HTTP 413 is waiting to be interpreted.

Doing similar action with curl:
$ $ curl -v -T /tmp/300mb.zero https://api.onedrive.com/v1.0/drives/me/root:/test.file:/content

Gives you immediate HTTP 413 error. Can we have the same behaviour in http.client library?
History
Date User Action Args
2015-12-21 20:20:23Wiktor Niesiobedzkisetrecipients: + Wiktor Niesiobedzki
2015-12-21 20:20:23Wiktor Niesiobedzkisetmessageid: <1450729223.96.0.301570875049.issue25919@psf.upfronthosting.co.za>
2015-12-21 20:20:23Wiktor Niesiobedzkilinkissue25919 messages
2015-12-21 20:20:23Wiktor Niesiobedzkicreate