[ARVADOS] created: 94129ac43095fe8b1361f60adbe4ead0c658e4dd

git at public.curoverse.com git at public.curoverse.com
Thu Apr 30 13:55:41 EDT 2015


        at  94129ac43095fe8b1361f60adbe4ead0c658e4dd (commit)


commit 94129ac43095fe8b1361f60adbe4ead0c658e4dd
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Apr 30 13:55:36 2015 -0400

    Use pycurl.UPLOAD instead of CUSTOMREQUEST 'PUT'.  Set INFILESIZE and use
    READFUNCTION.

diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index 5caa572..4b3feb2 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -419,12 +419,14 @@ class KeepClient(object):
             curl = self._get_user_agent()
             try:
                 self._headers = {}
+                body_reader = StringIO.StringIO(body)
                 response_body = StringIO.StringIO()
                 curl.setopt(pycurl.NOSIGNAL, 1)
                 curl.setopt(pycurl.OPENSOCKETFUNCTION, self._socket_open)
                 curl.setopt(pycurl.URL, url.encode('utf-8'))
-                curl.setopt(pycurl.POSTFIELDS, body)
-                curl.setopt(pycurl.CUSTOMREQUEST, 'PUT')
+                curl.setopt(pycurl.UPLOAD, True)
+                curl.setopt(pycurl.INFILESIZE, len(body))
+                curl.setopt(pycurl.READFUNCTION, body_reader.read)
                 curl.setopt(pycurl.HTTPHEADER, [
                     '{}: {}'.format(k,v) for k,v in self.put_headers.iteritems()])
                 curl.setopt(pycurl.WRITEFUNCTION, response_body.write)

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list