예제 #1
0
    def test_setheaders(self):
        sh = setheaders.SetHeaders()
        with taddons.context() as tctx:
            tctx.configure(sh,
                           setheaders=[("~q", "one", "two"),
                                       ("~s", "one", "three")])
            f = tflow.tflow()
            f.request.headers["one"] = "xxx"
            sh.request(f)
            assert f.request.headers["one"] == "two"

            f = tflow.tflow(resp=True)
            f.response.headers["one"] = "xxx"
            sh.response(f)
            assert f.response.headers["one"] == "three"

            tctx.configure(sh,
                           setheaders=[("~s", "one", "two"),
                                       ("~s", "one", "three")])
            f = tflow.tflow(resp=True)
            f.request.headers["one"] = "xxx"
            f.response.headers["one"] = "xxx"
            sh.response(f)
            assert f.response.headers.get_all("one") == ["two", "three"]

            tctx.configure(sh,
                           setheaders=[("~q", "one", "two"),
                                       ("~q", "one", "three")])
            f = tflow.tflow()
            f.request.headers["one"] = "xxx"
            sh.request(f)
            assert f.request.headers.get_all("one") == ["two", "three"]
예제 #2
0
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(),
        replace.Replace(),
        script.ScriptLoader(),
        serverplayback.ServerPlayback(),
        setheaders.SetHeaders(),
        stickyauth.StickyAuth(),
        stickycookie.StickyCookie(),
        streambodies.StreamBodies(),
        save.Save(),
        upstream_auth.UpstreamAuth(),
    ]
예제 #3
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(),
    ]
예제 #4
0
 def test_configure(self):
     sh = setheaders.SetHeaders()
     with taddons.context() as tctx:
         with pytest.raises(Exception,
                            match="Invalid setheader filter pattern"):
             tctx.configure(sh, setheaders=[("~b", "one", "two")])
         tctx.configure(sh, setheaders=["/foo/bar/voing"])
예제 #5
0
 def test_configure(self):
     sh = setheaders.SetHeaders()
     with taddons.context() as tctx:
         tutils.raises("invalid setheader filter pattern",
                       tctx.configure,
                       sh,
                       setheaders=[("~b", "one", "two")])
         tctx.configure(sh, setheaders=["/foo/bar/voing"])
예제 #6
0
 def test_configure(self):
     sh = setheaders.SetHeaders()
     o = options.Options(
         setheaders = [("~b", "one", "two")]
     )
     tutils.raises(
         "invalid setheader filter pattern",
         sh.configure, o, o.keys()
     )
예제 #7
0
def default_addons():
    return [
        onboarding.Onboarding(),
        anticache.AntiCache(),
        anticomp.AntiComp(),
        stickyauth.StickyAuth(),
        stickycookie.StickyCookie(),
        script.ScriptLoader(),
        filestreamer.FileStreamer(),
        streambodies.StreamBodies(),
        replace.Replace(),
        setheaders.SetHeaders(),
        serverplayback.ServerPlayback(),
        clientplayback.ClientPlayback(),
    ]
예제 #8
0
def default_addons():
    return [
        onboarding.Onboarding(),
        proxyauth.ProxyAuth(),
        anticache.AntiCache(),
        anticomp.AntiComp(),
        stickyauth.StickyAuth(),
        stickycookie.StickyCookie(),
        script.ScriptLoader(),
        streamfile.StreamFile(),
        streambodies.StreamBodies(),
        replace.Replace(),
        setheaders.SetHeaders(),
        serverplayback.ServerPlayback(),
        clientplayback.ClientPlayback(),
        upstream_auth.UpstreamAuth(),
        disable_h2c_upgrade.DisableH2CleartextUpgrade(),
    ]
예제 #9
0
 def mkmaster(self, **opts):
     o = options.Options(**opts)
     m = mastertest.RecordingMaster(o, proxy.DummyServer())
     sh = setheaders.SetHeaders()
     m.addons.add(sh)
     return m, sh