get-proxy-settings
Advanced tools
Comparing version 0.1.8 to 0.1.9
export {}; |
@@ -0,0 +0,0 @@ "use strict"; |
export declare const defaults: { | ||
testUrl: string; | ||
}; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export * from "./defaults"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { ProxySetting } from "./proxy-settings"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export declare enum Protocol { |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -11,1 +11,2 @@ import { ProxyCredentials, ProxySettings } from "./proxy-settings"; | ||
export declare function getEnvProxy(): ProxySettings; | ||
export declare function parseWindowsProxySetting(proxySetting: string): ProxySettings; |
@@ -12,2 +12,3 @@ "use strict"; | ||
const npmConfLoader = require("npm-conf"); | ||
const url = require("url"); | ||
const proxy_errors_1 = require("./proxy-errors"); | ||
@@ -95,9 +96,41 @@ const proxy_settings_1 = require("./proxy-settings"); | ||
function parseWindowsProxySetting(proxySetting) { | ||
if (!proxySetting) { | ||
return null; | ||
} | ||
if (isValidUrl(proxySetting)) { | ||
const setting = new proxy_settings_1.ProxySetting(proxySetting); | ||
return { | ||
http: setting, | ||
https: setting, | ||
}; | ||
} | ||
const settings = proxySetting.split(";").map(x => x.split("=", 2)); | ||
const result = {}; | ||
for (const [key, value] of settings) { | ||
result[key] = new proxy_settings_1.ProxySetting(value); | ||
if (value) { | ||
result[key] = new proxy_settings_1.ProxySetting(value); | ||
} | ||
} | ||
return result; | ||
return processResults(result); | ||
} | ||
exports.parseWindowsProxySetting = parseWindowsProxySetting; | ||
function isValidUrl(value) { | ||
const obj = url.parse(value); | ||
return Boolean(obj.hostname); | ||
} | ||
function processResults(results) { | ||
const { http, https } = results; | ||
if (http && https) { | ||
return { http, https }; | ||
} | ||
else if (http) { | ||
return { http, https: http }; | ||
} | ||
else if (https) { | ||
return { http: https, https }; | ||
} | ||
else { | ||
return null; | ||
} | ||
} | ||
//# sourceMappingURL=proxy.js.map |
@@ -0,0 +0,0 @@ import { ProxySetting } from "./proxy-settings"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export declare enum Hive { |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "get-proxy-settings", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"description": "Retrieve proxy settings specified by the system", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -0,0 +0,0 @@ # System Proxy |
@@ -0,0 +0,0 @@ { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 6 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
39843
586
9