diff options
Diffstat (limited to 'libpathod/pathod.py')
-rw-r--r-- | libpathod/pathod.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libpathod/pathod.py b/libpathod/pathod.py index 28484c5d..f6b5e0f9 100644 --- a/libpathod/pathod.py +++ b/libpathod/pathod.py @@ -83,7 +83,7 @@ class PathodHandler(tcp.BaseHandler): httpversion = httpversion, ) if crafted: - response_log = crafted.serve(self.wfile, self.check_size) + response_log = crafted.serve(self.wfile, self.server.check_size) self.server.add_log( dict( type = "crafted", @@ -107,11 +107,6 @@ class PathodHandler(tcp.BaseHandler): self.debug("%s %s"%(method, path)) 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): if self.server.ssloptions: try: @@ -179,6 +174,14 @@ class Pathod(tcp.TCPServer): raise PathodError("Invalid page spec in anchor: '%s', %s"%(i[1], str(v))) self.anchors.append((arex, aresp)) + def check_size(self, req, actions): + """ + A policy check that verifies the request size is withing limits. + """ + if self.sizelimit and req.effective_length(actions) > self.sizelimit: + return "Response too large." + return False + @property def request_settings(self): return dict( |