Skip to content

Commit

Permalink
UTF8-encode more user-supplied strings in httpclient (headers and use…
Browse files Browse the repository at this point in the history
…r-agent)
  • Loading branch information
Ben Darnell committed Jun 28, 2010
1 parent 52c378f commit 2ac7426
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tornado/httpclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ def _curl_create(max_simultaneous_connections=None):
def _curl_setup_request(curl, request, buffer, headers):
curl.setopt(pycurl.URL, request.url)
curl.setopt(pycurl.HTTPHEADER,
["%s: %s" % i for i in request.headers.iteritems()])
[_utf8("%s: %s" % i) for i in request.headers.iteritems()])
if request.header_callback:
curl.setopt(pycurl.HEADERFUNCTION, request.header_callback)
else:
Expand All @@ -634,7 +634,7 @@ def _curl_setup_request(curl, request, buffer, headers):
curl.setopt(pycurl.CONNECTTIMEOUT, int(request.connect_timeout))
curl.setopt(pycurl.TIMEOUT, int(request.request_timeout))
if request.user_agent:
curl.setopt(pycurl.USERAGENT, request.user_agent)
curl.setopt(pycurl.USERAGENT, _utf8(request.user_agent))
else:
curl.setopt(pycurl.USERAGENT, "Mozilla/5.0 (compatible; pycurl)")
if request.network_interface:
Expand Down

0 comments on commit 2ac7426

Please sign in to comment.