]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Merge branch 'master' of github.com:tornadoweb/tornado
authorTatiana Al-Chueyr <tatiana.alchueyr@gmail.com>
Mon, 21 Jul 2014 22:10:45 +0000 (15:10 -0700)
committerTatiana Al-Chueyr <tatiana.alchueyr@gmail.com>
Mon, 21 Jul 2014 22:10:45 +0000 (15:10 -0700)
1  2 
tornado/curl_httpclient.py

index 32d52373bf3fd650c25c1be7e8157f87971d13bb,a0973233071278e2fede303232dabbf13126e881..2ed6fcf61d19e74494ed9cfa3714315948037057
@@@ -400,16 -393,18 +396,16 @@@ def _curl_setup_request(curl, request, 
                  % request.method)
  
          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.UPLOAD, True)
              curl.setopt(pycurl.INFILESIZE, len(request.body))
 -    elif request.method == "GET":
 -        if request.body is not None:
 -            raise AssertionError('Body must be empty for GET request')
  
      if request.auth_username is not None:
          userpwd = "%s:%s" % (request.auth_username, request.auth_password or '')