def default_addons(): return [ core.Core(), browser.Browser(), block.Block(), anticache.AntiCache(), anticomp.AntiComp(), check_ca.CheckCA(), clientplayback.ClientPlayback(), command_history.CommandHistory(), cut.Cut(), disable_h2c.DisableH2C(), export.Export(), onboarding.Onboarding(), proxyauth.ProxyAuth(), script.ScriptLoader(), serverplayback.ServerPlayback(), mapremote.MapRemote(), modifybody.ModifyBody(), modifyheaders.ModifyHeaders(), stickyauth.StickyAuth(), stickycookie.StickyCookie(), streambodies.StreamBodies(), save.Save(), upstream_auth.UpstreamAuth(), ]
def default_addons(): return [ core.Core(), browser.Browser(), block.Block(), blocklist.BlockList(), anticache.AntiCache(), anticomp.AntiComp(), clientplayback.ClientPlayback(), command_history.CommandHistory(), comment.Comment(), cut.Cut(), disable_h2c.DisableH2C(), export.Export(), onboarding.Onboarding(), proxyauth.ProxyAuth(), proxyserver.Proxyserver(), script.ScriptLoader(), next_layer.NextLayer(), serverplayback.ServerPlayback(), mapremote.MapRemote(), maplocal.MapLocal(), modifybody.ModifyBody(), modifyheaders.ModifyHeaders(), stickyauth.StickyAuth(), stickycookie.StickyCookie(), save.Save(), tlsconfig.TlsConfig(), upstream_auth.UpstreamAuth(), ]
async def test_block_global(block_global, block_private, should_be_killed, address): ar = block.Block() with taddons.context(ar) as tctx: tctx.configure(ar, block_global=block_global, block_private=block_private) client = context.Client(address, ("127.0.0.1", 8080), 1607699500) ar.client_connected(client) assert bool(client.error) == should_be_killed
async def test_block_global(block_global, block_private, should_be_killed, address): ar = block.Block() with taddons.context(ar) as tctx: tctx.options.block_global = block_global tctx.options.block_private = block_private with mock.patch('mitmproxy.proxy.protocol.base.Layer') as layer: layer.client_conn.address = address ar.clientconnect(layer) if should_be_killed: assert layer.reply.kill.called assert await tctx.master.await_log("killed", "warn") else: assert not layer.reply.kill.called
async def test_block_global(block_global, block_private, should_be_killed, address): ar = block.Block() with taddons.context(ar) as tctx: if compat.new_proxy_core: from mitmproxy.proxy2 import context tctx.configure(ar, block_global=block_global, block_private=block_private) client = context.Client(address, ("127.0.0.1", 8080), 1607699500) ar.client_connected(client) assert bool(client.error) == should_be_killed return tctx.options.block_global = block_global tctx.options.block_private = block_private with mock.patch('mitmproxy.proxy.protocol.base.Layer') as layer: layer.client_conn.address = address ar.clientconnect(layer) if should_be_killed: assert layer.reply.kill.called assert await tctx.master.await_log("killed", "warn") else: assert not layer.reply.kill.called
def default_addons(): return [ core.Core(), browser.Browser(), block.Block(), anticache.AntiCache(), anticomp.AntiComp(), check_ca.CheckCA(), clientplayback.ClientPlayback(), cut.Cut(), disable_h2c.DisableH2C(), export.Export(), onboarding.Onboarding(), proxyauth.ProxyAuth(), replace.Replace(), script.ScriptLoader(), serverplayback.ServerPlayback(), setheaders.SetHeaders(), stickyauth.StickyAuth(), stickycookie.StickyCookie(), streambodies.StreamBodies(), save.Save(), upstream_auth.UpstreamAuth(), ]