Skip to content
Snippets Groups Projects
Verified Commit 91d35164 authored by Petr Špaček's avatar Petr Špaček
Browse files

doh: remove devel output

parent d74eb7d1
Branches
Tags
1 merge request!799DNS-over-HTTP support (server side)
......@@ -14,46 +14,12 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "contrib/cleanup.h"
#include "daemon/bindings/impl.h"
#include "daemon/worker.h"
static void stackDump (lua_State *L) {
int i;
int top = lua_gettop(L);
for (i = 1; i <= top; i++) { /* repeat for each level */
int t = lua_type(L, i);
printf("%d ", i); /* put a separator */
switch (t) {
case LUA_TSTRING: /* strings */
printf("`%s'", lua_tostring(L, i));
break;
case LUA_TBOOLEAN: /* booleans */
printf(lua_toboolean(L, i) ? "true" : "false");
break;
case LUA_TNUMBER: /* numbers */
printf("%g", lua_tonumber(L, i));
break;
default: /* other values */
printf("%s", lua_typename(L, t));
break;
}
printf(" "); /* put a separator */
}
printf("\n"); /* end the listing */
}
static int wrk_resolve_pkt(lua_State *L)
{
stackDump(L);
struct worker_ctx *worker = wrk_luaget(L);
if (!worker) {
return 0;
......@@ -65,9 +31,6 @@ static int wrk_resolve_pkt(lua_State *L)
if (!pkt)
lua_error_maybe(L, ENOMEM);
auto_free char *debug = kr_pkt_text(pkt);
printf("%s\n", debug);
/* Create task and start with a first question */
struct qr_task *task = worker_resolve_start(worker, pkt, options);
......
......@@ -64,8 +64,6 @@ local function serve_doh(h, stream)
local cond = condition.new()
local waiting, done = false, false
local finish_cb = function (answer, req)
print(tostring(answer)) -- FIXME
output_ttl = get_http_ttl(answer)
-- binary output
output = ffi.string(answer.wire, answer.size)
......@@ -86,7 +84,6 @@ local function serve_doh(h, stream)
if result ~= 0 then
return 400, 'unparseable DNS message'
end
print(pkt)
-- set source address so filters can work
local function init_cb(req)
......@@ -94,13 +91,11 @@ local function serve_doh(h, stream)
req.qsource.dst_addr = convert_sockaddr(stream:localname())
req.qsource.flags.tcp = true
req.qsource.flags.tls = (stream.connection:checktls() ~= nil)
print(req.qsource.flags.tls)
req.qsource.flags.http = true
end
-- resolve query
worker.resolve_pkt(pkt, finish_cb, init_cb)
-- Wait for asynchronous query and free callbacks -- FIXME
if not done then
waiting = true
cond:wait()
......
......@@ -45,7 +45,6 @@ function parse_pkt(input, desc)
local result = ffi.C.knot_pkt_parse(pkt, 0)
ok(result == 0, desc .. ': knot_pkt_parse works on received answer')
print(pkt)
return pkt
end
......@@ -199,8 +198,6 @@ else
local exp_dstaddr = ffi.gc(ffi.C.kr_straddr_socket(host, port), ffi.C.free)
local function check_dstaddr(state, req)
triggered = true
print(exp_dstaddr)
print(req.qsource.dst_addr)
same(ffi.C.kr_sockaddr_cmp(req.qsource.dst_addr, exp_dstaddr), 0,
'request has correct server address')
return state
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment