curl-library
implementing nginx upload_resume client
Date: Tue, 1 Nov 2011 16:34:20 -0700
I'm working on implementing a client for the nginx
upload_module<http://www.grid.net.ru/nginx/upload.en.html>which
implements upload resume, as described at
http://www.grid.net.ru/nginx/resumable_uploads.en.html.
I'm working in python using the pycurl library, which is a (very thin)
wrapper around libcurl.
I think I have the majority of the code working, however I'm having
difficulty specifying the POST body. According to the spec document, the
body should be the contents of the file, as specified by the range header.
I have tried the following
c.setopt(c.READFUNCTION, lambda *args: post_attachment)
where post_attachment is a string containing the chunk of the file I want
to post (it is exactly the right size). However this times out (I don't
understand how, since it the lambda function should return immediately).
I have also tried the following
f = StringIO(post_attachment)
c.setopt(c.READDATA, f)
which creates a file-like object containing the chunk of data I want to
post, however this also times out. How do I specify the body of a POST?
Andrew
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-11-02