string. This is inconsistent with its write method, which encodes all
strings as ascii (and rejects unicode strings iff they have any
non-ascii characters). This change uses utf-8 as the default encoding
when constructing cStringIO objects in tornado.
# Handle curl's cryptic options for every individual HTTP method
if request.method in ("POST", "PUT"):
- request_buffer = cStringIO.StringIO(request.body)
+ request_buffer = cStringIO.StringIO(request.body.encode('utf-8'))
curl.setopt(pycurl.READFUNCTION, request_buffer.read)
if request.method == "POST":
def ioctl(cmd):
"SERVER_PROTOCOL": request.version,
"wsgi.version": (1, 0),
"wsgi.url_scheme": request.protocol,
- "wsgi.input": cStringIO.StringIO(request.body),
+ "wsgi.input": cStringIO.StringIO(request.body.encode('utf-8')),
"wsgi.errors": sys.stderr,
"wsgi.multithread": False,
"wsgi.multiprocess": True,