diff --git a/docs/install.rst b/docs/install.rst index b9524897f..c90eaf9fa 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -85,7 +85,7 @@ libraries. This was tested on a fully patched installation of Ubuntu 16.04. .. code:: bash - sudo apt-get install python3-pip python3-dev libffi-dev libssl-dev libtiff5-dev libjpeg8-dev zlib1g-dev libwebp-dev + sudo apt-get install python3-pip python3-dev libffi-dev libssl-dev zlib1g-dev sudo pip3 install mitmproxy # or pip3 install --user mitmproxy On older Ubuntu versions, e.g., **12.04** and **14.04**, you may need to install @@ -104,7 +104,7 @@ libraries. This was tested on a fully patched installation of Fedora 24. .. code:: bash - sudo dnf install make gcc redhat-rpm-config python3-pip python3-devel libffi-devel openssl-devel libtiff-devel libjpeg-devel zlib-devel libwebp-devel openjpeg2-devel + sudo dnf install make gcc redhat-rpm-config python3-pip python3-devel libffi-devel openssl-devel zlib-devel sudo pip3 install mitmproxy # or pip3 install --user mitmproxy Make sure to have an up-to-date version of pip by running ``pip3 install -U pip``. diff --git a/mitmproxy/contentviews/image/view.py b/mitmproxy/contentviews/image/view.py index 8fdb26e95..d77e1ecb9 100644 --- a/mitmproxy/contentviews/image/view.py +++ b/mitmproxy/contentviews/image/view.py @@ -1,13 +1,9 @@ -import io import imghdr -from PIL import Image - +from mitmproxy.contentviews import base from mitmproxy.types import multidict from . import image_parser -from mitmproxy.contentviews import base - class ViewImage(base.View): name = "Image" @@ -16,8 +12,6 @@ class ViewImage(base.View): "image/png", "image/jpeg", "image/gif", - "image/vnd.microsoft.icon", - "image/x-icon", ] def __call__(self, data, **metadata): @@ -37,19 +31,3 @@ class ViewImage(base.View): parts = image_parser.parse_jpeg(data) fmt = base.format_dict(multidict.MultiDict(parts)) return "%s image" % f, fmt - try: - img = Image.open(io.BytesIO(data)) - except IOError: - return None - parts = [ - ("Format", str(img.format_description)), - ("Size", "%s x %s px" % img.size), - ("Mode", str(img.mode)), - ] - for i in sorted(img.info.keys()): - if i != "exif": - parts.append( - (str(i), str(img.info[i])) - ) - fmt = base.format_dict(multidict.MultiDict(parts)) - return "%s image" % img.format, fmt diff --git a/setup.py b/setup.py index 17d45b42b..1b3f08a4a 100644 --- a/setup.py +++ b/setup.py @@ -71,7 +71,6 @@ setup( "hyperframe>=4.0.1, <5", "jsbeautifier>=1.6.3, <1.7", "kaitaistruct>=0.6, <0.7", - "Pillow>=3.2, <4.1", "passlib>=1.6.5, <1.8", "pyasn1>=0.1.9, <0.3", "pyOpenSSL>=16.0, <17.0", @@ -118,6 +117,7 @@ setup( 'examples': [ "beautifulsoup4>=4.4.1, <4.6", "pytz>=2015.07.0, <=2016.10", + "Pillow>=3.2, <4.1", ] } ) diff --git a/test/mitmproxy/__init__.py b/test/mitmproxy/__init__.py index 28dc133fc..6f114e181 100644 --- a/test/mitmproxy/__init__.py +++ b/test/mitmproxy/__init__.py @@ -3,5 +3,4 @@ import logging logging.getLogger("hyper").setLevel(logging.WARNING) logging.getLogger("requests").setLevel(logging.WARNING) logging.getLogger("passlib").setLevel(logging.WARNING) -logging.getLogger("PIL").setLevel(logging.WARNING) logging.getLogger("tornado").setLevel(logging.WARNING) diff --git a/test/mitmproxy/contentviews/image/test_view.py b/test/mitmproxy/contentviews/image/test_view.py index ee2f9eaa1..84bcea17f 100644 --- a/test/mitmproxy/contentviews/image/test_view.py +++ b/test/mitmproxy/contentviews/image/test_view.py @@ -9,7 +9,6 @@ def test_view_image(): "mitmproxy/data/image.png", "mitmproxy/data/image.gif", "mitmproxy/data/all.jpeg", - "mitmproxy/data/image.ico" ]: with open(tutils.test_data.path(img), "rb") as f: assert v(f.read()) diff --git a/test/mitmproxy/proxy/protocol/test_http2.py b/test/mitmproxy/proxy/protocol/test_http2.py index f5d9259da..cede0b805 100644 --- a/test/mitmproxy/proxy/protocol/test_http2.py +++ b/test/mitmproxy/proxy/protocol/test_http2.py @@ -23,8 +23,6 @@ logging.getLogger("hyper.packages.hpack.hpack").setLevel(logging.WARNING) logging.getLogger("requests.packages.urllib3.connectionpool").setLevel(logging.WARNING) logging.getLogger("passlib.utils.compat").setLevel(logging.WARNING) logging.getLogger("passlib.registry").setLevel(logging.WARNING) -logging.getLogger("PIL.Image").setLevel(logging.WARNING) -logging.getLogger("PIL.PngImagePlugin").setLevel(logging.WARNING) # inspect the log: