Remove leading www. for domain in the PAC file.

getzones.awk removed leading www since the beginning.
After commit 91b2584, which changed domain handling logic, this stopped working
correctly for domains beginning with www.

See https://ntc.party/t/pravda-com-ua/670
This commit is contained in:
ValdikSS 2020-09-05 12:08:24 +03:00
parent 3f068d7da7
commit 239081d581

View File

@ -70,6 +70,9 @@ echo " if (domains.length < 10) return \"DIRECT\"; // list is broken
else else
shost = host.replace(/(.+)\.([^.]+\.[^.]+$)/, \"\$2\"); shost = host.replace(/(.+)\.([^.]+\.[^.]+$)/, \"\$2\");
// remove leading www
shost = shost.replace(/^www\.(.+)/, \"\$1\");
var curdomain = shost.match(/(.*)\\.([^.]+\$)/); var curdomain = shost.match(/(.*)\\.([^.]+\$)/);
if (!curdomain || !curdomain[2]) {return \"DIRECT\";} if (!curdomain || !curdomain[2]) {return \"DIRECT\";}
var curhost = curdomain[1]; var curhost = curdomain[1];