mirror of https://github.com/gorhill/uBlock.git
Skip dns resolution when requests are proxied through http
Related issue: https://github.com/uBlockOrigin/uBlock-issues/discussions/3396 Reference: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/proxy/ProxyInfo#type_2
This commit is contained in:
parent
73ce4e6bcf
commit
4305bfbdb1
|
@ -36,6 +36,8 @@ const isPromise = o => o instanceof Promise;
|
||||||
const isResolvedObject = o => o instanceof Object &&
|
const isResolvedObject = o => o instanceof Object &&
|
||||||
o instanceof Promise === false;
|
o instanceof Promise === false;
|
||||||
const reIPv4 = /^\d+\.\d+\.\d+\.\d+$/
|
const reIPv4 = /^\d+\.\d+\.\d+\.\d+$/
|
||||||
|
const skipDNS = proxyInfo =>
|
||||||
|
proxyInfo?.proxyDNS || proxyInfo?.type?.startsWith('http');
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
@ -102,7 +104,7 @@ vAPI.Net = class extends vAPI.Net {
|
||||||
|
|
||||||
normalizeDetails(details) {
|
normalizeDetails(details) {
|
||||||
// https://github.com/uBlockOrigin/uBlock-issues/issues/3379
|
// 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;
|
details.ip = null;
|
||||||
}
|
}
|
||||||
const type = details.type;
|
const type = details.type;
|
||||||
|
@ -182,8 +184,8 @@ vAPI.Net = class extends vAPI.Net {
|
||||||
if ( isResolvedObject(dnsEntry) ) {
|
if ( isResolvedObject(dnsEntry) ) {
|
||||||
return this.onAfterDNSResolution(hn, details, dnsEntry);
|
return this.onAfterDNSResolution(hn, details, dnsEntry);
|
||||||
}
|
}
|
||||||
|
if ( skipDNS(details.proxyInfo) ) { return; }
|
||||||
if ( this.dnsShouldResolve(hn) === false ) { return; }
|
if ( this.dnsShouldResolve(hn) === false ) { return; }
|
||||||
if ( details.proxyInfo?.proxyDNS ) { return; }
|
|
||||||
const promise = dnsEntry || this.dnsResolve(hn, details);
|
const promise = dnsEntry || this.dnsResolve(hn, details);
|
||||||
return promise.then(( ) => this.onAfterDNSResolution(hn, details));
|
return promise.then(( ) => this.onAfterDNSResolution(hn, details));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue