Skip to content
Extraits de code Groupes Projets
Valider d9d226bb rédigé par cerdic's avatar cerdic
Parcourir les fichiers

Fix #4086 : detection des exceptions au proxy, prendre en compte les domaines...

Fix #4086 : detection des exceptions au proxy, prendre en compte les domaines parents ce qui permet de placer une exception sur une extension ou un domaine et qui s'appliquera a tous les sous, sous-sous, sous-sous-sous-domaines etc...
parent 17759d83
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -1236,16 +1236,37 @@ function need_proxy($host, $http_proxy = null, $http_noproxy = null) { ...@@ -1236,16 +1236,37 @@ function need_proxy($host, $http_proxy = null, $http_noproxy = null) {
if (is_null($http_proxy)) { if (is_null($http_proxy)) {
$http_proxy = isset($GLOBALS['meta']['http_proxy']) ? $GLOBALS['meta']['http_proxy'] : null; $http_proxy = isset($GLOBALS['meta']['http_proxy']) ? $GLOBALS['meta']['http_proxy'] : null;
} }
// rien a faire si pas de proxy :)
if (is_null($http_proxy) or !$http_proxy = trim($http_proxy)) {
return '';
}
if (is_null($http_noproxy)) { if (is_null($http_noproxy)) {
$http_noproxy = isset($GLOBALS['meta']['http_noproxy']) ? $GLOBALS['meta']['http_noproxy'] : null; $http_noproxy = isset($GLOBALS['meta']['http_noproxy']) ? $GLOBALS['meta']['http_noproxy'] : null;
} }
// si pas d'exception, on retourne le proxy
if (is_null($http_noproxy) or !$http_noproxy = trim($http_noproxy)) {
return $http_proxy;
}
// si le host ou l'un des domaines parents est dans $http_noproxy on fait exception
// $http_noproxy peut contenir plusieurs domaines separes par des espaces ou retour ligne
$http_noproxy = str_replace("\n", " ", $http_noproxy);
$http_noproxy = str_replace("\r", " ", $http_noproxy);
$http_noproxy = " $http_noproxy ";
$domain = $host;
do {
if (strpos($http_noproxy, " $domain ") !== false) {
return '';
}
$domain = substr($host, strpos($host, '.')); $domain = explode('.', $domain);
array_shift($domain);
$domain = implode('.', $domain);
} while (strpos($domain, '.') !== false);
return ($http_proxy // ok c'est pas une exception
and (strpos(" $http_noproxy ", " $host ") === false return $http_proxy;
and (strpos(" $http_noproxy ", " $domain ") === false)))
? $http_proxy : '';
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter