diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2011-06-27 15:59:17 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2011-06-27 15:59:17 +1200 |
commit | f004326855126e01e7a095fc65562c41060ffbed (patch) | |
tree | 976f800bd830cec66581b02066f20cdd24b1d492 /test/test_utils.py | |
parent | 2ae7808ca9c83cb69fe6606051edd43e417281c7 (diff) | |
download | mitmproxy-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/test_utils.py')
-rw-r--r-- | test/test_utils.py | 8 |
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(), |