diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-07-30 12:54:50 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-07-30 12:54:50 +1200 |
commit | 87d05a95ffec6ec99c8f6401feb847fcf516353e (patch) | |
tree | 6ff3969b9b58883c25e94372df1d51a629f45abf /libmproxy | |
parent | bb124e23b2ece5fd78f5f11950d48fdc1fc94595 (diff) | |
download | mitmproxy-87d05a95ffec6ec99c8f6401feb847fcf516353e.tar.gz mitmproxy-87d05a95ffec6ec99c8f6401feb847fcf516353e.tar.bz2 mitmproxy-87d05a95ffec6ec99c8f6401feb847fcf516353e.zip |
Handle invalid headers.
Diffstat (limited to 'libmproxy')
-rw-r--r-- | libmproxy/proxy.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index 032a7e5e..7fb84530 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -284,6 +284,8 @@ class ProxyHandler(tcp.BaseHandler): raise ProxyError(400, "Bad HTTP request line: %s"%repr(line)) method, path, httpversion = r headers = http.read_headers(self.rfile) + if headers is None: + raise ProxyError(400, "Invalid headers") content = http.read_http_body_request( self.rfile, self.wfile, headers, httpversion, self.config.body_size_limit ) @@ -298,6 +300,8 @@ class ProxyHandler(tcp.BaseHandler): raise ProxyError(400, "Bad HTTP request line: %s"%repr(line)) method, path, httpversion = r headers = http.read_headers(self.rfile) + if headers is None: + raise ProxyError(400, "Invalid headers") content = http.read_http_body_request( self.rfile, self.wfile, headers, httpversion, self.config.body_size_limit ) @@ -337,6 +341,8 @@ class ProxyHandler(tcp.BaseHandler): raise ProxyError(400, "Bad HTTP request line: %s"%repr(line)) method, path, httpversion = r headers = http.read_headers(self.rfile) + if headers is None: + raise ProxyError(400, "Invalid headers") content = http.read_http_body_request( self.rfile, self.wfile, headers, httpversion, self.config.body_size_limit ) @@ -347,6 +353,8 @@ class ProxyHandler(tcp.BaseHandler): raise ProxyError(400, "Bad HTTP request line: %s"%repr(line)) method, scheme, host, port, path, httpversion = http.parse_init_proxy(line) headers = http.read_headers(self.rfile) + if headers is None: + raise ProxyError(400, "Invalid headers") content = http.read_http_body_request( self.rfile, self.wfile, headers, httpversion, self.config.body_size_limit ) |