diff --git a/src/Client.php b/src/Client.php index 0d580a38cb..797dd1efab 100644 --- a/src/Client.php +++ b/src/Client.php @@ -582,6 +582,10 @@ public function setStream($streamfile = true) */ public function getStream() { + if (!is_null($this->streamName)) { + return $this->streamName; + } + return $this->config['outputstream']; } @@ -834,10 +838,6 @@ public function send(Request $request = null) if (!is_resource($stream) && is_string($stream)) { $stream = fopen($stream, 'r'); } - if (!is_resource($stream)) { - $stream = $this->getUri()->toString(); - $stream = fopen($stream, 'r'); - } $streamMetaData = stream_get_meta_data($stream); if ($streamMetaData['seekable']) { rewind($stream); diff --git a/src/Response.php b/src/Response.php index 539af7f7e2..0f6c8e3fed 100644 --- a/src/Response.php +++ b/src/Response.php @@ -10,6 +10,7 @@ namespace Zend\Http; +use Zend\Stdlib\ErrorHandler; use Zend\Stdlib\ResponseInterface; /** @@ -476,7 +477,17 @@ protected function decodeGzip($body) ); } - return gzinflate(substr($body, 10)); + ErrorHandler::start(); + $return = gzinflate(substr($body, 10)); + $test = ErrorHandler::stop(); + if ($test) { + throw new Exception\RuntimeException( + 'Error occurred during gzip inflation', + 0, + $test + ); + } + return $return; } /**