@@ -1338,8 +1338,8 @@ public static function getGuzzleClient(array $extra_options = []): Client
13381338 global $ CFG_GLPI ;
13391339
13401340 $ options = $ extra_options + ['connect_timeout ' => 5 ];
1341- // add proxy string if configured in glpi
1342- if (!empty ($ CFG_GLPI ["proxy_name " ])) {
1341+ // add proxy string if configured in glpi - and not excluded
1342+ if (!empty ($ CFG_GLPI ["proxy_name " ]) && ( $ extra_options [ ' proxy_excluded ' ] ?? false ) === false ) {
13431343 $ proxy_creds = "" ;
13441344 if (!empty ($ CFG_GLPI ["proxy_user " ])) {
13451345 $ proxy_user = rawurlencode ($ CFG_GLPI ["proxy_user " ]);
@@ -1379,7 +1379,7 @@ public static function callCurl(
13791379 $ PHPLOGGER ->error ($ e ->getMessage (), ['exception ' => $ e ]);
13801380
13811381 $ curl_error = $ e ->getMessage ();
1382- if (empty ($ CFG_GLPI ["proxy_name " ])) {
1382+ if (empty ($ CFG_GLPI ["proxy_name " ]) || ( $ eopts [ ' proxy_excluded ' ] ?? false ) ) {
13831383 $ msgerr = sprintf (
13841384 __ ('Connection failed. If you use a proxy, please configure it. (%s) ' ),
13851385 $ curl_error
@@ -1446,6 +1446,11 @@ private static function doCallCurl(
14461446 }
14471447
14481448 $ ch = curl_init ($ url );
1449+ $ proxy_excluded = false ;
1450+ if (isset ($ eopts ['proxy_excluded ' ])) {
1451+ $ proxy_excluded = (bool ) $ eopts ['proxy_excluded ' ];
1452+ unset($ eopts ['proxy_excluded ' ]);
1453+ }
14491454 $ opts = [
14501455 CURLOPT_URL => $ url ,
14511456 CURLOPT_USERAGENT => "GLPI/ " . trim ($ CFG_GLPI ["version " ]),
@@ -1457,7 +1462,7 @@ private static function doCallCurl(
14571462 $ opts [CURLOPT_FOLLOWLOCATION ] = false ;
14581463 }
14591464
1460- if (!empty ($ CFG_GLPI ["proxy_name " ])) {
1465+ if (!empty ($ CFG_GLPI ["proxy_name " ]) && ! $ proxy_excluded ) {
14611466 // Connection using proxy
14621467 $ opts += [
14631468 CURLOPT_PROXY => $ CFG_GLPI ['proxy_name ' ],
0 commit comments