Sanitize cookie names.

This commit is contained in:
Timo Reimann 2017-10-05 12:14:03 +02:00 committed by Traefiker
parent c94e5f3589
commit 8a67434380
2 changed files with 34 additions and 1 deletions

View file

@ -659,6 +659,13 @@ func TestServerResponseEmptyBackend(t *testing.T) {
}
}
func TestGetCookieName(t *testing.T) {
want := "_TRAEFIK_BACKEND__my_BACKEND-v1.0~rc1"
if got := getCookieName("/my/BACKEND-v1.0~rc1"); got != want {
t.Errorf("got sticky cookie name %q, want %q", got, want)
}
}
func buildDynamicConfig(dynamicConfigBuilders ...func(*types.Configuration)) *types.Configuration {
config := &types.Configuration{
Frontends: make(map[string]*types.Frontend),