Fix a subtle Unicode problem in Response.assemble
If msg is Unicode, the proto string is automatically promoted to Unicode. If the proto string is promoted to Unicode, then the FMT interpolation is also done in Unicode. If this happens, then binary data in content will cause an exception.
This commit is contained in:
parent
fd4dd8cb6b
commit
c3e3897071
|
@ -338,7 +338,7 @@ class Response(controller.Msg):
|
|||
content = ""
|
||||
if self.request.client_conn.close:
|
||||
headers["connection"] = ["close"]
|
||||
proto = "HTTP/1.1 %s %s"%(self.code, self.msg)
|
||||
proto = "HTTP/1.1 %s %s"%(self.code, str(self.msg))
|
||||
data = (proto, str(headers), content)
|
||||
return self.FMT%data
|
||||
|
||||
|
|
Loading…
Reference in New Issue