aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/flow.py
diff options
context:
space:
mode:
Diffstat (limited to 'libmproxy/flow.py')
-rw-r--r--libmproxy/flow.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/libmproxy/flow.py b/libmproxy/flow.py
index 8343c183..553bfd84 100644
--- a/libmproxy/flow.py
+++ b/libmproxy/flow.py
@@ -17,9 +17,6 @@ from .proxy.config import HostMatcher
from .proxy.connection import ClientConnection, ServerConnection
import urlparse
-ODict = odict.ODict
-ODictCaseless = odict.ODictCaseless
-
class AppRegistry:
def __init__(self):
@@ -232,7 +229,7 @@ class ServerPlaybackState:
r = flow.request
_, _, path, _, query, _ = urlparse.urlparse(r.url)
- queriesArray = urlparse.parse_qsl(query)
+ queriesArray = urlparse.parse_qsl(query, keep_blank_values=True)
key = [
str(r.port),
@@ -242,7 +239,7 @@ class ServerPlaybackState:
]
if not self.ignore_content:
- form_contents = r.get_form_urlencoded()
+ form_contents = r.get_form()
if self.ignore_payload_params and form_contents:
key.extend(
p for p in form_contents
@@ -271,7 +268,7 @@ class ServerPlaybackState:
# to prevent a mismatch between unicode/non-unicode.
v = [str(x) for x in v]
hdrs.append((i, v))
- key.append(repr(hdrs))
+ key.append(hdrs)
return hashlib.sha256(repr(key)).digest()
def next_flow(self, request):
@@ -593,6 +590,10 @@ class State(object):
def accept_all(self, master):
self.flows.accept_all(master)
+ def backup(self, f):
+ f.backup()
+ self.update_flow(f)
+
def revert(self, f):
f.revert()
self.update_flow(f)
@@ -732,7 +733,7 @@ class FlowMaster(controller.Master):
ignore_payload_params: list of content params to ignore in server replay
ignore_host: true if request host should be ignored in server replay
"""
- self.server_playback = ServerPlaybackState(headers, flows, exit, nopop,
+ self.server_playback = ServerPlaybackState(headers, flows, exit, nopop,
ignore_params, ignore_content,
ignore_payload_params, ignore_host)
self.kill_nonreplay = kill
@@ -771,6 +772,8 @@ class FlowMaster(controller.Master):
if all(e):
self.shutdown()
self.client_playback.tick(self)
+ if self.client_playback.done():
+ self.client_playback = None
return super(FlowMaster, self).tick(q, timeout)
@@ -780,7 +783,7 @@ class FlowMaster(controller.Master):
def create_request(self, method, scheme, host, port, path):
"""
this method creates a new artificial and minimalist request also adds it to flowlist
- """
+ """
c = ClientConnection.from_state(dict(
address=dict(address=(host, port), use_ipv6=False),
clientcert=None
@@ -796,7 +799,7 @@ class FlowMaster(controller.Master):
))
f = http.HTTPFlow(c,s);
headers = ODictCaseless()
-
+
req = http.HTTPRequest("absolute", method, scheme, host, port, path, (1, 1), headers, None,
None, None, None)
f.request = req