Browse Source

Different redirects array format

Taking the format that @aaronpk has used for aaronpk/IndieLogin.com.
Also make sure the redirect array gets cleared at the first request,
just in case the transport object is reused.
pull/2/head
Martijn van der Ven 3 years ago
parent
commit
c0f1f40763
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      src/p3k/HTTP/Curl.php

+ 7
- 1
src/p3k/HTTP/Curl.php View File

@ -104,7 +104,13 @@ class Curl implements Transport {
$current_url = curl_getinfo($curl, CURLINFO_EFFECTIVE_URL);
if ($current_url !== $this->_last_seen_url) {
if ($this->_last_seen_url !== null) {
$this->_current_redirects[] = [$this->_last_seen_code, $this->_last_seen_url];
$this->_current_redirects[] = [
'code' => $this->_last_seen_code,
'from' => $this->_last_seen_url,
'to' => $current_url,
];
} else {
$this->_current_redirects = [];
}
$this->_current_headers = [];
$this->_last_seen_url = $current_url;

Loading…
Cancel
Save