aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2013-06-17 10:52:19 +0200
committerMaximilian Hils <git@maximilianhils.com>2013-06-17 10:52:19 +0200
commit84248d431bcad4a289f1ce82bf090da41970020b (patch)
tree5a34fb095910b1e9a5433c2fd7e44e1a45e807e4
parentfd36142018a18f0d6c996e9c07bfc7e80e20afc4 (diff)
downloadmitmproxy-84248d431bcad4a289f1ce82bf090da41970020b.tar.gz
mitmproxy-84248d431bcad4a289f1ce82bf090da41970020b.tar.bz2
mitmproxy-84248d431bcad4a289f1ce82bf090da41970020b.zip
fix send_error behavior if there are no headers
-rw-r--r--libmproxy/proxy.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py
index 283072ab..4059c0b1 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)