]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Add a workaround for a bug in the latest version of libcurl
authorBen Darnell <ben@bendarnell.com>
Sat, 9 Feb 2013 18:59:00 +0000 (13:59 -0500)
committerBen Darnell <ben@bendarnell.com>
Sat, 9 Feb 2013 18:59:00 +0000 (13:59 -0500)
tornado/curl_httpclient.py

index 95312ebf6e2c13f1f23061a50b370a661e1c39bb..dcc601179b0a780bf8fb1d0c5f761cd46e6dd721 100644 (file)
@@ -73,6 +73,15 @@ class CurlAsyncHTTPClient(AsyncHTTPClient):
             self._handle_force_timeout, 1000, io_loop=io_loop)
         self._force_timeout_callback.start()
 
+        # Work around a bug in libcurl 7.29.0: Some fields in the curl
+        # multi object are initialized lazily, and its destructor will
+        # segfault if it is destroyed without having been used.  Add
+        # and remove a dummy handle to make sure everything is
+        # initialized.
+        dummy_curl_handle = pycurl.Curl()
+        self._multi.add_handle(dummy_curl_handle)
+        self._multi.remove_handle(dummy_curl_handle)
+
     def close(self):
         self._force_timeout_callback.stop()
         for curl in self._curls: