kopia lustrzana https://github.com/friendica/friendica
Merge pull request #654 from mexon/filter_var
Use filter_var instead of parse_url to validate URLs, since the latter r...pull/656/head
commit
e7c705c9a1
|
@ -94,8 +94,7 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_
|
|||
}
|
||||
if(strpos($newurl,'/') === 0)
|
||||
$newurl = $url . $newurl;
|
||||
$url_parsed = @parse_url($newurl);
|
||||
if (isset($url_parsed)) {
|
||||
if (filter_var($newurl, FILTER_VALIDATE_URL)) {
|
||||
$redirects++;
|
||||
return fetch_url($newurl,$binary,$redirects,$timeout);
|
||||
}
|
||||
|
@ -189,8 +188,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0, $timeout = 0)
|
|||
$newurl = trim(array_pop($matches));
|
||||
if(strpos($newurl,'/') === 0)
|
||||
$newurl = $url . $newurl;
|
||||
$url_parsed = @parse_url($newurl);
|
||||
if (isset($url_parsed)) {
|
||||
if (filter_var($newurl, FILTER_VALIDATE_URL)) {
|
||||
$redirects++;
|
||||
return fetch_url($newurl,false,$redirects,$timeout);
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue