From: dave mankoff Date: Sun, 22 Jan 2012 22:15:10 +0000 (-0500) Subject: fix curl basic auth X-Git-Tag: v2.2.0~5^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcb30e56fd3939482daa59b166d21835d77d4f23;p=thirdparty%2Ftornado.git fix curl basic auth --- diff --git a/tornado/curl_httpclient.py b/tornado/curl_httpclient.py index 8dfcb4a83..7d8faf36e 100644 --- a/tornado/curl_httpclient.py +++ b/tornado/curl_httpclient.py @@ -383,10 +383,10 @@ def _curl_setup_request(curl, request, buffer, headers): else: curl.setopt(pycurl.INFILESIZE, len(request.body)) - if request.auth_username and request.auth_password: - userpwd = "%s:%s" % (request.auth_username, request.auth_password) + if request.auth_username is not None: + userpwd = "%s:%s" % (request.auth_username, request.auth_password or '') curl.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_BASIC) - curl.setopt(pycurl.USERPWD, userpwd) + curl.setopt(pycurl.USERPWD, userpwd.encode('ascii')) logging.debug("%s %s (username: %r)", request.method, request.url, request.auth_username) else: