mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 10:16:27 +00:00
upstream_proxy_auth -> upstream_auth
Also clarify what this does in commandline help.
This commit is contained in:
parent
3b00bc339d
commit
fe01b1435a
@ -10,7 +10,7 @@ from mitmproxy.addons import serverplayback
|
|||||||
from mitmproxy.addons import stickyauth
|
from mitmproxy.addons import stickyauth
|
||||||
from mitmproxy.addons import stickycookie
|
from mitmproxy.addons import stickycookie
|
||||||
from mitmproxy.addons import streambodies
|
from mitmproxy.addons import streambodies
|
||||||
from mitmproxy.addons import upstream_proxy_auth
|
from mitmproxy.addons import upstream_auth
|
||||||
|
|
||||||
|
|
||||||
def default_addons():
|
def default_addons():
|
||||||
@ -27,5 +27,5 @@ def default_addons():
|
|||||||
setheaders.SetHeaders(),
|
setheaders.SetHeaders(),
|
||||||
serverplayback.ServerPlayback(),
|
serverplayback.ServerPlayback(),
|
||||||
clientplayback.ClientPlayback(),
|
clientplayback.ClientPlayback(),
|
||||||
upstream_proxy_auth.UpstreamProxyAuth(),
|
upstream_auth.UpstreamAuth(),
|
||||||
]
|
]
|
||||||
|
@ -14,7 +14,7 @@ def parse_upstream_auth(auth):
|
|||||||
return b"Basic" + b" " + base64.b64encode(strutils.always_bytes(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
|
This addon handles authentication to systems upstream from us for the
|
||||||
upstream proxy and reverse proxy mode. There are 3 cases:
|
upstream proxy and reverse proxy mode. There are 3 cases:
|
@ -463,8 +463,8 @@ def proxy_options(parser):
|
|||||||
action="store", dest="upstream_auth", default=None,
|
action="store", dest="upstream_auth", default=None,
|
||||||
type=str,
|
type=str,
|
||||||
help="""
|
help="""
|
||||||
Proxy Authentication:
|
Add HTTP Basic authentcation to upstream proxy and reverse proxy
|
||||||
username:password
|
requests. Format: username:password
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
rawtcp = group.add_mutually_exclusive_group()
|
rawtcp = group.add_mutually_exclusive_group()
|
||||||
|
@ -4,11 +4,11 @@ from mitmproxy import exceptions
|
|||||||
from mitmproxy.test import taddons
|
from mitmproxy.test import taddons
|
||||||
from mitmproxy.test import tflow
|
from mitmproxy.test import tflow
|
||||||
from mitmproxy.test import tutils
|
from mitmproxy.test import tutils
|
||||||
from mitmproxy.addons import upstream_proxy_auth
|
from mitmproxy.addons import upstream_auth
|
||||||
|
|
||||||
|
|
||||||
def test_configure():
|
def test_configure():
|
||||||
up = upstream_proxy_auth.UpstreamProxyAuth()
|
up = upstream_auth.UpstreamAuth()
|
||||||
with taddons.context() as tctx:
|
with taddons.context() as tctx:
|
||||||
tctx.configure(up, upstream_auth="test:test")
|
tctx.configure(up, upstream_auth="test:test")
|
||||||
assert up.auth == b"Basic" + b" " + base64.b64encode(b"test:test")
|
assert up.auth == b"Basic" + b" " + base64.b64encode(b"test:test")
|
||||||
@ -40,7 +40,7 @@ def test_configure():
|
|||||||
|
|
||||||
|
|
||||||
def test_simple():
|
def test_simple():
|
||||||
up = upstream_proxy_auth.UpstreamProxyAuth()
|
up = upstream_auth.UpstreamAuth()
|
||||||
with taddons.context() as tctx:
|
with taddons.context() as tctx:
|
||||||
tctx.configure(up, upstream_auth="foo:bar")
|
tctx.configure(up, upstream_auth="foo:bar")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user