From 8ef2a845b992539255a036666fecc0f7d52f4f76 Mon Sep 17 00:00:00 2001 From: homm Date: Wed, 16 Jul 2014 17:43:12 +0400 Subject: [PATCH] make IOCMD_RESTARTREAD available for PUT requests --- tornado/curl_httpclient.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tornado/curl_httpclient.py b/tornado/curl_httpclient.py index e09005691..a46ce4055 100644 --- a/tornado/curl_httpclient.py +++ b/tornado/curl_httpclient.py @@ -405,12 +405,12 @@ def _curl_setup_request(curl, request, buffer, headers): # Handle curl's cryptic options for every individual HTTP method if request.method in ("POST", "PUT"): request_buffer = BytesIO(utf8(request.body)) + def ioctl(cmd): + if cmd == curl.IOCMD_RESTARTREAD: + request_buffer.seek(0) curl.setopt(pycurl.READFUNCTION, request_buffer.read) + curl.setopt(pycurl.IOCTLFUNCTION, ioctl) if request.method == "POST": - def ioctl(cmd): - if cmd == curl.IOCMD_RESTARTREAD: - request_buffer.seek(0) - curl.setopt(pycurl.IOCTLFUNCTION, ioctl) curl.setopt(pycurl.POSTFIELDSIZE, len(request.body)) else: curl.setopt(pycurl.INFILESIZE, len(request.body)) -- 2.47.2