Restore redirect functionality removed by change 452ff19d

This commit is contained in:
Matthew Exon 2013-03-14 13:50:45 +08:00
parent ce7217c8f6
commit c53bdfb163

View file

@ -88,9 +88,10 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_
if (($new_location_info["path"] == "") AND ($new_location_info["host"] != "")) if (($new_location_info["path"] == "") AND ($new_location_info["host"] != ""))
$newurl = $new_location_info["scheme"]."://".$new_location_info["host"].$old_location_info["path"]; $newurl = $new_location_info["scheme"]."://".$new_location_info["host"].$old_location_info["path"];
//$matches = array(); $matches = array();
//preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches); if (preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches)) {
//$newurl = trim(array_pop($matches)); $newurl = trim(array_pop($matches));
}
if(strpos($newurl,'/') === 0) if(strpos($newurl,'/') === 0)
$newurl = $url . $newurl; $newurl = $url . $newurl;
$url_parsed = @parse_url($newurl); $url_parsed = @parse_url($newurl);