From 1a9d432f0c89d8d9f230e0a644383e87e2e0b3e4 Mon Sep 17 00:00:00 2001 From: Telford-Rowley Date: Thu, 7 Nov 2013 11:56:51 +0300 Subject: [PATCH] Http Response Headers Processing bug fix Header was not exploded correctly after multiple redirects. [0] => Server: nginx/1.0.15 [1] => Date: Thu, 07 Nov 2013 08:52:25 GMT [2] => Content-Type: text/html [3] => Content-Length: 185 [4] => Connection: keep-alive [5] => Location: http://* [6] => [7] => HTTP/1.1 200 OK [8] => Server: nginx/1.0.15 [9] => Content-Type: text/html ...... Should be: [0] => Server: nginx/1.0.15 [1] => Content-Type: text/html [2] => Transfer-Encoding: chunked [3] => Connection: keep-alive [4] => Vary: Accept-Encoding ..... --- drivers/php/Wappalyzer.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/php/Wappalyzer.php b/drivers/php/Wappalyzer.php index b2fe9f24d..922476018 100644 --- a/drivers/php/Wappalyzer.php +++ b/drivers/php/Wappalyzer.php @@ -129,8 +129,10 @@ class Wappalyzer $result->html = substr($response, $headerSize); $result->html = mb_check_encoding($result->html, 'UTF-8') ? $result->html : utf8_encode($result->html); - - $lines = array_slice(explode("\r\n", trim(substr($response, 0, $headerSize))), 1); + + $headers = trim(substr($response, 0, $headerSize)); + $headers = end(preg_split('/^\s*$/m', $headers)); + $lines = array_slice(explode("\r\n", $headers), 1); foreach ( $lines as $line ) { if ( strpos(trim($line), ': ') !== false ) {