carsonyl / pypac

Find and use proxy auto-config (PAC) files with Python and Requests.
https://pypac.readthedocs.io
Apache License 2.0
71 stars 18 forks source link

dnsDomainIs behavior #42

Closed nicolas-lopez closed 3 years ago

nicolas-lopez commented 5 years ago

Hello, after several testing I found that dnsDomainIs is not following the common behavior.

For now it works as follow: def dnsDomainIs(host, domain): if domain.startswith('.'): domain = '*' + domain return shExpMatch(host, domain)

Therefor it means that when you have case like this one: host = "subdomain.domain.com" domain = "domain.com" (note the missing '.' in front of the domain)

In this case def dnsDomainIs doesn't match. However when trying this case in multiple browser (chrome, firefox, ie) it does match.

It makes me think that it this would be a lot more accurate with this kind of implementation:

def dnsDomainIs(host, domain): return host.endswith(domain)

Let me know what you think about it. Best regards,