Knot Resolver 5.2.0 (2020-1m-dd)
================================
+Improvements
+------------
- net: split the EDNS buffer size into upstream and downstream (!1026)
+- lua-http doh: answer to /dns-query endpoint as well as /doh (!1069)
Knot Resolver 5.1.3 (2020-09-08)
if method == 'POST' then
input = stream:get_body_chars(1025, 2) -- read timeout = KR_CONN_RTT_MAX
elseif method == 'GET' then
- local input_b64 = string.match(h:get(':path'), '^/doh%?dns=([a-zA-Z0-9_-]+)$') or
- string.match(h:get(':path'), '^/doh%?dns=([a-zA-Z0-9_-]+)&') or
- string.match(h:get(':path'), '^/doh%?.*&dns=([a-zA-Z0-9_-]+)$') or
- string.match(h:get(':path'), '^/doh%?.*&dns=([a-zA-Z0-9_-]+)&')
+ local input_b64 = string.match(h:get(':path'), '^/[^?]*%?dns=([a-zA-Z0-9_-]+)$') or
+ string.match(h:get(':path'), '^/[^?]*%?dns=([a-zA-Z0-9_-]+)&') or
+ string.match(h:get(':path'), '^/[^?]*%?.*&dns=([a-zA-Z0-9_-]+)$') or
+ string.match(h:get(':path'), '^/[^?]*%?.*&dns=([a-zA-Z0-9_-]+)&')
if not input_b64 then
return 400, 'base64url query not found'
end
-- Export endpoints
return {
endpoints = {
- ['/doh'] = {'text/plain', serve_doh, nil, nil, true},
+ ['/doh'] = {'text/plain', serve_doh, nil, nil, true},
+ ['/dns-query'] = {'text/plain', serve_doh, nil, nil, true},
}
}
modules.unload('view')
end
+ local function test_dns_query_endpoint()
+ local desc = 'valid POST query which ends with SERVFAIL on /dns-query'
+ local request = require('http.request')
+ uri_templ = string.format('http://%s:%d/dns-query', host, port)
+ req = assert(request.new_from_uri(uri_templ))
+ req.headers:upsert('content-type', 'application/dns-message')
+ req.headers:upsert(':method', 'POST')
+ req:set_body(basexx.from_base64( -- servfail.test. A
+ 'FZUBAAABAAAAAAAACHNlcnZmYWlsBHRlc3QAAAEAAQ=='))
+ local headers, pkt = check_ok(req, desc)
+ if not (headers and pkt) then
+ return
+ end
+ -- uncacheable
+ same(headers:get('cache-control'), 'max-age=0', desc .. ': TTL 0')
+ same(pkt:rcode(), kres.rcode.SERVFAIL, desc .. ': rcode matches')
+ end
+
-- not implemented
-- local function test_post_unsupp_accept()
-- local req = assert(req_templ:clone())
test_get_invalid_chars,
test_unsupp_method,
test_dstaddr,
- test_srcaddr
+ test_srcaddr,
+ test_dns_query_endpoint,
}
return tests