@@ -820,13 +820,14 @@ const BrowserProtection = function () {
820820 // Add the URL to the processing cache to prevent duplicate requests.
821821 BrowserProtection . cacheManager . addUrlToProcessingCache ( urlObject , "quad9" ) ;
822822
823- const filteringURL = `https://dns.quad9.net:5053/dns-query?name=${ encodeURIComponent ( urlHostname ) } ` ;
823+ const encodedQuery = encodeDnsQuery ( encodeURIComponent ( urlHostname ) ) ;
824+ const filteringURL = `https://dns.quad9.net/dns-query?dns=${ encodedQuery } ` ;
824825
825826 try {
826827 const filteringResponse = await fetch ( filteringURL , {
827828 method : "GET" ,
828829 headers : {
829- "Accept" : "application/dns-json "
830+ "Accept" : "application/dns-message "
830831 } ,
831832 signal
832833 } ) ;
@@ -846,7 +847,7 @@ const BrowserProtection = function () {
846847 return ;
847848 }
848849
849- const filteringData = await filteringResponse . json ( ) ;
850+ const filteringData = new Uint8Array ( await filteringResponse . arrayBuffer ( ) ) ;
850851 const nonFilteringData = await nonFilteringResponse . json ( ) ;
851852
852853 // If the non-filtering domain returns NOERROR...
@@ -855,7 +856,7 @@ const BrowserProtection = function () {
855856 && nonFilteringData . Answer . length > 0 ) {
856857
857858 // Quad9's way of blocking the domain.
858- if ( filteringData . Status === 3 ) {
859+ if ( filteringData [ 3 ] === 3 ) {
859860 callback ( new ProtectionResult ( url , ProtectionResult . ResultType . MALICIOUS , ProtectionResult . ResultOrigin . QUAD9 ) , ( new Date ( ) ) . getTime ( ) - startTime ) ;
860861 return ;
861862 }
0 commit comments