]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
curl_httpclient: set CURLOPT_PROXY to NULL if pycurl supports it 2902/head
author依云 <lilydjwg@gmail.com>
Tue, 28 Jul 2020 14:09:45 +0000 (22:09 +0800)
committer依云 <lilydjwg@gmail.com>
Sun, 16 Aug 2020 05:03:32 +0000 (13:03 +0800)
This restores curl's default behaviour: use environment variables.

This option was set to "" to disable proxy in
905a215a286041c986005859c378c0445c127cbb but curl uses environment
variables by default.

tornado/curl_httpclient.py

index 3ed82b765be86a69487d679d61d3e1034393b5d1..161941842a2e77fd54b6705a2a8834f77facf4e3 100644 (file)
@@ -406,7 +406,10 @@ class CurlAsyncHTTPClient(AsyncHTTPClient):
                     "Unsupported proxy_auth_mode %s" % request.proxy_auth_mode
                 )
         else:
-            curl.setopt(pycurl.PROXY, "")
+            try:
+                curl.unsetopt(pycurl.PROXY)
+            except TypeError:  # not supported, disable proxy
+                curl.setopt(pycurl.PROXY, "")
             curl.unsetopt(pycurl.PROXYUSERPWD)
         if request.validate_cert:
             curl.setopt(pycurl.SSL_VERIFYPEER, 1)