Closed
Description
Q | A |
---|---|
Bug? | yes |
New Feature? | no |
Version | v1.4.0 |
Actual Behavior
An stream encoded with deflate
content-encoding cannot be read by InflateStream
, but with DecompressStream
.
Expected Behavior
The deflate
content-encoding should be managed by InflateStream
and DeflateStream
while
CompressStream
and DecompressStream
should handle compress
content-encoding.
Steps to Reproduce
<?php
require 'vendor/autoload.php';
$payload = file_get_contents('http://httpbin.org/deflate');
$innerStream1 = new spec\Http\Message\Encoding\MemoryStream($payload);
$inflateStream = new Http\Message\Encoding\InflateStream($innerStream1);
$inflatedContents = $inflateStream->getContents();
var_dump($inflatedContents !== ""); //Should be true
$innerStream2 = new spec\Http\Message\Encoding\MemoryStream($payload);
$decompressStream = new Http\Message\Encoding\DecompressStream($innerStream2);
$decompressedContents = $decompressStream->getContents();
var_dump($decompressedContents === ""); //Should be true
var_dump($inflatedContents);
var_dump($decompressedContents);
$realContents = $decompressedContents;
$innerStream3 = new spec\Http\Message\Encoding\MemoryStream($realContents);
$deflateStream = new Http\Message\Encoding\DeflateStream($innerStream3);
$deflatedContents = $deflateStream->getContents();
var_dump($deflatedContents === $payload); //Should be true
$innerStream4 = new spec\Http\Message\Encoding\MemoryStream($realContents);
$compressStream = new Http\Message\Encoding\CompressStream($innerStream4);
$compressedContents = $compressStream->getContents();
var_dump($compressedContents !== $payload); //Should be true
Possible Solutions
To avoid BC breaks, I think we should add a warning in the documentation and in the class docblocks
and rename them in 2.0.
I'm looking for and HTTP endpoint to test compress
content-encoding, but I have not found anyone.
Metadata
Metadata
Assignees
Labels
No labels