No inform for resources from proxy hostname/ip, fixes #32

This commit is contained in:
Ilya Ig. Petrov 2018-05-15 21:56:06 +05:00
parent 1f31f2bce7
commit 3b03be61c5

View File

@ -142,6 +142,23 @@
if (!host) {
return;
}
{
/*
If we fetch a resource from a proxy address it is almost never proxied and
shouldn't be shown.
Think about localhost as a proxy and a user working with a web site on localhost.
*/
/*
Host is constructed from hostname and port. Hostname never contains port,
it is an ip or a domain name. See hostname and host
in `new URL('https://localhost:8080')`.
*/
const hostnameFromUrl = new URL(requestDetails.url).hostname;
const hostnameFromProxy = new URL(`https://${host}`).hostname;
if (hostnameFromUrl === requestDetails.ip || hostnameFromUrl === hostnameFromProxy) {
return;
}
}
const ifMainFrame = requestDetails.type === 'main_frame';