mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-01 18:23:16 +08:00
Bypass proxy on loopback IPs
This commit is contained in:
@@ -25,6 +25,11 @@ export function checkBypass(reqUrl: URL): boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
const reqHost = reqUrl.hostname
|
||||
if (isLoopbackAddress(reqHost)) {
|
||||
return true
|
||||
}
|
||||
|
||||
const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''
|
||||
if (!noProxy) {
|
||||
return false
|
||||
@@ -66,3 +71,8 @@ export function checkBypass(reqUrl: URL): boolean {
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
function isLoopbackAddress(host: string): boolean {
|
||||
const hostUpper = host.toUpperCase()
|
||||
return hostUpper === 'LOCALHOST' || hostUpper.startsWith('127.') || hostUpper.startsWith('::1')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user