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)
|
||||
throw new \Exception ("Redirect exceed maximum limit", 406);
|
||||
// echo "REDIRECT TO ".$this->headersReceived["Location"]."\n";
|
||||
$content = $this->getPage ($this->headersReceived["Location"],
|
||||
$ssloptions);
|
||||
$location = $this->headersReceived["Location"];
|
||||
$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;
|
||||
return $content;
|
||||
|
||||
Reference in New Issue
Block a user