Skip to content

Commit

Permalink
Merge pull request #1295 from oliamb/fix-issue-1294
Browse files Browse the repository at this point in the history
fix(proxy): no-proxy false positive
  • Loading branch information
nylen committed Nov 28, 2014
2 parents 9f402f8 + 9fa20d2 commit 8f2ded1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion request.js
Expand Up @@ -199,7 +199,8 @@ function getProxyFromURI(uri) {
}
} else {
noProxyItem = noProxyItem.replace(/^\.*/, '.')
if (hostname.indexOf(noProxyItem) === hostname.length - noProxyItem.length) {
var isMatchedAt = hostname.indexOf(noProxyItem)
if (isMatchedAt > -1 && isMatchedAt === hostname.length - noProxyItem.length) {
return null
}
}
Expand Down
7 changes: 7 additions & 0 deletions tests/test-proxy.js
Expand Up @@ -131,6 +131,13 @@ if (process.env.TEST_PROXY_HARNESS) {
env : { http_proxy : s.url }
}, true)

runTest('http_proxy with length of one more than the URL', {
env: {
HTTP_PROXY : s.url,
NO_PROXY: 'elgoog1.com' // one more char than google.com
}
}, true)

runTest('NO_PROXY hostnames are case insensitive', {
env : {
HTTP_PROXY : s.url,
Expand Down

0 comments on commit 8f2ded1

Please sign in to comment.