aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2011-06-27 15:59:17 +1200
committerAldo Cortesi <aldo@nullcube.com>2011-06-27 15:59:17 +1200
commitf004326855126e01e7a095fc65562c41060ffbed (patch)
tree976f800bd830cec66581b02066f20cdd24b1d492 /test
parent2ae7808ca9c83cb69fe6606051edd43e417281c7 (diff)
downloadmitmproxy-f004326855126e01e7a095fc65562c41060ffbed.tar.gz
mitmproxy-f004326855126e01e7a095fc65562c41060ffbed.tar.bz2
mitmproxy-f004326855126e01e7a095fc65562c41060ffbed.zip
Try not to hang when user views large request & response bodies
Two different strategies here: - Use a simple heuristic to detect if we're looking at XML data when indent mode is used. On non-XML data we can hang even on small documents. - Only view partial data for large bodies. At the moment the cutoff is 100k. I might finetune this later.
Diffstat (limited to 'test')
-rw-r--r--test/test_utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index 874b2c6f..6aefd403 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -18,6 +18,13 @@ class uisBin(libpry.AutoTree):
assert utils.isBin("testing\x7f")
+class uisXML(libpry.AutoTree):
+ def test_simple(self):
+ assert not utils.isXML("foo")
+ assert utils.isXML("<foo")
+ assert utils.isXML(" \n<foo")
+
+
class uhexdump(libpry.AutoTree):
def test_simple(self):
assert utils.hexdump("one\0"*10)
@@ -352,6 +359,7 @@ class uLRUCache(libpry.AutoTree):
tests = [
uformat_timestamp(),
uisBin(),
+ uisXML(),
uhexdump(),
upretty_size(),
uisStringLike(),