1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:27:34 +00:00

LookupServer: Move case randomization into DNSName

* DNSName knows how to randomize itself
* DNSPacket no longer constructs DNSQuestion instances, it receives an already
  built DNSQuestion and just adds it to the list
* LookupServer::lookup() explicitly calls randomize_case() if it needs to
  randomize the case.
This commit is contained in:
Sergey Bugaev 2021-02-14 16:25:48 +03:00 committed by Andreas Kling
parent 89f718c4c5
commit bacbde31f3
5 changed files with 27 additions and 23 deletions

View file

@ -172,7 +172,10 @@ Vector<String> LookupServer::lookup(const DNSName& name, const String& nameserve
DNSPacket request;
request.set_is_query();
request.set_id(arc4random_uniform(UINT16_MAX));
request.add_question(name.as_string(), record_type, should_randomize_case);
DNSName name_in_question = name;
if (should_randomize_case == ShouldRandomizeCase::Yes)
name_in_question.randomize_case();
request.add_question({ name_in_question, record_type, C_IN });
auto buffer = request.to_byte_buffer();