mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-18 01:03:14 +00:00
Updated proxy check, to look at /etc/profile.d/proxy_setup if it exists
This commit is contained in:
@@ -419,6 +419,8 @@ int MeshAgent_GetSystemProxy(MeshAgentHostContainer *agent, char *buffer, size_t
|
||||
})();";
|
||||
#else
|
||||
char getProxy[] = "(function getProxies(){\
|
||||
if(require('fs').existsSync('/etc/environment'))\
|
||||
{\
|
||||
var e = require('fs').readFileSync('/etc/environment').toString();\
|
||||
var tokens = e.split('\\n');\
|
||||
for(var line in tokens)\
|
||||
@@ -429,6 +431,16 @@ int MeshAgent_GetSystemProxy(MeshAgentHostContainer *agent, char *buffer, size_t
|
||||
return(val[1].split('//')[1]);\
|
||||
}\
|
||||
}\
|
||||
}\
|
||||
if(require('fs').existsSync('/etc/profile.d/proxy_setup'))\
|
||||
{\
|
||||
var child = require('child_process').execFile('/bin/sh', ['sh']);\
|
||||
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });\
|
||||
child.stdin.write('cat /etc/profile.d/proxy_setup | awk \\'{ split($2, tok, \"=\"); if(tok[1]==\"http_proxy\") { print tok[2]; }}\\'\\nexit\\n');\
|
||||
child.waitExit();\
|
||||
child.ret = child.stdout.str.trim().split('\\n')[0].split('//')[1];\
|
||||
if(child.ret != '') { return(child.ret); }\
|
||||
}\
|
||||
throw('No Proxy set');\
|
||||
})();";
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user