-- Wait for the result of the query
-- Note: We can't do non-blocking write to stream directly from resolve callbacks
-- because they don't run inside cqueue.
- local answers, authority = {}, {}
local cond = condition.new()
local waiting, done = false, false
- local finish_cb = function (answer, req)
+ local finish_cb = function (answer, _)
output_ttl = get_http_ttl(answer)
-- binary output
output = ffi.string(answer.wire, answer.size)
local ffi = require('ffi')
local function gen_huge_answer(_, req)
- local qry = req:current()
local answer = req.answer
ffi.C.kr_pkt_make_auth_header(answer)
req.headers:upsert(':method', 'POST')
req:set_body(basexx.from_base64( -- srcaddr.test.knot-resolver.cz TXT
'QNQBAAABAAAAAAAAB3NyY2FkZHIEdGVzdA1rbm90LXJlc29sdmVyAmN6AAAQAAE'))
- local headers, pkt = check_ok(req, desc)
+ local _, pkt = check_ok(req, desc)
same(pkt:rcode(), kres.rcode.REFUSED, desc .. ': view module caught it')
modules.unload('view')
-- RFC 8484 section 6 explicitly allows huge answers over HTTP
local function test_huge_answer()
- local triggered = false
policy.add(policy.suffix(gen_huge_answer, policy.todnames({'huge.test'})))
local desc = 'POST query for a huge answer'
local req = req_templ:clone()
req.headers:upsert(':method', 'POST')
req:set_body(basexx.from_base64( -- huge.test. URI, no EDNS
'HHwBAAABAAAAAAAABGh1Z2UEdGVzdAABAAAB'))
- local headers, pkt = check_ok(req, desc)
+ local _, pkt = check_ok(req, desc)
same(pkt:rcode(), kres.rcode.NOERROR, desc .. ': rcode NOERROR')
same(pkt:tc(), false, desc .. ': no TC bit')
same(pkt:ancount(), 2, desc .. ': ANSWER contains both RRs')