$a = get_app();
+ $parts = parse_url($url);
+ $path_parts = explode('/', $parts['path']);
+ foreach ($path_parts as $part) {
+ if (strlen($part) <> mb_strlen($part)) {
+ $parts2[] = rawurlencode($part);
+ } else {
+ $parts2[] = $part;
+ }
+ }
+ $parts['path'] = implode('/', $parts2);
+ $url = self::unparseURL($parts);
+
if (self::isUrlBlocked($url)) {
logger('domain of ' . $url . ' is blocked', LOGGER_DATA);
return $ret;
$newurl = $curl_info['redirect_url'];
- if (($new_location_info['path'] == '') && ( $new_location_info['host'] != '')) {
+ if (($new_location_info['path'] == '') && ($new_location_info['host'] != '')) {
$newurl = $new_location_info['scheme'] . '://' . $new_location_info['host'] . $old_location_info['path'];
}
if (strpos($newurl, '/') === 0) {
$newurl = $old_location_info["scheme"]."://".$old_location_info["host"].$newurl;
}
+ $old_location_query = @parse_url($url, PHP_URL_QUERY);
+
+ if ($old_location_query != '') {
+ $newurl .= '?' . $old_location_query;
+ }
if (filter_var($newurl, FILTER_VALIDATE_URL)) {
$redirects++;
if ($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307) {
$matches = [];
+ $new_location_info = @parse_url($curl_info['redirect_url']);
+ $old_location_info = @parse_url($curl_info['url']);
+
preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
$newurl = trim(array_pop($matches));
/// @TODO Really suppress function outcomes? Why not find them + debug them?
$h = @parse_url($url);
- if ((is_array($h)) && (@dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR) || filter_var($h['host'], FILTER_VALIDATE_IP) )) {
+ if ((is_array($h)) && (@dns_get_record($h['host'], DNS_A + DNS_CNAME) || filter_var($h['host'], FILTER_VALIDATE_IP) )) {
return $url;
}
$h = substr($addr, strpos($addr, '@') + 1);
- if (($h) && (dns_get_record($h, DNS_A + DNS_CNAME + DNS_PTR + DNS_MX) || filter_var($h, FILTER_VALIDATE_IP) )) {
+ if (($h) && (dns_get_record($h, DNS_A + DNS_CNAME + DNS_MX) || filter_var($h, FILTER_VALIDATE_IP) )) {
return true;
}
return false;