Merge branch 'kiryl-master'

This commit is contained in:
Florian Bruhin 2017-02-25 17:53:47 +01:00
commit 1bd9b4cd40
3 changed files with 15 additions and 6 deletions

View File

@ -226,6 +226,7 @@ Contributors, sorted by the number of commits in descending order:
* Lucas Hoffmann * Lucas Hoffmann
* Link * Link
* Larry Hynes * Larry Hynes
* Kirill A. Shutemov
* Johannes Altmanninger * Johannes Altmanninger
* Jeremy Kaplan * Jeremy Kaplan
* Ismail * Ismail
@ -265,7 +266,6 @@ Contributors, sorted by the number of commits in descending order:
* Matthias Lisin * Matthias Lisin
* Marcel Schilling * Marcel Schilling
* Lazlow Carmichael * Lazlow Carmichael
* Kirill A. Shutemov
* Kevin Wang * Kevin Wang
* Ján Kobezda * Ján Kobezda
* Johannes Martinsson * Johannes Martinsson

View File

@ -61,7 +61,7 @@ function convert_addr(ipchars) {
} }
function isInNet(ipaddr, pattern, maskstr) { function isInNet(ipaddr, pattern, maskstr) {
var test = /^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$/ var test = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
.exec(ipaddr); .exec(ipaddr);
if (test == null) { if (test == null) {
ipaddr = dnsResolve(ipaddr); ipaddr = dnsResolve(ipaddr);
@ -78,7 +78,7 @@ function isInNet(ipaddr, pattern, maskstr) {
} }
function isPlainHostName(host) { function isPlainHostName(host) {
return (host.search('\\\\.') == -1); return (host.search('\\.') == -1);
} }
function isResolvable(host) { function isResolvable(host) {
@ -92,9 +92,9 @@ function localHostOrDomainIs(host, hostdom) {
} }
function shExpMatch(url, pattern) { function shExpMatch(url, pattern) {
pattern = pattern.replace(/\\./g, '\\\\.'); pattern = pattern.replace(/\./g, '\\.');
pattern = pattern.replace(/\\*/g, '.*'); pattern = pattern.replace(/\*/g, '.*');
pattern = pattern.replace(/\\?/g, '.'); pattern = pattern.replace(/\?/g, '.');
var newRe = new RegExp('^'+pattern+'$'); var newRe = new RegExp('^'+pattern+'$');
return newRe.test(url); return newRe.test(url);
} }

View File

@ -109,6 +109,15 @@ def test_myIpAddress():
_pac_equality_test("isResolvable(myIpAddress())", "true") _pac_equality_test("isResolvable(myIpAddress())", "true")
@pytest.mark.parametrize("host, expected", [
("example", "true"),
("example.com", "false"),
("www.example.com", "false"),
])
def test_isPlainHostName(host, expected):
_pac_equality_test("isPlainHostName('{}')".format(host), expected)
def test_proxyBindings(): def test_proxyBindings():
_pac_equality_test("JSON.stringify(ProxyConfig.bindings)", "'{}'") _pac_equality_test("JSON.stringify(ProxyConfig.bindings)", "'{}'")