From 84248d431bcad4a289f1ce82bf090da41970020b Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 17 Jun 2013 10:52:19 +0200 Subject: [PATCH] fix send_error behavior if there are no headers --- libmproxy/proxy.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index 283072ab8..4059c0b13 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -481,8 +481,9 @@ class ProxyHandler(tcp.BaseHandler): self.wfile.write("Server: %s\r\n"%self.server_version) self.wfile.write("Content-type: text/html\r\n") self.wfile.write("Content-Length: %d\r\n"%len(html_content)) - for key, value in headers.items(): - self.wfile.write("%s: %s\r\n"%(key, value)) + if headers: + for key, value in headers.items(): + self.wfile.write("%s: %s\r\n"%(key, value)) self.wfile.write("Connection: close\r\n") self.wfile.write("\r\n") self.wfile.write(html_content)