From 3e37cbd061ff97868a434fc0b2c62f5861408a38 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Sat, 10 Dec 2016 12:06:33 +0100 Subject: [PATCH] minor fixes --- examples/simple/modify_body_inject_iframe.py | 2 +- mitmproxy/contentviews/auto.py | 2 +- test/mitmproxy/contentviews/test_api.py | 2 +- test/mitmproxy/test_examples.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/simple/modify_body_inject_iframe.py b/examples/simple/modify_body_inject_iframe.py index 7f9cc9583..e3d5fee97 100644 --- a/examples/simple/modify_body_inject_iframe.py +++ b/examples/simple/modify_body_inject_iframe.py @@ -11,7 +11,7 @@ class Injector: def response(self, flow): if flow.request.host in self.iframe_url: return - html = BeautifulSoup(flow.response.content) + html = BeautifulSoup(flow.response.content, "html.parser") if html.body: iframe = html.new_tag( "iframe", diff --git a/mitmproxy/contentviews/auto.py b/mitmproxy/contentviews/auto.py index 3a162f530..7b3cbd781 100644 --- a/mitmproxy/contentviews/auto.py +++ b/mitmproxy/contentviews/auto.py @@ -17,7 +17,7 @@ class ViewAuto(base.View): if ct in contentviews.content_types_map: return contentviews.content_types_map[ct][0](data, **metadata) elif strutils.is_xml(data): - return contentviews.get("XML")(data, **metadata) + return contentviews.get("XML/HTML")(data, **metadata) if metadata.get("query"): return contentviews.get("Query")(data, **metadata) if data and strutils.is_mostly_bin(data): diff --git a/test/mitmproxy/contentviews/test_api.py b/test/mitmproxy/contentviews/test_api.py index 37bdd40f7..8e6c3427c 100644 --- a/test/mitmproxy/contentviews/test_api.py +++ b/test/mitmproxy/contentviews/test_api.py @@ -82,4 +82,4 @@ def test_get_message_content_view(): def test_get_by_shortcut(): - assert contentviews.get_by_shortcut("h") + assert contentviews.get_by_shortcut("s") diff --git a/test/mitmproxy/test_examples.py b/test/mitmproxy/test_examples.py index 946373506..8db2507f6 100644 --- a/test/mitmproxy/test_examples.py +++ b/test/mitmproxy/test_examples.py @@ -56,7 +56,7 @@ class TestScripts(mastertest.MasterTest): tscript("simple/modify_body_inject_iframe.py") m, sc = tscript("simple/modify_body_inject_iframe.py", "http://example.org/evil_iframe") - f = tflow.tflow(resp=tutils.tresp(content=b"mitmproxy")) + f = tflow.tflow(resp=tutils.tresp(content=b"mitmproxy")) m.response(f) content = f.response.content assert b'iframe' in content and b'evil_iframe' in content