diff options
author | Fedor Indutny <fedor@indutny.com> | 2014-03-28 00:09:20 +0400 |
---|---|---|
committer | Fedor Indutny <fedor@indutny.com> | 2014-04-24 10:40:35 +0400 |
commit | a60a9b0dbd064cd70de9400ad47421c19d29b021 (patch) | |
tree | 2b40c7250395e6cdeec2ff474cffdec738ff4f46 /src | |
parent | 3950024c2f54514916cb6e9fd5aec280a8823d3c (diff) | |
download | android-node-v8-a60a9b0dbd064cd70de9400ad47421c19d29b021.tar.gz android-node-v8-a60a9b0dbd064cd70de9400ad47421c19d29b021.tar.bz2 android-node-v8-a60a9b0dbd064cd70de9400ad47421c19d29b021.zip |
deps: provide TXT chunk info in c-ares
Provide more information in `ares_txt_reply` to coalesce chunks from the
same record into one string.
fix #7367
Diffstat (limited to 'src')
-rw-r--r-- | src/cares_wrap.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index a7bfeda0fd..0f5987b01a 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -576,12 +576,23 @@ class QueryTxtWrap: public QueryWrap { } Local<Array> txt_records = Array::New(env()->isolate()); + Local<Array> txt_chunk; ares_txt_reply* current = txt_out; - for (uint32_t i = 0; current != NULL; ++i, current = current->next) { + uint32_t i = 0; + for (uint32_t j = 0; current != NULL; current = current->next) { Local<String> txt = OneByteString(env()->isolate(), current->txt); - txt_records->Set(i, txt); + // New record found - write out the current chunk + if (current->record_start) { + if (!txt_chunk.IsEmpty()) + txt_records->Set(i++, txt_chunk); + txt_chunk = Array::New(env()->isolate()); + j = 0; + } + txt_chunk->Set(j++, txt); } + // Push last chunk + txt_records->Set(i, txt_chunk); ares_free_data(txt_out); |