From 0a950c375251bf8af03645e4362ccdc0d37954ae Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Wed, 7 Jun 2023 19:31:22 -0400 Subject: [PATCH] src: add missing to_ascii method in dns queries PR-URL: https://github.com/nodejs/node/pull/48354 Reviewed-By: Yagiz Nizipli Reviewed-By: Darshan Sen Reviewed-By: Paolo Insogna --- src/cares_wrap.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index da546b15f264c2..96aee6df99850f 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -1414,9 +1414,11 @@ static void Query(const FunctionCallbackInfo& args) { Local string = args[1].As(); auto wrap = std::make_unique(channel, req_wrap_obj); - node::Utf8Value name(env->isolate(), string); + node::Utf8Value utf8name(env->isolate(), string); + auto plain_name = utf8name.ToStringView(); + std::string name = ada::idna::to_ascii(plain_name); channel->ModifyActivityQueryCount(1); - int err = wrap->Send(*name); + int err = wrap->Send(name.c_str()); if (err) { channel->ModifyActivityQueryCount(-1); } else {