jhthorsen / app-proxyforurl Goto Github PK
View Code? Open in Web Editor NEWAn online PAC file parser
An online PAC file parser
The test with invalid hostnames in t/api.t fails on some of my smoker systems, probably due to presence of wildcard DNS records. Details about the problem may be found here: tokuhirom/Furl#128
The problem can be reproduced on Linux systems by setting LOCALDOMAIN to a domain which has wildcard DNS records, e.g. bing.com:
$ LOCALDOMAIN=bing.com perl5.36.0 -Mblib t/api.t
...
ok 7 - POST /v1/gethostbyname
not ok 8 - 400 Bad Request
# Failed test '400 Bad Request'
# at t/api.t line 15.
# got: '200'
# expected: '400'
not ok 9 - exact match for content
# Failed test 'exact match for content'
# at t/api.t line 15.
# got: '13.107.22.200'
# expected: 'No IP found for asdasdasdasdsdasd.com'
ok 10 - POST /v1/gethostbyname
...
A possible fix is to add a trailing dot to all invalid hostnames to treat it as a "final" hostname.
On most of my smoker systems the test suite fails like this:
# Failed test '400 Bad Request'
# at t/gethostbyname.t line 12.
# got: '200'
# expected: '400'
# Looks like you failed 1 test of 9.
t/gethostbyname.t ..
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/9 subtests
This happens also on other smoker systems, e.g. http://www.cpantesters.org/cpan/report/3cc706bc-0c4e-11ec-bc66-57723b537541
I don't know if the running sample of proxyforurl at http://home.thorsen.pm/proxyforurl is running the newest code or not, but I seem to have discovered a bug, and I thought you might want to know about it. I discovered today that for the dnsDomainIs function it doesn't process dots (".") in hostnames as actual dots, but rather it processes them as wildcards. For example:
dnsDomainIs(host, ".cisco.com")
This matches correctly on any subdomain of cisco.com (such as "www.cisco.com"). However, proxyforurl (or at least the version currently in use for the "online proxy PAC file tester" site mentioned above) also matches www.static-cisco.com against it (which is also called by the browser when a user visits www.cisco.com). In other words, the "." in the comparison seems to be treated as a wildcard, such as it is used in regex, thus it matches against "-" when it should not.
I don't know if the same issue applies to any other function besides dnsDomainIs, but I wanted to pass it along.
Thanks for all the effort that you have put into this, by the way!
Warm regards,
/r/Chad
(deathbywedgie)
Hello Jan,
first i´d like to thank you for your tester and also for the informations provided on your website.
I came about an issue. Using this rule as a test:
function FindProxyForURL(url, host) {
// If the hostname matches, send direct.
if (dnsDomainIs(host, "test.com")) return "DIRECT";
return "proxy"}
Now:
If i insert any leading chars to the domain i still get direct although the hostname doesn´t match anymore.
Which in my understanding shouldn´t be the case. Since i just started looking into that pac file thing i might be wrong but i guess its a bug. Maybe its a result of the last fixed "dot" issue?
Best regards,
Bender
The test suite started to fail:
# Failed test '200 OK'
# at t/app.t line 13.
# got: '404'
# expected: '200'
# Failed test 'content is similar'
# at t/app.t line 32.
# '<!DOCTYPE html>
# <!-- Request ID: qxWiziBcghUk -->
# <html>
# <head>
# <title>Page Not Found (development mode)</title>
# <meta http-equiv="Pragma" content="no-cache">
...
# </footer>
# </body>
# </html>
# '
# doesn't match '(?^u:'weekdayRange')'
# Looks like you failed 27 tests of 39.
t/app.t ............
Dubious, test returned 27 (wstat 6912, 0x1b00)
Failed 27/39 subtests
This looks like another Mojolicious 9.11+ victim:
****************************************************************
Regression 'mod:Mojolicious'
****************************************************************
Name Theta StdErr T-stat
[0='const'] 1.0000 0.0000 16461282459461206.00
[1='eq_7.57'] 0.0000 0.0000 0.91
[2='eq_7.62'] 0.0000 0.0000 0.00
[3='eq_7.64'] 0.0000 0.0000 1.94
[4='eq_7.65'] 0.0000 0.0000 0.87
[5='eq_7.67'] 0.0000 0.0000 1.44
[6='eq_7.68'] 0.0000 0.0000 2.12
[7='eq_7.70'] 0.0000 0.0000 6.15
[8='eq_7.71'] 0.0000 0.0000 1.49
[9='eq_7.75'] 0.0000 0.0000 0.00
[10='eq_7.81'] -0.0000 0.0000 -2.31
[11='eq_7.83'] -0.0000 0.0000 -1.83
[12='eq_7.84'] -0.0000 0.0000 -0.65
[13='eq_7.85'] 0.0000 0.0000 0.00
[14='eq_8.0'] 0.0000 0.0000 0.46
[15='eq_8.05'] 0.0000 0.0000 0.00
[16='eq_8.07'] -0.0000 0.0000 -1.73
[17='eq_8.09'] -0.0000 0.0000 -3.47
[18='eq_8.12'] -0.0000 0.0000 -2.58
[19='eq_8.13'] 0.0000 0.0000 1.37
[20='eq_8.14'] 0.0000 0.0000 0.00
[21='eq_8.15'] 0.0000 0.0000 0.00
[22='eq_8.16'] -0.0000 0.0000 -5.48
[23='eq_8.26'] -0.0000 0.0000 -7.31
[24='eq_8.36'] -0.0000 0.0000 -2.74
[25='eq_8.40'] -0.0000 0.0000 -0.91
[26='eq_8.43'] -0.0000 0.0000 -3.66
[27='eq_8.50'] 0.0000 0.0000 0.91
[28='eq_9.0'] -0.0000 0.0000 -1.83
[29='eq_9.02'] -0.0000 0.0000 -0.91
[30='eq_9.03'] -0.0000 0.0000 -5.17
[31='eq_9.11'] -1.0000 0.0000 -12443559899692606.00
[32='eq_9.12'] -1.0000 0.0000 -10411029155855174.00
[33='eq_9.13'] -1.0000 0.0000 -15297805225814636.00
R^2= 1.000, N= 133, K= 34
****************************************************************
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.