diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2011-01-28 12:07:27 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2011-01-28 12:08:25 +1300 |
commit | dfefe3cdda9acd94032e100d0507f9c73ed8cd36 (patch) | |
tree | ab6b24ac8efff50571d3ac7f5fc14a515e3ebcf6 /libmproxy/utils.py | |
parent | 93ef691badcdaa1b7a5801eb40982c69f9b89534 (diff) | |
download | mitmproxy-dfefe3cdda9acd94032e100d0507f9c73ed8cd36.tar.gz mitmproxy-dfefe3cdda9acd94032e100d0507f9c73ed8cd36.tar.bz2 mitmproxy-dfefe3cdda9acd94032e100d0507f9c73ed8cd36.zip |
Make pretty-printing more robust.
Also, since BeautifulSoup is so damn slow, print a statusbar message saying
that we're calculating a pretty version of the response. Maybe I should add
hangman or something, becuase on a 200k document this can take ages.
Diffstat (limited to 'libmproxy/utils.py')
-rw-r--r-- | libmproxy/utils.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libmproxy/utils.py b/libmproxy/utils.py index a02ac840..7b9d0e32 100644 --- a/libmproxy/utils.py +++ b/libmproxy/utils.py @@ -47,8 +47,9 @@ def prettybody(s): Return a list of pretty-printed lines. """ s = BeautifulSoup.BeautifulStoneSoup(s) - s = s.prettify() - return s.split("\n") + s = s.prettify().strip() + parts = s.split("\n") + return [repr(i)[1:-1] for i in parts] def hexdump(s): |