コード例 #1
0
def default_addons():
    return [
        core.Core(),
        core_option_validation.CoreOptionValidation(),
        allowremote.AllowRemote(),
        anticache.AntiCache(),
        anticomp.AntiComp(),
        check_alpn.CheckALPN(),
        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(),
    ]
コード例 #2
0
def test_simple():
    sa = core_option_validation.CoreOptionValidation()
    with taddons.context() as tctx:
        with pytest.raises(exceptions.OptionsError):
            tctx.configure(sa, body_size_limit="invalid")
        tctx.configure(sa, body_size_limit="1m")

        with pytest.raises(exceptions.OptionsError,
                           match="mutually exclusive"):
            tctx.configure(sa,
                           add_upstream_certs_to_client_chain=True,
                           upstream_cert=False)
        with pytest.raises(exceptions.OptionsError, match="Invalid mode"):
            tctx.configure(sa, mode="Flibble")
コード例 #3
0
ファイル: __init__.py プロジェクト: liyancode/mitmproxy
def default_addons():
    return [
        core_option_validation.CoreOptionValidation(),
        anticache.AntiCache(),
        anticomp.AntiComp(),
        check_alpn.CheckALPN(),
        check_ca.CheckCA(),
        clientplayback.ClientPlayback(),
        disable_h2c_upgrade.DisableH2CleartextUpgrade(),
        onboarding.Onboarding(),
        proxyauth.ProxyAuth(),
        replace.Replace(),
        replace.ReplaceFile(),
        script.ScriptLoader(),
        serverplayback.ServerPlayback(),
        setheaders.SetHeaders(),
        stickyauth.StickyAuth(),
        stickycookie.StickyCookie(),
        streambodies.StreamBodies(),
        streamfile.StreamFile(),
        upstream_auth.UpstreamAuth(),
    ]
コード例 #4
0
def test_modes(m):
    sa = core_option_validation.CoreOptionValidation()
    with taddons.context() as tctx:
        tctx.configure(sa, mode = "reverse:http://localhost")
        with pytest.raises(Exception, match="Invalid server specification"):
            tctx.configure(sa, mode = "reverse:")
コード例 #5
0
def test_no_transparent():
    sa = core_option_validation.CoreOptionValidation()
    with taddons.context() as tctx:
        with pytest.raises(Exception, match="Transparent mode not supported"):
            tctx.configure(sa, mode = "transparent")