diff options
| author | Aldo Cortesi <aldo@nullcube.com> | 2012-07-24 22:38:48 +1200 |
|---|---|---|
| committer | Aldo Cortesi <aldo@nullcube.com> | 2012-07-24 22:38:48 +1200 |
| commit | 6c565e778f986055f0edd2a170e005f4adb45a5d (patch) | |
| tree | 7a8b2f78df644d34d73fcbce35154f63ffbfd555 /libpathod | |
| parent | e9de11f0e35b6f311c87b8f56ef01de2af2aeb2c (diff) | |
| download | mitmproxy-6c565e778f986055f0edd2a170e005f4adb45a5d.tar.gz mitmproxy-6c565e778f986055f0edd2a170e005f4adb45a5d.tar.bz2 mitmproxy-6c565e778f986055f0edd2a170e005f4adb45a5d.zip | |
Make previews safer by stripping pauses.
Diffstat (limited to 'libpathod')
| -rw-r--r-- | libpathod/app.py | 1 | ||||
| -rw-r--r-- | libpathod/rparse.py | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/libpathod/app.py b/libpathod/app.py index 5de69337..111fafe5 100644 --- a/libpathod/app.py +++ b/libpathod/app.py @@ -90,6 +90,7 @@ def preview(): return render("preview.html", **args) s = cStringIO.StringIO() + r.preview_safe() r.serve(s, check=app.config["pathod"].check_size) args["output"] = utils.escape_unprintables(s.getvalue()) return render("preview.html", **args) diff --git a/libpathod/rparse.py b/libpathod/rparse.py index e56135ea..d60a78d3 100644 --- a/libpathod/rparse.py +++ b/libpathod/rparse.py @@ -527,6 +527,12 @@ class Message: l += len(self.body) return l + def preview_safe(self): + """ + Modify this message to be safe for previews. + """ + self.actions = [i for i in self.actions if i[1] != "pause"] + def effective_length(self, actions): """ Calculate the length of the base message with all applied actions. |
