#include "net/test/test_doh_server.h"
#include <string.h>
#include <memory>
#include <string_view>
#include "base/base64url.h"
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/synchronization/lock.h"
#include "base/time/time.h"
#include "net/base/io_buffer.h"
#include "net/base/url_util.h"
#include "net/dns/dns_names_util.h"
#include "net/dns/dns_query.h"
#include "net/dns/dns_response.h"
#include "net/dns/dns_test_util.h"
#include "net/dns/public/dns_protocol.h"
#include "net/http/http_status_code.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "url/gurl.h"
namespace net {
namespace {
const char kPath[] = …;
std::unique_ptr<test_server::HttpResponse> MakeHttpErrorResponse(
HttpStatusCode status,
std::string_view error) { … }
std::unique_ptr<test_server::HttpResponse> MakeHttpResponseFromDns(
const DnsResponse& dns_response) { … }
}
TestDohServer::TestDohServer() { … }
TestDohServer::~TestDohServer() = default;
void TestDohServer::SetHostname(std::string_view name) { … }
void TestDohServer::SetFailRequests(bool fail_requests) { … }
void TestDohServer::AddAddressRecord(std::string_view name,
const IPAddress& address,
base::TimeDelta ttl) { … }
void TestDohServer::AddRecord(const DnsResourceRecord& record) { … }
bool TestDohServer::Start() { … }
bool TestDohServer::InitializeAndListen() { … }
void TestDohServer::StartAcceptingConnections() { … }
bool TestDohServer::ShutdownAndWaitUntilComplete() { … }
std::string TestDohServer::GetTemplate() { … }
std::string TestDohServer::GetPostOnlyTemplate() { … }
int TestDohServer::QueriesServed() { … }
int TestDohServer::QueriesServedForSubdomains(std::string_view domain) { … }
std::unique_ptr<test_server::HttpResponse> TestDohServer::HandleRequest(
const test_server::HttpRequest& request) { … }
}