From 7451d92e2928df0d6053e647dd1465be69d244b9 Mon Sep 17 00:00:00 2001 From: Technosophos Date: Thu, 31 May 2012 10:27:39 -0500 Subject: [PATCH] Minor performance improvement to Response. Now that we have conditional handling of content(), I added a tweak to slightly improve CURL performance. --- src/HPCloud/Transport/Response.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/HPCloud/Transport/Response.php b/src/HPCloud/Transport/Response.php index 6713726..b2476e6 100644 --- a/src/HPCloud/Transport/Response.php +++ b/src/HPCloud/Transport/Response.php @@ -177,12 +177,13 @@ class Response { } } else { - while (!feof($this->handle)) { - $out .= fread($this->handle, 8192); - } + // XXX: This works fine with CURL, but will not + // work with PHP HTTP Stream Wrapper b/c the + // wrapper has a bug that will cause this to + // hang. + $out = stream_get_contents($this->handle); } - // Should we close or rewind? // Cannot rewind PHP HTTP streams. fclose($this->handle);