Fixed regex to prevent false negatives
Would fail if: - location wat written without capital letter. - the server redirected to www. - there was no / at the end of the url.pull/644/head
parent
cf6f30adfc
commit
ed61b3854f
|
@ -287,13 +287,15 @@ class StatusUpdater {
|
|||
// Check if the website redirects to another domain
|
||||
if ($this->server['redirect_check'] == 'bad'){
|
||||
$location_matches = array();
|
||||
preg_match('/(Location: )(https*:\/\/)([a-zA-Z.:0-9]*)([\/][[:alnum:][:punct:]]*)/', $curl_result, $location_matches);
|
||||
$ip_matches = array();
|
||||
preg_match('/(https*:\/\/)([a-zA-Z.:0-9]*)([\/][[:alnum:][:punct:]]*)/', $this->server['ip'], $ip_matches);
|
||||
if($location_matches[3] !== $ip_matches[2]){
|
||||
$this->error = "The IP/URL redirects to another domain.";
|
||||
$result = false;
|
||||
}
|
||||
preg_match('/([Ll]ocation: )(https*:\/\/)(www.)?([a-zA-Z.:0-9]*)([\/][[:alnum:][:punct:]]*)/', $curl_result, $location_matches);
|
||||
if(!empty($location_matches)) {
|
||||
$ip_matches = array();
|
||||
preg_match('/(https*:\/\/)(www.)?([a-zA-Z.:0-9]*)([\/][[:alnum:][:punct:]]*)?/', $this->server['ip'], $ip_matches);
|
||||
if (strtolower($location_matches[4]) !== strtolower($ip_matches[3])) {
|
||||
$this->error = "The IP/URL redirects to another domain.";
|
||||
$result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Should we check a header ?
|
||||
|
|
Loading…
Reference in New Issue