Setting the authoritative answer header flag

This commit is contained in:
WolverinDEV 2020-09-22 13:46:08 +02:00
parent c11c87254c
commit 58c1ce1185
3 changed files with 11 additions and 7 deletions

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.15)
cmake_minimum_required(VERSION 3.13)
project(TeaWebDNS)
set(CMAKE_CXX_STANDARD 17)
@ -19,7 +19,7 @@ if (MSVC)
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
)
)
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()

View File

@ -96,4 +96,6 @@ int main(int argc, char** argv) {
logger::shutdown();
libevent_global_shutdown();
return 0;
}
}
//add-le-token dZS8bKQCTgQv62RE647sMlligbHhOGNTHyxNtYZkxtI

View File

@ -44,6 +44,7 @@ void WebDNSHandler::handle_message(const std::shared_ptr<DNSServerBinding>& bind
response.header().id(*(uint16_t*) buffer);
response.header().set_answer(true);
response.header().set_query_type(parser.header().query_type());
response.header().set_authoritative_answer(true);
for(auto& query : parser.queries()) {
auto& q = response.push_query();
@ -58,10 +59,11 @@ void WebDNSHandler::handle_message(const std::shared_ptr<DNSServerBinding>& bind
}
}
if(response.answer_count() == 0)
response.header().set_response_code(rcode::NXDOMAIN);
else
response.header().set_response_code(rcode::NOERROR);
if(response.answer_count() == 0) {
response.header().set_response_code(rcode::NXDOMAIN);
} else {
response.header().set_response_code(rcode::NOERROR);
}
char rbuffer[1024];
auto len = response.build(rbuffer, 1024, error);