Browse Source

Merge pull request #649 from mexon/redirect_fix

Restore redirect functionality removed by change 452ff19d
pull/651/head
fermionic 8 years ago
parent
commit
1a49c841d8
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      include/network.php

+ 4
- 3
include/network.php 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"] != ""))
$newurl = $new_location_info["scheme"]."://".$new_location_info["host"].$old_location_info["path"];
//$matches = array();
//preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
//$newurl = trim(array_pop($matches));
$matches = array();
if (preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches)) {
$newurl = trim(array_pop($matches));
}
if(strpos($newurl,'/') === 0)
$newurl = $url . $newurl;
$url_parsed = @parse_url($newurl);


Loading…
Cancel
Save