diff options
author | lymanZerga11 <lymanZerga11@users.noreply.github.com> | 2017-03-08 11:34:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-08 11:34:59 +0800 |
commit | cf83cbf2dffebf34b451fb9f89d4ade5bfe47e72 (patch) | |
tree | 95d38830bd189b89f0d97fd628eb0b5a8782ae26 | |
parent | cb6240974d16e9f2923543fe28c201d39a63f60f (diff) | |
download | mitmproxy-cf83cbf2dffebf34b451fb9f89d4ade5bfe47e72.tar.gz mitmproxy-cf83cbf2dffebf34b451fb9f89d4ade5bfe47e72.tar.bz2 mitmproxy-cf83cbf2dffebf34b451fb9f89d4ade5bfe47e72.zip |
Update proxyauth.py
-rw-r--r-- | mitmproxy/addons/proxyauth.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mitmproxy/addons/proxyauth.py b/mitmproxy/addons/proxyauth.py index 18a85866..ba6250f6 100644 --- a/mitmproxy/addons/proxyauth.py +++ b/mitmproxy/addons/proxyauth.py @@ -46,7 +46,7 @@ class ProxyAuth: self.htpasswd = None self.singleuser = None self.mode = None - self.authenticated = weakref.WeakSet() # type: Set[connections.ClientConnection] + self.authenticated = weakref.WeakKeyDictionary() """Contains all connections that are permanently authenticated after an HTTP CONNECT""" def enabled(self) -> bool: @@ -155,11 +155,12 @@ class ProxyAuth: def http_connect(self, f: http.HTTPFlow) -> None: if self.enabled(): if self.authenticate(f): - self.authenticated.add(f.client_conn) + self.authenticated[f.client_conn]=f.metadata["proxyauth"] def requestheaders(self, f: http.HTTPFlow) -> None: if self.enabled(): # Is this connection authenticated by a previous HTTP CONNECT? if f.client_conn in self.authenticated: + f.metadata["proxyauth"] = self.authenticated[f.client_conn] return self.authenticate(f) |