diff options
Diffstat (limited to 'libmproxy')
| -rw-r--r-- | libmproxy/flow.py | 16 | ||||
| -rw-r--r-- | libmproxy/protocol/http.py | 1 | ||||
| -rw-r--r-- | libmproxy/protocol/tcp.py | 2 | ||||
| -rw-r--r-- | libmproxy/proxy.py | 16 | 
4 files changed, 19 insertions, 16 deletions
diff --git a/libmproxy/flow.py b/libmproxy/flow.py index d48c35dc..4032461d 100644 --- a/libmproxy/flow.py +++ b/libmproxy/flow.py @@ -236,7 +236,6 @@ class ServerPlaybackState:              return l.pop(0) -  class StickyCookieState:      def __init__(self, flt):          """ @@ -306,7 +305,6 @@ class StickyAuthState:  class State(object):      def __init__(self): -        self._flow_map = {}          self._flow_list = []          self.view = [] @@ -320,7 +318,7 @@ class State(object):          return self._limit_txt      def flow_count(self): -        return len(self._flow_map) +        return len(self._flow_list)      def index(self, f):          return self._flow_list.index(f) @@ -338,8 +336,6 @@ class State(object):          """          f = req.flow          self._flow_list.append(f) -        self._flow_map[req] = f -        assert len(self._flow_list) == len(self._flow_map)          if f.match(self._limit):              self.view.append(f)          return f @@ -348,10 +344,9 @@ class State(object):          """              Add a response to the state. Returns the matching flow.          """ -        f = self._flow_map.get(resp.flow) +        f = resp.flow          if not f:              return False -        f.response = resp          if f.match(self._limit) and not f in self.view:              self.view.append(f)          return f @@ -361,18 +356,15 @@ class State(object):              Add an error response to the state. Returns the matching flow, or              None if there isn't one.          """ -        f = self._flow_map.get(err.flow) +        f = err.flow          if not f:              return None -        f.error = err          if f.match(self._limit) and not f in self.view:              self.view.append(f)          return f      def load_flows(self, flows):          self._flow_list.extend(flows) -        for i in flows: -            self._flow_map[i.request] = i          self.recalculate_view()      def set_limit(self, txt): @@ -405,8 +397,6 @@ class State(object):              self.view = self._flow_list[:]      def delete_flow(self, f): -        if f.request in self._flow_map: -            del self._flow_map[f.request]          self._flow_list.remove(f)          if f in self.view:              self.view.remove(f) diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py index fcfc53b8..29cdf446 100644 --- a/libmproxy/protocol/http.py +++ b/libmproxy/protocol/http.py @@ -874,6 +874,7 @@ class HTTPFlow(Flow):              c += self.response.replace(pattern, repl, *args, **kwargs)          return c +  class HttpAuthenticationError(Exception):      def __init__(self, auth_headers=None):          self.auth_headers = auth_headers diff --git a/libmproxy/protocol/tcp.py b/libmproxy/protocol/tcp.py index 4441d2f0..406a6f7b 100644 --- a/libmproxy/protocol/tcp.py +++ b/libmproxy/protocol/tcp.py @@ -54,6 +54,6 @@ class TCPHandler(ProtocolHandler):                          self.c.close = True                      break -                self.c.log("%s %s" % (direction, dst_str), ["\r\n" + data]) +                self.c.log("%s %s\r\n%s" % (direction, dst_str,data))                  dst.wfile.write(data)                  dst.wfile.flush()
\ No newline at end of file diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index e63573fb..e69bb6da 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -291,8 +291,20 @@ class ConnectionHandler:          A protocol handler must raise a ConnTypeChanged exception if it detects that this is happening          """          # TODO: Implement SSL pass-through handling and change conntype -        if self.server_conn.address.host == "news.ycombinator.com": +        passthrough = ["echo.websocket.org", +                       "174.129.224.73" # echo.websocket.org, transparent mode +                        ] +        if self.server_conn.address.host in passthrough or self.sni in passthrough:              self.conntype = "tcp" +            return + +        if client or server: +            subs = [] +            if client: +                subs.append("with client") +            if server: +                subs.append("with server (sni: %s)" % self.sni) +            self.log("Establish SSL", subs)          if server:              if self.server_conn.ssl_established: @@ -307,7 +319,7 @@ class ConnectionHandler:      def server_reconnect(self, no_ssl=False):          had_ssl, sni = self.server_conn.ssl_established, self.sni -        self.log("server reconnect (ssl: %s, sni: %s)" % (had_ssl, sni)) +        self.log("(server reconnect follows)")          self.establish_server_connection(self.server_conn.address())          if had_ssl and not no_ssl:              self.sni = sni  | 
