From 5f4cc3ad16baeba7414912b948e7783f176e0dd6 Mon Sep 17 00:00:00 2001 From: Sam Sullivan Date: Wed, 12 Jun 2013 10:53:41 -0500 Subject: [PATCH 1/3] added namespace to avoid class collision --- lib/Unirest/HttpMethod.php | 4 ++-- lib/Unirest/HttpResponse.php | 2 +- lib/Unirest/Unirest.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) 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 @@ - Date: Wed, 19 Jun 2013 15:26:14 -0500 Subject: [PATCH 2/3] fixed HttpResponse (issue #13) --- lib/Unirest/HttpResponse.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Unirest/HttpResponse.php b/lib/Unirest/HttpResponse.php index 6fff26d..c076b7c 100644 --- a/lib/Unirest/HttpResponse.php +++ b/lib/Unirest/HttpResponse.php @@ -62,13 +62,13 @@ class HttpResponse */ private function get_headers_from_curl_response($headers) { - foreach (explode("\r\n", $headers) as $i => $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; } } From 7d2d06a4d7df9a5202fc075cca8c52adc5ecd653 Mon Sep 17 00:00:00 2001 From: Sam Sullivan Date: Mon, 24 Jun 2013 17:28:46 -0500 Subject: [PATCH 3/3] remove namespace from Unirest.php --- lib/Unirest/Unirest.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Unirest/Unirest.php b/lib/Unirest/Unirest.php index 37a1bc4..4b952b2 100644 --- a/lib/Unirest/Unirest.php +++ b/lib/Unirest/Unirest.php @@ -1,4 +1,8 @@ -