Fixed error that DNS server only return NXDOMAIN
This commit is contained in:
parent
00c2502001
commit
bbe9f9f05f
@ -58,7 +58,7 @@ void WebDNSHandler::handle_message(const std::shared_ptr<DNSServerBinding>& bind
|
||||
}
|
||||
}
|
||||
|
||||
if(parser.answers().empty())
|
||||
if(response.answer_count() == 0)
|
||||
response.header().set_response_code(rcode::NXDOMAIN);
|
||||
else
|
||||
response.header().set_response_code(rcode::NOERROR);
|
||||
|
@ -207,6 +207,9 @@ namespace ts::dns {
|
||||
return this->_answers[index];
|
||||
}
|
||||
|
||||
inline size_t answer_count() const { return this->_answers.size(); }
|
||||
inline size_t query_count() const { return this->_queries.size(); }
|
||||
|
||||
size_t build(char* /* buffer */, size_t /* max length */, std::string& /* error */);
|
||||
private:
|
||||
builder::DNSHeader _header{};
|
||||
|
Loading…
Reference in New Issue
Block a user