Commit 56e600fd authored by dalyk's avatar dalyk Committed by Commit Bot

Add new error code DNS_SECURE_RESOLVER_HOSTNAME_RESOLUTION_FAILED.

This error code will be used when a DoH server hostname cannot be
resolved due to a DNS issue.

Bug: 1016325
Change-Id: Icfe5ecd2d80c3182a540340adb7858b8a0c6f88a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1906904Reviewed-by: default avatarEric Orth <ericorth@chromium.org>
Commit-Queue: Katharine Daly <dalyk@google.com>
Cr-Commit-Position: refs/heads/master@{#714344}
parent d47d28aa
...@@ -965,5 +965,7 @@ NET_ERROR(DNS_SEARCH_EMPTY, -805) ...@@ -965,5 +965,7 @@ NET_ERROR(DNS_SEARCH_EMPTY, -805)
// Failed to sort addresses according to RFC3484. // Failed to sort addresses according to RFC3484.
NET_ERROR(DNS_SORT_ERROR, -806) NET_ERROR(DNS_SORT_ERROR, -806)
// Failed to resolve over HTTP, fallback to legacy // Error -807 was removed (DNS_HTTP_FAILED)
NET_ERROR(DNS_HTTP_FAILED, -807)
// Failed to resolve the hostname of a DNS-over-HTTPS server.
NET_ERROR(DNS_SECURE_RESOLVER_HOSTNAME_RESOLUTION_FAILED, -808)
...@@ -432,6 +432,10 @@ class DnsHTTPAttempt : public DnsAttempt, public URLRequest::Delegate { ...@@ -432,6 +432,10 @@ class DnsHTTPAttempt : public DnsAttempt, public URLRequest::Delegate {
DCHECK_NE(net::ERR_IO_PENDING, net_error); DCHECK_NE(net::ERR_IO_PENDING, net_error);
std::string content_type; std::string content_type;
if (net_error != OK) { if (net_error != OK) {
// Update the error code if there was an issue resolving the secure
// server hostname.
if (IsDnsError(net_error))
net_error = ERR_DNS_SECURE_RESOLVER_HOSTNAME_RESOLUTION_FAILED;
ResponseCompleted(net_error); ResponseCompleted(net_error);
return; return;
} }
......
...@@ -1464,6 +1464,27 @@ TEST_F(DnsTransactionTest, HttpsPostLookupAsync) { ...@@ -1464,6 +1464,27 @@ TEST_F(DnsTransactionTest, HttpsPostLookupAsync) {
EXPECT_TRUE(helper0.RunUntilDone(transaction_factory_.get())); EXPECT_TRUE(helper0.RunUntilDone(transaction_factory_.get()));
} }
URLRequestJob* DohJobMakerCallbackFailLookup(URLRequest* request,
NetworkDelegate* network_delegate,
SocketDataProvider* data) {
URLRequestMockDohJob::MatchQueryData(request, data);
return new URLRequestFailedJob(request, network_delegate,
URLRequestFailedJob::START,
ERR_NAME_NOT_RESOLVED);
}
TEST_F(DnsTransactionTest, HttpsPostLookupFailDohServerLookup) {
ConfigureDohServers(true /* use_post */);
AddQueryAndResponse(0, kT0HostName, kT0Qtype, kT0ResponseDatagram,
base::size(kT0ResponseDatagram), SYNCHRONOUS,
Transport::HTTPS, nullptr /* opt_rdata */,
DnsQuery::PaddingStrategy::BLOCK_LENGTH_128);
TransactionHelper helper0(kT0HostName, kT0Qtype, true /* secure */,
ERR_DNS_SECURE_RESOLVER_HOSTNAME_RESOLUTION_FAILED);
SetDohJobMakerCallback(base::BindRepeating(DohJobMakerCallbackFailLookup));
EXPECT_TRUE(helper0.RunUntilDone(transaction_factory_.get()));
}
URLRequestJob* DohJobMakerCallbackFailStart(URLRequest* request, URLRequestJob* DohJobMakerCallbackFailStart(URLRequest* request,
NetworkDelegate* network_delegate, NetworkDelegate* network_delegate,
SocketDataProvider* data) { SocketDataProvider* data) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment