Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. InflateStream.php

function InflateStream::__construct

Overrides StreamDecoratorTrait::__construct

File

vendor/guzzlehttp/psr7/src/InflateStream.php, line 27

Class

InflateStream
Uses PHP's zlib.inflate filter to inflate zlib (HTTP deflate, RFC1950) or gzipped (RFC1952) content.

Namespace

GuzzleHttp\Psr7

Code

public function __construct(StreamInterface $stream) {
    $resource = StreamWrapper::getResource($stream);
    // Specify window=15+32, so zlib will use header detection to both gzip (with header) and zlib data
    // See https://www.zlib.net/manual.html#Advanced definition of inflateInit2
    // "Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection"
    // Default window size is 15.
    stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ, [
        'window' => 15 + 32,
    ]);
    $this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource));
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal