From 905a215a286041c986005859c378c0445c127cbb Mon Sep 17 00:00:00 2001 From: vijayp Date: Thu, 18 Nov 2010 13:58:44 -0500 Subject: [PATCH] Set proxy to '' if no proxy is explicitly set in the request. If this is not done, curls with proxies set are re-inserted into the empty list, and are then reused. This causes connections to be randomly proxied, if some requests use a proxy, and others don't. --- tornado/httpclient.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tornado/httpclient.py b/tornado/httpclient.py index 26e447cc..3e04ff65 100644 --- a/tornado/httpclient.py +++ b/tornado/httpclient.py @@ -543,6 +543,8 @@ def _curl_setup_request(curl, request, buffer, headers): credentials = '%s:%s' % (request.proxy_username, request.proxy_password) curl.setopt(pycurl.PROXYUSERPWD, credentials) + else: + curl.setopt(pycurl.PROXY, '') # Set the request method through curl's retarded interface which makes # up names for almost every single method