diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-04-01 10:09:25 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-04-01 10:09:25 +1200 |
commit | 35f4a1c424907d296a2ee0e852107542fcf8ac0d (patch) | |
tree | 998c1c44189e18527d3f391e78ffcc72bb2363d8 /libmproxy | |
parent | 585bf9423fdbc17f982088df21240d2e1652df4e (diff) | |
download | mitmproxy-35f4a1c424907d296a2ee0e852107542fcf8ac0d.tar.gz mitmproxy-35f4a1c424907d296a2ee0e852107542fcf8ac0d.tar.bz2 mitmproxy-35f4a1c424907d296a2ee0e852107542fcf8ac0d.zip |
Tune content viewing to maintain responsiveness:
- Reduce display cutoff to 20k.
- Make sure that we only indent the visible part of a JS body, not the whole
thing.
Diffstat (limited to 'libmproxy')
-rw-r--r-- | libmproxy/console/contentview.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libmproxy/console/contentview.py b/libmproxy/console/contentview.py index 4f468b8f..10a33e05 100644 --- a/libmproxy/console/contentview.py +++ b/libmproxy/console/contentview.py @@ -6,7 +6,7 @@ import common from .. import utils, encoding, flow from ..contrib import jsbeautifier -VIEW_CUTOFF = 1024*100 +VIEW_CUTOFF = 1024*20 VIEW_CONTENT_RAW = 0 VIEW_CONTENT_HEX = 1 @@ -64,21 +64,21 @@ def trailer(clen, txt): ) -def _view_text(content): +def _view_text(content, total): """ Generates a body for a chunk of text. """ txt = [] - for i in utils.cleanBin(content[:VIEW_CUTOFF]).splitlines(): + for i in utils.cleanBin(content).splitlines(): txt.append( urwid.Text(("text", i)) ) - trailer(len(content), txt) + trailer(total, txt) return txt def view_raw(hdrs, content): - txt = _view_text(content) + txt = _view_text(content[:VIEW_CUTOFF], len(content)) return "Raw", txt @@ -170,8 +170,8 @@ def view_urlencoded(hdrs, content): def view_javascript(hdrs, content): opts = jsbeautifier.default_options() opts.indent_size = 2 - res = jsbeautifier.beautify(content, opts) - return "JavaScript", _view_text(res) + res = jsbeautifier.beautify(content[:VIEW_CUTOFF], opts) + return "JavaScript", _view_text(res, len(content)) def view_image(hdrs, content): |