diff options
-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 ) |