diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2011-02-21 10:11:50 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2011-02-21 10:11:50 +1300 |
commit | c3e38970718aed37dd70e8aad0085957b62a09ac (patch) | |
tree | 734ead4993761ab79f86b7f190dd16e2447994e8 | |
parent | fd4dd8cb6b9e4e2a0afe0ecbf1bff52c66ce4dba (diff) | |
download | mitmproxy-c3e38970718aed37dd70e8aad0085957b62a09ac.tar.gz mitmproxy-c3e38970718aed37dd70e8aad0085957b62a09ac.tar.bz2 mitmproxy-c3e38970718aed37dd70e8aad0085957b62a09ac.zip |
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.
-rw-r--r-- | libmproxy/proxy.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index 5e698c5f..ffc9b264 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -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 |