Skip to content

Commit cb53a7b

Browse files
authored
Merge pull request #419 from 3scale/resolv-double-scope
[resty.resolver] fix double empty search scope
2 parents d19992a + 80561dc commit cb53a7b

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1515
- Crash on empty OIDC Issuer endpoint [PR #408](https://github.com/3scale/apicast/pull/408)
1616
- Handle partial credentials [PR #409](https://github.com/3scale/apicast/pull/409)
1717
- Crash when configuration endpoint was missing [PR #417](https://github.com/3scale/apicast/pull/417)
18+
- Fix double queries to not fully qualified domains [PR #419](https://github.com/3scale/apicast/pull/419)
1819

1920
### Changed
2021

apicast/src/resty/resolver.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function _M.parse_nameservers(path)
7272

7373
ngx.log(ngx.DEBUG, '/etc/resolv.conf:\n', resolv_conf)
7474

75-
local search = { '' }
75+
local search = { }
7676
local nameservers = { search = search }
7777
local resolver = getenv('RESOLVER')
7878
local domains = match(resolv_conf, 'search%s+([^\n]+)')

spec/resty/resolver_spec.lua

+9-2
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ describe('resty.resolver', function()
118118
end)
119119
end)
120120

121+
describe('.search', function()
122+
it('contains empty scope', function ()
123+
124+
assert.same({''}, resty_resolver.search)
125+
end)
126+
end)
127+
121128
describe('.parse_nameservers', function()
122129
local tmpname
123130

@@ -140,8 +147,8 @@ describe('resty.resolver', function()
140147
it('returns search domains', function()
141148
local search = resty_resolver.parse_nameservers(tmpname).search
142149

143-
assert.equal(3, #search)
144-
assert.same({ '', 'localdomain.example.com', 'local' }, search)
150+
assert.equal(2, #search)
151+
assert.same({ 'localdomain.example.com', 'local' }, search)
145152
end)
146153

147154
end)

0 commit comments

Comments
 (0)