From c0f1f407630de0c6d318d2831f4db9349d4673c2 Mon Sep 17 00:00:00 2001 From: Martijn van der Ven Date: Fri, 4 May 2018 18:17:15 +0200 Subject: [PATCH] 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. --- src/p3k/HTTP/Curl.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/p3k/HTTP/Curl.php b/src/p3k/HTTP/Curl.php index 328397d..a21892d 100644 --- a/src/p3k/HTTP/Curl.php +++ b/src/p3k/HTTP/Curl.php @@ -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;