mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 08:12:05 +00:00
Bug 1792541 - Make the ODoH request fail when ODoHConfig is not available, r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D158385
This commit is contained in:
parent
0291a0ab80
commit
a161c08379
@ -26,9 +26,15 @@ ODoH::Run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!gODoHService->ODoHConfigs()) {
|
if (!gODoHService->ODoHConfigs()) {
|
||||||
LOG(("ODoH::Run ODoHConfigs is not available\n"));
|
LOG((
|
||||||
if (NS_SUCCEEDED(gODoHService->UpdateODoHConfig())) {
|
"ODoH::Run ODoHConfigs is not available mTriedDownloadODoHConfigs=%d\n",
|
||||||
|
mTriedDownloadODoHConfigs));
|
||||||
|
// Make this lookup fail if we don't have a valid ODoHConfig and we already
|
||||||
|
// tried before.
|
||||||
|
if (NS_SUCCEEDED(gODoHService->UpdateODoHConfig()) &&
|
||||||
|
!mTriedDownloadODoHConfigs) {
|
||||||
gODoHService->AppendPendingODoHRequest(this);
|
gODoHService->AppendPendingODoHRequest(this);
|
||||||
|
mTriedDownloadODoHConfigs = true;
|
||||||
} else {
|
} else {
|
||||||
RecordReason(TRRSkippedReason::ODOH_UPDATE_KEY_FAILED);
|
RecordReason(TRRSkippedReason::ODOH_UPDATE_KEY_FAILED);
|
||||||
FailData(NS_ERROR_FAILURE);
|
FailData(NS_ERROR_FAILURE);
|
||||||
|
@ -50,6 +50,8 @@ class ODoH final : public TRR {
|
|||||||
virtual void HandleTimeout() override;
|
virtual void HandleTimeout() override;
|
||||||
virtual void HandleEncodeError(nsresult aStatusCode) override;
|
virtual void HandleEncodeError(nsresult aStatusCode) override;
|
||||||
virtual void HandleDecodeError(nsresult aStatusCode) override;
|
virtual void HandleDecodeError(nsresult aStatusCode) override;
|
||||||
|
|
||||||
|
bool mTriedDownloadODoHConfigs = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace net
|
} // namespace net
|
||||||
|
@ -267,3 +267,29 @@ add_task(test_ipv4_trr_fallback);
|
|||||||
add_task(test_no_retry_without_doh);
|
add_task(test_no_retry_without_doh);
|
||||||
|
|
||||||
add_task(test_connection_reuse_and_cycling).skip(); // Bug 1742743
|
add_task(test_connection_reuse_and_cycling).skip(); // Bug 1742743
|
||||||
|
|
||||||
|
add_task(async function testODoHConfigNotAvailableInMode3() {
|
||||||
|
dns.clearCache(true);
|
||||||
|
Services.prefs.setIntPref("network.trr.mode", 3);
|
||||||
|
Services.prefs.setCharPref("network.trr.uri", "");
|
||||||
|
|
||||||
|
await ODoHConfigTestHTTP("https://failed_odoh_config.com", false);
|
||||||
|
|
||||||
|
// In mode 3, the DNS lookup should fail.
|
||||||
|
let { inStatus } = await new TRRDNSListener("test.example.com", {
|
||||||
|
expectedSuccess: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
Assert.equal(inStatus, Cr.NS_ERROR_UNKNOWN_HOST);
|
||||||
|
});
|
||||||
|
|
||||||
|
add_task(async function testODoHConfigNotAvailableInMode2() {
|
||||||
|
dns.clearCache(true);
|
||||||
|
Services.prefs.setIntPref("network.trr.mode", 2);
|
||||||
|
Services.prefs.setCharPref("network.trr.uri", "");
|
||||||
|
|
||||||
|
await ODoHConfigTestHTTP("https://failed_odoh_config_1.com", false);
|
||||||
|
|
||||||
|
// In mode 2, we fallback to native.
|
||||||
|
await new TRRDNSListener("test.example.com", "127.0.0.1");
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user