diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-07-23 15:03:56 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-07-23 15:03:56 +1200 |
commit | 1c45f5b05c7e066c28dfd4c9d1cde3b794f8983c (patch) | |
tree | 0e0d27af2fff15469824dff159ea034956f5a986 /libpathod/pathod.py | |
parent | c7b5faf7dbaab518bbe9942f018861f738ebb2b0 (diff) | |
download | mitmproxy-1c45f5b05c7e066c28dfd4c9d1cde3b794f8983c.tar.gz mitmproxy-1c45f5b05c7e066c28dfd4c9d1cde3b794f8983c.tar.bz2 mitmproxy-1c45f5b05c7e066c28dfd4c9d1cde3b794f8983c.zip |
Use policy hook to apply a size limit in pathod, add corresponding cmdline arg.
Diffstat (limited to 'libpathod/pathod.py')
-rw-r--r-- | libpathod/pathod.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libpathod/pathod.py b/libpathod/pathod.py index 2f9717df..0247c204 100644 --- a/libpathod/pathod.py +++ b/libpathod/pathod.py @@ -87,8 +87,6 @@ class PathodHandler(tcp.BaseHandler): ) if crafted: response_log = crafted.serve(self.wfile, self.check_size) - if response_log["disconnect"]: - return self.server.add_log( dict( type = "crafted", @@ -96,6 +94,8 @@ class PathodHandler(tcp.BaseHandler): response=response_log ) ) + if response_log["disconnect"]: + return else: cc = wsgi.ClientConn(self.client_address) req = wsgi.Request(cc, "http", method, path, headers, content) @@ -111,6 +111,8 @@ class PathodHandler(tcp.BaseHandler): return True def check_size(self, req, actions): + if self.server.sizelimit and req.effective_length(actions) > self.server.sizelimit: + return "Response too large." return False def handle(self): |