diff --git a/mitmproxy/addons/__init__.py b/mitmproxy/addons/__init__.py index d25c231bb..d71b89125 100644 --- a/mitmproxy/addons/__init__.py +++ b/mitmproxy/addons/__init__.py @@ -10,7 +10,7 @@ from mitmproxy.addons import serverplayback from mitmproxy.addons import stickyauth from mitmproxy.addons import stickycookie from mitmproxy.addons import streambodies -from mitmproxy.addons import upstream_proxy_auth +from mitmproxy.addons import upstream_auth def default_addons(): @@ -27,5 +27,5 @@ def default_addons(): setheaders.SetHeaders(), serverplayback.ServerPlayback(), clientplayback.ClientPlayback(), - upstream_proxy_auth.UpstreamProxyAuth(), + upstream_auth.UpstreamAuth(), ] diff --git a/mitmproxy/addons/upstream_proxy_auth.py b/mitmproxy/addons/upstream_auth.py similarity index 98% rename from mitmproxy/addons/upstream_proxy_auth.py rename to mitmproxy/addons/upstream_auth.py index 8b31c10a1..9beecfc08 100644 --- a/mitmproxy/addons/upstream_proxy_auth.py +++ b/mitmproxy/addons/upstream_auth.py @@ -14,7 +14,7 @@ def parse_upstream_auth(auth): return b"Basic" + b" " + base64.b64encode(strutils.always_bytes(auth)) -class UpstreamProxyAuth(): +class UpstreamAuth(): """ This addon handles authentication to systems upstream from us for the upstream proxy and reverse proxy mode. There are 3 cases: diff --git a/mitmproxy/tools/cmdline.py b/mitmproxy/tools/cmdline.py index debe6db9f..8b5799524 100644 --- a/mitmproxy/tools/cmdline.py +++ b/mitmproxy/tools/cmdline.py @@ -463,8 +463,8 @@ def proxy_options(parser): action="store", dest="upstream_auth", default=None, type=str, help=""" - Proxy Authentication: - username:password + Add HTTP Basic authentcation to upstream proxy and reverse proxy + requests. Format: username:password """ ) rawtcp = group.add_mutually_exclusive_group() diff --git a/test/mitmproxy/addons/test_upstream_proxy_auth.py b/test/mitmproxy/addons/test_upstream_auth.py similarity index 91% rename from test/mitmproxy/addons/test_upstream_proxy_auth.py rename to test/mitmproxy/addons/test_upstream_auth.py index d5d6a3e3c..985b13a7c 100644 --- a/test/mitmproxy/addons/test_upstream_proxy_auth.py +++ b/test/mitmproxy/addons/test_upstream_auth.py @@ -4,11 +4,11 @@ from mitmproxy import exceptions from mitmproxy.test import taddons from mitmproxy.test import tflow from mitmproxy.test import tutils -from mitmproxy.addons import upstream_proxy_auth +from mitmproxy.addons import upstream_auth def test_configure(): - up = upstream_proxy_auth.UpstreamProxyAuth() + up = upstream_auth.UpstreamAuth() with taddons.context() as tctx: tctx.configure(up, upstream_auth="test:test") assert up.auth == b"Basic" + b" " + base64.b64encode(b"test:test") @@ -40,7 +40,7 @@ def test_configure(): def test_simple(): - up = upstream_proxy_auth.UpstreamProxyAuth() + up = upstream_auth.UpstreamAuth() with taddons.context() as tctx: tctx.configure(up, upstream_auth="foo:bar")