aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/scripts/tcp_stream_modify.py3
-rw-r--r--test/test_server.py12
2 files changed, 15 insertions, 0 deletions
diff --git a/test/scripts/tcp_stream_modify.py b/test/scripts/tcp_stream_modify.py
new file mode 100644
index 00000000..9870dddf
--- /dev/null
+++ b/test/scripts/tcp_stream_modify.py
@@ -0,0 +1,3 @@
+def tcp_message(ctx,tm):
+ if tm.sender == tm.server_conn:
+ tm.message = tm.message.replace("foo", "bar")
diff --git a/test/test_server.py b/test/test_server.py
index 5f348121..2e21fce7 100644
--- a/test/test_server.py
+++ b/test/test_server.py
@@ -502,6 +502,18 @@ class TestHttps2Http(tservers.ReverseProxTest):
class TestTransparent(tservers.TransparentProxTest, CommonMixin, TcpMixin):
ssl = False
+ def test_tcp_stream_modify(self):
+ self.master.load_script(
+ tutils.test_data.path("scripts/tcp_stream_modify.py"))
+
+ self._tcpproxy_on()
+ d = self.pathod('200:b"foo"')
+ self._tcpproxy_off()
+
+ assert d.content == "bar"
+
+ self.master.unload_scripts()
+
class TestTransparentSSL(tservers.TransparentProxTest, CommonMixin, TcpMixin):
ssl = True