Another redirect test

This commit is contained in:
aymm 2021-03-11 16:27:25 +00:00
parent 9259094b9b
commit 30a3bbd4a7

View File

@ -229,12 +229,13 @@ class APnutI
throw new \Exception('SSL verification failed, connection terminated: ' . $url); throw new \Exception('SSL verification failed, connection terminated: ' . $url);
} }
} }
if ($http_status == 302) {
#echo json_encode(preg_match_all('/^Location:(.*)$/mi', $response, $matches));
throw new HttpPnutRedirectException($response);
}
if (!empty($response)) { if (!empty($response)) {
$response = $this->parseHeaders($response); $response = $this->parseHeaders($response);
if ($http_status == 302) {
#echo json_encode(preg_match_all('/^Location:(.*)$/mi', $response, $matches));
$this->logger->debug("302 Redirect to {$this->redirect_target}");
throw new HttpPnutRedirectException($this->redirect_targe);
}
if (!empty($response)) { if (!empty($response)) {
$response = json_decode($response, true); $response = json_decode($response, true);
if ($response === null && !empty($this->redirect_target)) { if ($response === null && !empty($this->redirect_target)) {