]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Remove workarounds for ancient versions of libcurl.
authorBen Darnell <ben@bendarnell.com>
Sat, 21 Jun 2014 17:05:57 +0000 (13:05 -0400)
committerBen Darnell <ben@bendarnell.com>
Sat, 21 Jun 2014 17:05:57 +0000 (13:05 -0400)
docs/releases/next.rst
tornado/curl_httpclient.py
tornado/httpclient.py

index 4412435cf910dbe1f730b812695e72697ed38620..94a86166166e2393c308ea3cfdc900cc8f09583a 100644 (file)
@@ -24,6 +24,8 @@ Backwards-compatibility notes
 * The ``RequestHandler.async_callback`` and ``WebSocketHandler.async_callback``
   wrapper functions have been removed; they have been obsolete for a long
   time due to stack contexts (and more recently coroutines).
+* ``curl_httpclient`` now requires a minimum of libcurl version 7.21.1 and
+  pycurl 7.18.2.
 
 
 Other notes
index c190ac91d83c15fa7e7ae1266e037933b1681b6c..ae4471fdb9730a43564c3d8f79ac129424625edb 100644 (file)
@@ -51,18 +51,6 @@ class CurlAsyncHTTPClient(AsyncHTTPClient):
         self._fds = {}
         self._timeout = None
 
-        try:
-            self._socket_action = self._multi.socket_action
-        except AttributeError:
-            # socket_action is found in pycurl since 7.18.2 (it's been
-            # in libcurl longer than that but wasn't accessible to
-            # python).
-            gen_log.warning("socket_action method missing from pycurl; "
-                            "falling back to socket_all. Upgrading "
-                            "libcurl and pycurl will improve performance")
-            self._socket_action = \
-                lambda fd, action: self._multi.socket_all()
-
         # libcurl has bugs that sometimes cause it to not report all
         # relevant file descriptors and timeouts to TIMERFUNCTION/
         # SOCKETFUNCTION.  Mitigate the effects of such bugs by
@@ -142,7 +130,7 @@ class CurlAsyncHTTPClient(AsyncHTTPClient):
             action |= pycurl.CSELECT_OUT
         while True:
             try:
-                ret, num_handles = self._socket_action(fd, action)
+                ret, num_handles = self._multi.socket_action(fd, action)
             except pycurl.error as e:
                 ret = e.args[0]
             if ret != pycurl.E_CALL_MULTI_PERFORM:
@@ -155,7 +143,7 @@ class CurlAsyncHTTPClient(AsyncHTTPClient):
             self._timeout = None
             while True:
                 try:
-                    ret, num_handles = self._socket_action(
+                    ret, num_handles = self._multi.socket_action(
                         pycurl.SOCKET_TIMEOUT, 0)
                 except pycurl.error as e:
                     ret = e.args[0]
@@ -223,11 +211,6 @@ class CurlAsyncHTTPClient(AsyncHTTPClient):
                         "callback": callback,
                         "curl_start_time": time.time(),
                     }
-                    # Disable IPv6 to mitigate the effects of this bug
-                    # on curl versions <= 7.21.0
-                    # http://sourceforge.net/tracker/?func=detail&aid=3017819&group_id=976&atid=100976
-                    if pycurl.version_info()[2] <= 0x71500:  # 7.21.0
-                        curl.setopt(pycurl.IPRESOLVE, pycurl.IPRESOLVE_V4)
                     _curl_setup_request(curl, request, curl.info["buffer"],
                                         curl.info["headers"])
                     self._multi.add_handle(curl)
@@ -383,7 +366,6 @@ def _curl_setup_request(curl, request, buffer, headers):
     if request.allow_ipv6 is False:
         # Curl behaves reasonably when DNS resolution gives an ipv6 address
         # that we can't reach, so allow ipv6 unless the user asks to disable.
-        # (but see version check in _process_queue above)
         curl.setopt(pycurl.IPRESOLVE, pycurl.IPRESOLVE_V4)
     else:
         curl.setopt(pycurl.IPRESOLVE, pycurl.IPRESOLVE_WHATEVER)
index 05672285fb6351d4dc02c72279bf8a0bd771fdbb..8418b5b2648f6d56b75eb586c465ff9138dce5e5 100644 (file)
@@ -22,14 +22,17 @@ to switch to ``curl_httpclient`` for reasons such as the following:
 
 * ``curl_httpclient`` was the default prior to Tornado 2.0.
 
-Note that if you are using ``curl_httpclient``, it is highly recommended that
-you use a recent version of ``libcurl`` and ``pycurl``.  Currently the minimum
-supported version is 7.18.2, and the recommended version is 7.21.1 or newer.
-It is highly recommended that your ``libcurl`` installation is built with
-asynchronous DNS resolver (threaded or c-ares), otherwise you may encounter
-various problems with request timeouts (for more information, see
+Note that if you are using ``curl_httpclient``, it is highly
+recommended that you use a recent version of ``libcurl`` and
+``pycurl``.  Currently the minimum supported version of libcurl is
+7.21.1, and the minimum version of pycurl is 7.18.2.  It is highly
+recommended that your ``libcurl`` installation is built with
+asynchronous DNS resolver (threaded or c-ares), otherwise you may
+encounter various problems with request timeouts (for more
+information, see
 http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTCONNECTTIMEOUTMS
 and comments in curl_httpclient.py).
+
 """
 
 from __future__ import absolute_import, division, print_function, with_statement