Skip to content

Commit bcb30e5

Browse files
committed
fix curl basic auth
1 parent 1b38b58 commit bcb30e5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tornado/curl_httpclient.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,10 @@ def ioctl(cmd):
383383
else:
384384
curl.setopt(pycurl.INFILESIZE, len(request.body))
385385

386-
if request.auth_username and request.auth_password:
387-
userpwd = "%s:%s" % (request.auth_username, request.auth_password)
386+
if request.auth_username is not None:
387+
userpwd = "%s:%s" % (request.auth_username, request.auth_password or '')
388388
curl.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_BASIC)
389-
curl.setopt(pycurl.USERPWD, userpwd)
389+
curl.setopt(pycurl.USERPWD, userpwd.encode('ascii'))
390390
logging.debug("%s %s (username: %r)", request.method, request.url,
391391
request.auth_username)
392392
else:

0 commit comments

Comments
 (0)