diff --git a/lib/Unirest/HttpMethod.php b/lib/Unirest/HttpMethod.php index d2352d2..d6b9c99 100644 --- a/lib/Unirest/HttpMethod.php +++ b/lib/Unirest/HttpMethod.php @@ -1,4 +1,4 @@ - $line) { - if ($i !== 0) { - if (!empty($key) && substr($key, 0, 4) != "HTTP") { - $result[$key] = $value; - } else { - list ($key, $value) = explode(': ', $line); - } + $headers = explode("\r\n", $headers); + array_shift($headers); + + foreach ($headers as $line) { + if (strstr($line, ': ')) { + list ($key, $value) = explode(': ', $line); + $result[$key] = $value; } } diff --git a/lib/Unirest/Unirest.php b/lib/Unirest/Unirest.php index 5b12841..4b952b2 100644 --- a/lib/Unirest/Unirest.php +++ b/lib/Unirest/Unirest.php @@ -1,4 +1,8 @@