diff --git a/libmproxy/dump.py b/libmproxy/dump.py index c464644c4..59e46dbbb 100644 --- a/libmproxy/dump.py +++ b/libmproxy/dump.py @@ -171,7 +171,7 @@ class DumpMaster(flow.FlowMaster): def _print_message(self, message): if self.o.flow_detail >= 2: - print(self.indent(4, message.headers), file=self.outfile) + print(self.indent(4, message.headers.format()), file=self.outfile) if self.o.flow_detail >= 3: if message.content == http.CONTENT_MISSING: print(self.indent(4, "(content missing)"), file=self.outfile) diff --git a/libmproxy/flow.py b/libmproxy/flow.py index a010bb399..553bfd844 100644 --- a/libmproxy/flow.py +++ b/libmproxy/flow.py @@ -268,7 +268,7 @@ class ServerPlaybackState: # to prevent a mismatch between unicode/non-unicode. v = [str(x) for x in v] hdrs.append((i, v)) - key.append(repr(hdrs)) + key.append(hdrs) return hashlib.sha256(repr(key)).digest() def next_flow(self, request): diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py index eb7749ea6..da6b8aa67 100644 --- a/libmproxy/protocol/http.py +++ b/libmproxy/protocol/http.py @@ -469,7 +469,7 @@ class HTTPRequest(HTTPMessage): if self.content or self.content == "": headers["Content-Length"] = [str(len(self.content))] - return str(headers) + return headers.format() def _assemble_head(self, form=None): return "%s\r\n%s\r\n" % ( @@ -823,7 +823,7 @@ class HTTPResponse(HTTPMessage): if self.content or self.content == "": headers["Content-Length"] = [str(len(self.content))] - return str(headers) + return headers.format() def _assemble_head(self, preserve_transfer_encoding=False): return '%s\r\n%s\r\n' % (