Permalink
Browse files

fix curl basic auth

  • Loading branch information...
mankyd committed Jan 22, 2012
1 parent 1b38b58 commit bcb30e56fd3939482daa59b166d21835d77d4f23
Showing with 3 additions and 3 deletions.
  1. +3 −3 tornado/curl_httpclient.py
@@ -383,10 +383,10 @@ def ioctl(cmd):
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:

0 comments on commit bcb30e5

Please sign in to comment.