aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2017-02-09 14:34:31 +0100
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2017-02-09 16:08:24 +0100
commitd6d1ff017078ceb1730da9d2138b3ebcdccb7972 (patch)
tree80139cfbb0dbb3ad3e78d0a0217942945e58ba21 /mitmproxy
parent7a205e80aa94600291f87c96e51f13abe9fb4703 (diff)
downloadmitmproxy-d6d1ff017078ceb1730da9d2138b3ebcdccb7972.tar.gz
mitmproxy-d6d1ff017078ceb1730da9d2138b3ebcdccb7972.tar.bz2
mitmproxy-d6d1ff017078ceb1730da9d2138b3ebcdccb7972.zip
simplify state copy
Diffstat (limited to 'mitmproxy')
-rw-r--r--mitmproxy/connections.py7
-rw-r--r--mitmproxy/flow.py16
2 files changed, 2 insertions, 21 deletions
diff --git a/mitmproxy/connections.py b/mitmproxy/connections.py
index 9c4bca2f..a32889bd 100644
--- a/mitmproxy/connections.py
+++ b/mitmproxy/connections.py
@@ -1,6 +1,5 @@
import time
-import copy
import os
from mitmproxy import stateobject
@@ -82,9 +81,6 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
tls_version=str,
)
- def copy(self):
- return copy.copy(self)
-
def send(self, message):
if isinstance(message, list):
message = b''.join(message)
@@ -222,9 +218,6 @@ class ServerConnection(tcp.TCPClient, stateobject.StateObject):
via=None
))
- def copy(self):
- return copy.copy(self)
-
def connect(self):
self.timestamp_start = time.time()
tcp.TCPClient.connect(self)
diff --git a/mitmproxy/flow.py b/mitmproxy/flow.py
index 7034cb4a..5ef957c9 100644
--- a/mitmproxy/flow.py
+++ b/mitmproxy/flow.py
@@ -1,5 +1,4 @@
import time
-import copy
import uuid
from mitmproxy import controller # noqa
@@ -7,7 +6,7 @@ from mitmproxy import stateobject
from mitmproxy import connections
from mitmproxy import version
-import typing # noqa
+import typing # noqa
class Error(stateobject.StateObject):
@@ -53,10 +52,6 @@ class Error(stateobject.StateObject):
f.set_state(state)
return f
- def copy(self):
- c = copy.copy(self)
- return c
-
class Flow(stateobject.StateObject):
@@ -116,16 +111,9 @@ class Flow(stateobject.StateObject):
return f
def copy(self):
- f = copy.copy(self)
-
+ f = super().copy()
f.id = str(uuid.uuid4())
f.live = False
- f.client_conn = self.client_conn.copy()
- f.server_conn = self.server_conn.copy()
- f.metadata = self.metadata.copy()
-
- if self.error:
- f.error = self.error.copy()
return f
def modified(self):