aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-09-17 02:13:28 +0200
committerMaximilian Hils <git@maximilianhils.com>2015-09-17 02:13:28 +0200
commit14a5f405fdf3973f05ca11182e927d145d10d8d6 (patch)
tree2843010882d64d928c0f53edffa9f8d48cee6da0 /test
parent8fbed971ae4a84e875f1072805b17cc7ada39fad (diff)
downloadmitmproxy-14a5f405fdf3973f05ca11182e927d145d10d8d6.tar.gz
mitmproxy-14a5f405fdf3973f05ca11182e927d145d10d8d6.tar.bz2
mitmproxy-14a5f405fdf3973f05ca11182e927d145d10d8d6.zip
use new netlib exceptions
Diffstat (limited to 'test')
-rw-r--r--test/test_proxy.py3
-rw-r--r--test/test_server.py17
2 files changed, 3 insertions, 17 deletions
diff --git a/test/test_proxy.py b/test/test_proxy.py
index 76d8758c..172613aa 100644
--- a/test/test_proxy.py
+++ b/test/test_proxy.py
@@ -6,6 +6,7 @@ from libmproxy.proxy import ProxyConfig
from libmproxy.proxy.config import process_proxy_options
from libmproxy.models.connections import ServerConnection
from libmproxy.proxy.server import DummyServer, ProxyServer, ConnectionHandler
+from netlib.exceptions import TcpDisconnect
import tutils
from libpathod import test
from netlib import http, tcp
@@ -40,7 +41,7 @@ class TestServerConnection:
sc.connect()
sc.connection = mock.Mock()
sc.connection.recv = mock.Mock(return_value=False)
- sc.connection.flush = mock.Mock(side_effect=tcp.NetLibDisconnect)
+ sc.connection.flush = mock.Mock(side_effect=TcpDisconnect)
sc.finish()
def test_repr(self):
diff --git a/test/test_server.py b/test/test_server.py
index 0e338368..63357563 100644
--- a/test/test_server.py
+++ b/test/test_server.py
@@ -260,21 +260,6 @@ class TestHTTP(tservers.HTTPProxTest, CommonMixin, AppMixin):
resp = p.request("get:'http://foo':h':foo'='bar'")
assert resp.status_code == 400
- def test_empty_chunked_content(self):
- """
- https://github.com/mitmproxy/mitmproxy/issues/186
- """
- connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- connection.connect(("127.0.0.1", self.proxy.port))
- spec = '301:h"Transfer-Encoding"="chunked":r:b"0\\r\\n\\r\\n"'
- connection.send(
- "GET http://localhost:%d/p/%s HTTP/1.1\r\n" %
- (self.server.port, spec))
- connection.send("\r\n")
- resp = connection.recv(50000)
- connection.close()
- assert "content-length" in resp.lower()
-
def test_stream(self):
self.master.set_stream_large_bodies(1024 * 2)
@@ -624,7 +609,7 @@ class MasterRedirectRequest(tservers.TestMaster):
super(MasterRedirectRequest, self).handle_request(f)
def handle_response(self, f):
- f.response.content = str(f.client_conn.address.port)
+ f.response.body = str(f.client_conn.address.port)
f.response.headers["server-conn-id"] = str(f.server_conn.source_address.port)
super(MasterRedirectRequest, self).handle_response(f)