httpclient : if the redirect URL is not an absolute one, create the absolute one based on the previous request
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@4796 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -309,8 +309,17 @@ class Httpclient
|
|||||||
if ($this->redirectCount > $this->redirectMaxCount)
|
if ($this->redirectCount > $this->redirectMaxCount)
|
||||||
throw new \Exception ("Redirect exceed maximum limit", 406);
|
throw new \Exception ("Redirect exceed maximum limit", 406);
|
||||||
// echo "REDIRECT TO ".$this->headersReceived["Location"]."\n";
|
// echo "REDIRECT TO ".$this->headersReceived["Location"]."\n";
|
||||||
$content = $this->getPage ($this->headersReceived["Location"],
|
$location = $this->headersReceived["Location"];
|
||||||
$ssloptions);
|
$parseURLInit = parse_url ($url);
|
||||||
|
$parseURLLocation = parse_url ($location);
|
||||||
|
if (! key_exists ("port", $parseURLLocation) &&
|
||||||
|
key_exists ("port", $parseURLInit))
|
||||||
|
$location = ":".$parseURLInit["port"].$location;
|
||||||
|
if (! key_exists ("host", $parseURLLocation))
|
||||||
|
$location = $parseURLInit["host"].$location;
|
||||||
|
if (! key_exists ("scheme", $parseURLLocation))
|
||||||
|
$location = $parseURLInit["scheme"]."://".$location;
|
||||||
|
$content = $this->getPage ($location, $ssloptions);
|
||||||
}
|
}
|
||||||
$this->redirectCount = 0;
|
$this->redirectCount = 0;
|
||||||
return $content;
|
return $content;
|
||||||
|
|||||||
Reference in New Issue
Block a user