From 3c5d270e062addb214cf1e2ed5f394b15b327ed1 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Mon, 5 Jun 2023 11:57:27 -0400 Subject: [PATCH] src: add missing to_ascii method in dns queries --- src/cares_wrap.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index da546b15f264c2..fe70bd91a5234c 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -1411,12 +1411,13 @@ static void Query(const FunctionCallbackInfo& args) { CHECK(args[1]->IsString()); Local req_wrap_obj = args[0].As(); - Local string = args[1].As(); auto wrap = std::make_unique(channel, req_wrap_obj); - node::Utf8Value name(env->isolate(), string); + auto plain_name = + node::Utf8Value(env->isolate(), args[1].As()).ToStringView(); + std::string name = ada::idna::to_ascii(plain_name); channel->ModifyActivityQueryCount(1); - int err = wrap->Send(*name); + int err = wrap->Send(name.data()); if (err) { channel->ModifyActivityQueryCount(-1); } else {