Skip to content

Commit

Permalink
Skip dns resolution when requests are proxied through http
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Oct 2, 2024
1 parent 73ce4e6 commit 4305bfb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions platform/firefox/vapi-background-ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const isPromise = o => o instanceof Promise;
const isResolvedObject = o => o instanceof Object &&
o instanceof Promise === false;
const reIPv4 = /^\d+\.\d+\.\d+\.\d+$/
const skipDNS = proxyInfo =>
proxyInfo?.proxyDNS || proxyInfo?.type?.startsWith('http');

/******************************************************************************/

Expand Down Expand Up @@ -102,7 +104,7 @@ vAPI.Net = class extends vAPI.Net {

normalizeDetails(details) {
// https://github.com/uBlockOrigin/uBlock-issues/issues/3379
if ( details.proxyInfo?.proxyDNS && details.ip === '0.0.0.0' ) {
if ( skipDNS(details.proxyInfo) && details.ip === '0.0.0.0' ) {
details.ip = null;
}
const type = details.type;
Expand Down Expand Up @@ -182,8 +184,8 @@ vAPI.Net = class extends vAPI.Net {
if ( isResolvedObject(dnsEntry) ) {
return this.onAfterDNSResolution(hn, details, dnsEntry);
}
if ( skipDNS(details.proxyInfo) ) { return; }
if ( this.dnsShouldResolve(hn) === false ) { return; }
if ( details.proxyInfo?.proxyDNS ) { return; }
const promise = dnsEntry || this.dnsResolve(hn, details);
return promise.then(( ) => this.onAfterDNSResolution(hn, details));
}
Expand Down

0 comments on commit 4305bfb

Please sign in to comment.