aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-12-10 12:06:33 +0100
committerMaximilian Hils <git@maximilianhils.com>2016-12-10 12:06:33 +0100
commit3e37cbd061ff97868a434fc0b2c62f5861408a38 (patch)
treed637479fb6898ab20e150d56b02666ad6d3b925d
parent123ef043dc7214c9818985aeea565a82c2680c0e (diff)
downloadmitmproxy-3e37cbd061ff97868a434fc0b2c62f5861408a38.tar.gz
mitmproxy-3e37cbd061ff97868a434fc0b2c62f5861408a38.tar.bz2
mitmproxy-3e37cbd061ff97868a434fc0b2c62f5861408a38.zip
minor fixes
-rw-r--r--examples/simple/modify_body_inject_iframe.py2
-rw-r--r--mitmproxy/contentviews/auto.py2
-rw-r--r--test/mitmproxy/contentviews/test_api.py2
-rw-r--r--test/mitmproxy/test_examples.py2
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 7f9cc958..e3d5fee9 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 3a162f53..7b3cbd78 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 37bdd40f..8e6c3427 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 94637350..8db2507f 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"<html>mitmproxy</html>"))
+ f = tflow.tflow(resp=tutils.tresp(content=b"<html><body>mitmproxy</body></html>"))
m.response(f)
content = f.response.content
assert b'iframe' in content and b'evil_iframe' in content