From 93b84a4d99df609853a10ab43e792bac988c2dfe Mon Sep 17 00:00:00 2001 From: energy0922 <39765648+energy0922@users.noreply.github.com> Date: Wed, 30 May 2018 19:38:46 +0800 Subject: [PATCH 1/2] Update Request.php --- src/Httpful/Request.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Httpful/Request.php b/src/Httpful/Request.php index 563728c..3973d62 100644 --- a/src/Httpful/Request.php +++ b/src/Httpful/Request.php @@ -1054,7 +1054,9 @@ public function buildResponse($result) { } $response = explode("\r\n\r\n", $result, 2 + $info['redirect_count']); - + if (count($response) < 2) { + $response = explode("\n\n", $result, 2 + $info['redirect_count']); + } $body = array_pop($response); $headers = array_pop($response); From a727a24be5df407b7667309fb72c1a02b26e0905 Mon Sep 17 00:00:00 2001 From: energy0922 <39765648+energy0922@users.noreply.github.com> Date: Wed, 30 May 2018 19:58:34 +0800 Subject: [PATCH 2/2] Update Request.php --- src/Httpful/Request.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Httpful/Request.php b/src/Httpful/Request.php index 3973d62..984e784 100644 --- a/src/Httpful/Request.php +++ b/src/Httpful/Request.php @@ -1053,10 +1053,12 @@ public function buildResponse($result) { $result = preg_replace($proxy_regex, '', $result); } - $response = explode("\r\n\r\n", $result, 2 + $info['redirect_count']); - if (count($response) < 2) { - $response = explode("\n\n", $result, 2 + $info['redirect_count']); + $line_feed = "\r\n\r\n"; + if (strpos($result, $line_feed) === false) { + $line_feed = "\n\n"; } + $response = explode($line_feed, $result, 2 + $info['redirect_count']); + $body = array_pop($response); $headers = array_pop($response);