From 50b7bfaadcd78e36a0fd3ade5e912a93308e2815 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sat, 2 May 2015 16:46:15 +1200 Subject: [PATCH] Adapt to new Pathoc API - silence output to stdout. --- libmproxy/console/contentview.py | 3 +-- test/test_server.py | 6 ++++-- test/tservers.py | 20 ++++++++++++++------ 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/libmproxy/console/contentview.py b/libmproxy/console/contentview.py index aafba4d77..a121dfab3 100644 --- a/libmproxy/console/contentview.py +++ b/libmproxy/console/contentview.py @@ -6,7 +6,6 @@ import lxml.html import lxml.etree from PIL import Image from PIL.ExifTags import TAGS -import re import subprocess import traceback import urwid @@ -15,7 +14,7 @@ import netlib.utils from netlib import odict from . import common -from .. import utils, encoding, flow +from .. import utils, encoding from ..contrib import jsbeautifier, html2text from ..contrib.wbxml.ASCommandResponse import ASCommandResponse diff --git a/test/test_server.py b/test/test_server.py index 0f0afd7fd..7f93c7294 100644 --- a/test/test_server.py +++ b/test/test_server.py @@ -353,7 +353,9 @@ class TestHttps2Http(tservers.ReverseProxTest): """ Returns a connected Pathoc instance. """ - p = libpathod.pathoc.Pathoc(("localhost", self.proxy.port), ssl=ssl, sni=sni) + p = libpathod.pathoc.Pathoc( + ("localhost", self.proxy.port), ssl=ssl, sni=sni, fp=None + ) p.connect() return p @@ -380,7 +382,7 @@ class TestTransparentSSL(tservers.TransparentProxTest, CommonMixin, TcpMixin): ssl = True def test_sslerr(self): - p = pathoc.Pathoc(("localhost", self.proxy.port)) + p = pathoc.Pathoc(("localhost", self.proxy.port), fp=None) p.connect() r = p.request("get:/") assert r.status_code == 400 diff --git a/test/tservers.py b/test/tservers.py index 30c8b52e3..bcda02955 100644 --- a/test/tservers.py +++ b/test/tservers.py @@ -129,13 +129,15 @@ class ProxTestBase(object): class HTTPProxTest(ProxTestBase): def pathoc_raw(self): - return libpathod.pathoc.Pathoc(("127.0.0.1", self.proxy.port)) + return libpathod.pathoc.Pathoc(("127.0.0.1", self.proxy.port), fp=None) def pathoc(self, sni=None): """ Returns a connected Pathoc instance. """ - p = libpathod.pathoc.Pathoc(("localhost", self.proxy.port), ssl=self.ssl, sni=sni) + p = libpathod.pathoc.Pathoc( + ("localhost", self.proxy.port), ssl=self.ssl, sni=sni, fp=None + ) if self.ssl: p.connect(("127.0.0.1", self.server.port)) else: @@ -156,7 +158,9 @@ class HTTPProxTest(ProxTestBase): def app(self, page): if self.ssl: - p = libpathod.pathoc.Pathoc(("127.0.0.1", self.proxy.port), True) + p = libpathod.pathoc.Pathoc( + ("127.0.0.1", self.proxy.port), True, fp=None + ) p.connect((APP_HOST, APP_PORT)) return p.request("get:'%s'"%page) else: @@ -208,7 +212,9 @@ class TransparentProxTest(ProxTestBase): """ Returns a connected Pathoc instance. """ - p = libpathod.pathoc.Pathoc(("localhost", self.proxy.port), ssl=self.ssl, sni=sni) + p = libpathod.pathoc.Pathoc( + ("localhost", self.proxy.port), ssl=self.ssl, sni=sni, fp=None + ) p.connect() return p @@ -231,7 +237,9 @@ class ReverseProxTest(ProxTestBase): """ Returns a connected Pathoc instance. """ - p = libpathod.pathoc.Pathoc(("localhost", self.proxy.port), ssl=self.ssl, sni=sni) + p = libpathod.pathoc.Pathoc( + ("localhost", self.proxy.port), ssl=self.ssl, sni=sni, fp=None + ) p.connect() return p @@ -296,4 +304,4 @@ class ChainProxTest(ProxTestBase): return d class HTTPUpstreamProxTest(ChainProxTest, HTTPProxTest): - pass \ No newline at end of file + pass