aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/flow.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2011-08-02 16:14:33 +1200
committerAldo Cortesi <aldo@nullcube.com>2011-08-02 16:14:33 +1200
commit357502fe03a5f86c1c29d35c5d607541df157640 (patch)
tree76921abb49a94131e63e0e0d8a9e623a45642bc1 /libmproxy/flow.py
parent17835b9b78ae08f84a97e1128c23d85eab74c339 (diff)
downloadmitmproxy-357502fe03a5f86c1c29d35c5d607541df157640.tar.gz
mitmproxy-357502fe03a5f86c1c29d35c5d607541df157640.tar.bz2
mitmproxy-357502fe03a5f86c1c29d35c5d607541df157640.zip
General cleanup.
Cut out unused variables and code, generally shut up pychecker as much as is reasonable.
Diffstat (limited to 'libmproxy/flow.py')
-rw-r--r--libmproxy/flow.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/libmproxy/flow.py b/libmproxy/flow.py
index def52caa..090c539a 100644
--- a/libmproxy/flow.py
+++ b/libmproxy/flow.py
@@ -2,7 +2,7 @@
This module provides more sophisticated flow tracking. These match requests
with their responses, and provide filtering and interception facilities.
"""
-import subprocess, base64, sys, json, hashlib, Cookie, cookielib, copy
+import subprocess, sys, json, hashlib, Cookie, cookielib
import proxy, threading, netstring, filt
import controller, version
@@ -78,7 +78,6 @@ class ServerPlaybackState:
self.fmap = {}
for i in flows:
if i.response:
- h = self._hash(i)
l = self.fmap.setdefault(self._hash(i), [])
l.append(i)
@@ -150,7 +149,6 @@ class StickyCookieState:
def handle_request(self, f):
if f.match(self.flt):
- cs = []
for i in self.jar.keys():
match = [
cookielib.domain_match(i[0], f.request.host),
@@ -334,7 +332,7 @@ class Flow:
return c
-class State:
+class State(object):
def __init__(self):
self._flow_map = {}
self._flow_list = []
@@ -387,8 +385,11 @@ class State:
Add an error response to the state. Returns the matching flow, or
None if there isn't one.
"""
- f = self._flow_map.get(err.request) if err.request else None
- if not f:
+ if err.request:
+ f = self._flow_map.get(err.request)
+ if not f:
+ return None
+ else:
return None
f.error = err
if f.match(self._limit) and not f in self.view: