Lines Matching defs:stream
14 * RingPHP client handler that uses PHP's HTTP stream wrapper.
34 $stream = $this->createStream($url, $request);
35 return $this->createResponse($request, $url, $stream);
41 private function createResponse(array $request, $url, $stream)
54 $stream = $this->checkDecode($request, $response, $stream);
56 // If not streaming, then drain the response into a stream.
57 if (empty($request['client']['stream'])) {
61 $stream = $this->drain($stream, $dest);
64 $response['body'] = $stream;
69 private function checkDecode(array $request, array $response, $stream)
76 $stream = new InflateStream(Stream::factory($stream));
81 return $stream;
85 * Drains the stream into the "save_to" client option.
87 * @param resource $stream
93 private function drain($stream, $dest)
95 if (is_resource($stream)) {
97 $stream = Stream::factory($stream);
99 stream_copy_to_stream($stream, $dest);
100 fclose($stream);
106 // Stream the response into the destination stream
111 Utils::copyToStream($stream, $dest);
113 $stream->close();
119 * Creates an error response for the given stream.
150 * @param callable $callback Callable that returns stream resource
190 // HTTP/1.1 streams using the PHP stream wrapper require a