| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c13e5be commit 5b4fab1
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1265,14 +1265,16 @@ class QueryAnyWrap: public QueryWrap { | |||
| 1265 | 1265 | } | |
| 1266 | 1266 | ||
| 1267 | 1267 | CHECK_EQ(aaaa_count, naddr6ttls); | |
| 1268 | + CHECK_EQ(ret->Length(), a_count + aaaa_count); | ||
| 1268 | 1269 | for (uint32_t i = a_count; i < ret->Length(); i++) { | |
| 1269 | 1270 | Local<Object> obj = Object::New(env()->isolate()); | |
| 1270 | 1271 | obj->Set(context, | |
| 1271 | 1272 | env()->address_string(), | |
| 1272 | 1273 | ret->Get(context, i).ToLocalChecked()).FromJust(); | |
| 1273 | 1274 | obj->Set(context, | |
| 1274 | 1275 | env()->ttl_string(), | |
| 1275 | - Integer::New(env()->isolate(), addr6ttls[i].ttl)).FromJust(); | ||
| 1276 | + Integer::New(env()->isolate(), addr6ttls[i - a_count].ttl)) | ||
| 1277 | + .FromJust(); | ||
| 1276 | 1278 | obj->Set(context, | |
| 1277 | 1279 | env()->type_string(), | |
| 1278 | 1280 | env()->dns_aaaa_string()).FromJust(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,8 +53,13 @@ server.bind(0, common.mustCall(async () => { | |||
| 53 | 53 | })); | |
| 54 | 54 | ||
| 55 | 55 | function validateResults(res) { | |
| 56 | - // Compare copies with ttl removed, c-ares fiddles with that value. | ||
| 57 | - assert.deepStrictEqual( | ||
| 58 | - res.map((r) => Object.assign({}, r, { ttl: null })), | ||
| 59 | - answers.map((r) => Object.assign({}, r, { ttl: null }))); | ||
| 56 | + // TTL values are only provided for A and AAAA entries. | ||
| 57 | + assert.deepStrictEqual(res.map(maybeRedactTTL), answers.map(maybeRedactTTL)); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + function maybeRedactTTL(r) { | ||
| 61 | + const ret = { ...r }; | ||
| 62 | + if (!['A', 'AAAA'].includes(r.type)) | ||
| 63 | + delete ret.ttl; | ||
| 64 | + return ret; | ||
| 60 | 65 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments