diff options
author | 2016-04-12 22:34:44 +0100 | |
---|---|---|
committer | 2016-04-12 22:34:44 +0100 | |
commit | 25cf16af0e816a2b321cf9ed46e91c1ef067927e (patch) | |
tree | a786606d66313a136e03275db59e7efd1e3ef285 /middleware/proxy | |
parent | 842953f17936ac02a7d9c82cb31ef70b5bcc1dc5 (diff) | |
download | coredns-25cf16af0e816a2b321cf9ed46e91c1ef067927e.tar.gz coredns-25cf16af0e816a2b321cf9ed46e91c1ef067927e.tar.zst coredns-25cf16af0e816a2b321cf9ed46e91c1ef067927e.zip |
Use dns.IsSubDomain (#112)
For the match function use the proper thing from go dns. Fix all
callers and tests to use this.
Fixes: #107
Diffstat (limited to 'middleware/proxy')
-rw-r--r-- | middleware/proxy/upstream.go | 3 | ||||
-rw-r--r-- | middleware/proxy/upstream_test.go | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/middleware/proxy/upstream.go b/middleware/proxy/upstream.go index 52375323e..7f339c01f 100644 --- a/middleware/proxy/upstream.go +++ b/middleware/proxy/upstream.go @@ -238,6 +238,9 @@ func (u *staticUpstream) Select() *UpstreamHost { func (u *staticUpstream) IsAllowedPath(name string) bool { for _, ignoredSubDomain := range u.IgnoredSubDomains { + if dns.Name(name) == dns.Name(u.From()) { + return true + } if middleware.Name(name).Matches(ignoredSubDomain + u.From()) { return false } diff --git a/middleware/proxy/upstream_test.go b/middleware/proxy/upstream_test.go index 6f96d7ce2..3d69ca8fb 100644 --- a/middleware/proxy/upstream_test.go +++ b/middleware/proxy/upstream_test.go @@ -70,7 +70,7 @@ func TestAllowedPaths(t *testing.T) { for i, test := range tests { isAllowed := upstream.IsAllowedPath(test.name) if test.expected != isAllowed { - t.Errorf("Test %d: expected %v found %v", i+1, test.expected, isAllowed) + t.Errorf("Test %d: expected %v found %v for %s", i+1, test.expected, isAllowed, test.name) } } } |