| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6f0458d commit 284a869
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,7 +28,6 @@ const { | |||
| 28 | 28 | } = primordials; | |
| 29 | 29 | ||
| 30 | 30 | const cares = internalBinding('cares_wrap'); | |
| 31 | - const { toASCII } = require('internal/idna'); | ||
| 32 | 31 | const { isIP } = require('internal/net'); | |
| 33 | 32 | const { customPromisifyArgs } = require('internal/util'); | |
| 34 | 33 | const errors = require('internal/errors'); | |
@@ -220,7 +219,7 @@ function lookup(hostname, options, callback) { | |||
| 220 | 219 | req.oncomplete = all ? onlookupall : onlookup; | |
| 221 | 220 | ||
| 222 | 221 | const err = cares.getaddrinfo( | |
| 223 | - req, toASCII(hostname), family, hints, verbatim, | ||
| 222 | + req, hostname, family, hints, verbatim, | ||
| 224 | 223 | ); | |
| 225 | 224 | if (err) { | |
| 226 | 225 | process.nextTick(callback, dnsException(err, 'getaddrinfo', hostname)); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,8 +7,6 @@ const { | |||
| 7 | 7 | Symbol, | |
| 8 | 8 | } = primordials; | |
| 9 | 9 | ||
| 10 | - const { toASCII } = require('internal/idna'); | ||
| 11 | - | ||
| 12 | 10 | const { | |
| 13 | 11 | codes: { | |
| 14 | 12 | ERR_INVALID_ARG_TYPE, | |
@@ -70,7 +68,7 @@ function resolver(bindingName) { | |||
| 70 | 68 | req.hostname = name; | |
| 71 | 69 | req.oncomplete = onresolve; | |
| 72 | 70 | req.ttl = !!(options && options.ttl); | |
| 73 | - const err = this._handle[bindingName](req, toASCII(name)); | ||
| 71 | + const err = this._handle[bindingName](req, name); | ||
| 74 | 72 | if (err) throw dnsException(err, bindingName, name); | |
| 75 | 73 | if (hasObserver('dns')) { | |
| 76 | 74 | startPerf(req, kPerfHooksDnsLookupResolveContext, { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -46,7 +46,6 @@ const { | |||
| 46 | 46 | CANCELLED, | |
| 47 | 47 | } = dnsErrorCodes; | |
| 48 | 48 | const { codes, dnsException } = require('internal/errors'); | |
| 49 | - const { toASCII } = require('internal/idna'); | ||
| 50 | 49 | const { isIP } = require('internal/net'); | |
| 51 | 50 | const { | |
| 52 | 51 | getaddrinfo, | |
@@ -138,7 +137,7 @@ function createLookupPromise(family, hostname, all, hints, verbatim) { | |||
| 138 | 137 | req.resolve = resolve; | |
| 139 | 138 | req.reject = reject; | |
| 140 | 139 | ||
| 141 | - const err = getaddrinfo(req, toASCII(hostname), family, hints, verbatim); | ||
| 140 | + const err = getaddrinfo(req, hostname, family, hints, verbatim); | ||
| 142 | 141 | ||
| 143 | 142 | if (err) { | |
| 144 | 143 | reject(dnsException(err, 'getaddrinfo', hostname)); | |
@@ -274,7 +273,7 @@ function createResolverPromise(resolver, bindingName, hostname, ttl) { | |||
| 274 | 273 | req.reject = reject; | |
| 275 | 274 | req.ttl = ttl; | |
| 276 | 275 | ||
| 277 | - const err = resolver._handle[bindingName](req, toASCII(hostname)); | ||
| 276 | + const err = resolver._handle[bindingName](req, hostname); | ||
| 278 | 277 | ||
| 279 | 278 | if (err) | |
| 280 | 279 | reject(dnsException(err, bindingName, hostname)); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,6 +20,7 @@ | |||
| 20 | 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 21 | 21 | ||
| 22 | 22 | #include "cares_wrap.h" | |
| 23 | + #include "ada.h" | ||
| 23 | 24 | #include "async_wrap-inl.h" | |
| 24 | 25 | #include "base64-inl.h" | |
| 25 | 26 | #include "base_object-inl.h" | |
@@ -1558,6 +1559,7 @@ void GetAddrInfo(const FunctionCallbackInfo<Value>& args) { | |||
| 1558 | 1559 | CHECK(args[4]->IsBoolean()); | |
| 1559 | 1560 | Local<Object> req_wrap_obj = args[0].As<Object>(); | |
| 1560 | 1561 | node::Utf8Value hostname(env->isolate(), args[1]); | |
| 1562 | + std::string ascii_hostname = ada::idna::to_ascii(hostname.ToStringView()); | ||
| 1561 | 1563 | ||
| 1562 | 1564 | int32_t flags = 0; | |
| 1563 | 1565 | if (args[3]->IsInt32()) { | |
@@ -1590,17 +1592,18 @@ void GetAddrInfo(const FunctionCallbackInfo<Value>& args) { | |||
| 1590 | 1592 | hints.ai_socktype = SOCK_STREAM; | |
| 1591 | 1593 | hints.ai_flags = flags; | |
| 1592 | 1594 | ||
| 1593 | - TRACE_EVENT_NESTABLE_ASYNC_BEGIN2( | ||
| 1594 | - TRACING_CATEGORY_NODE2(dns, native), "lookup", req_wrap.get(), | ||
| 1595 | - "hostname", TRACE_STR_COPY(*hostname), | ||
| 1596 | - "family", | ||
| 1597 | - family == AF_INET ? "ipv4" : family == AF_INET6 ? "ipv6" : "unspec"); | ||
| 1598 | - | ||
| 1599 | - int err = req_wrap->Dispatch(uv_getaddrinfo, | ||
| 1600 | - AfterGetAddrInfo, | ||
| 1601 | - *hostname, | ||
| 1602 | - nullptr, | ||
| 1603 | - &hints); | ||
| 1595 | + TRACE_EVENT_NESTABLE_ASYNC_BEGIN2(TRACING_CATEGORY_NODE2(dns, native), | ||
| 1596 | + "lookup", | ||
| 1597 | + req_wrap.get(), | ||
| 1598 | + "hostname", | ||
| 1599 | + TRACE_STR_COPY(ascii_hostname.data()), | ||
| 1600 | + "family", | ||
| 1601 | + family == AF_INET ? "ipv4" | ||
| 1602 | + : family == AF_INET6 ? "ipv6" | ||
| 1603 | + : "unspec"); | ||
| 1604 | + | ||
| 1605 | + int err = req_wrap->Dispatch( | ||
| 1606 | + uv_getaddrinfo, AfterGetAddrInfo, ascii_hostname.data(), nullptr, &hints); | ||
| 1604 | 1607 | if (err == 0) | |
| 1605 | 1608 | // Release ownership of the pointer allowing the ownership to be transferred | |
| 1606 | 1609 | USE(req_wrap.release()); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments