Don't unset the inflate resource on close as it might still be needed
This commit is contained in:
parent
1cef665f49
commit
8fa4f85013
@ -225,7 +225,6 @@ final class CurlResponse implements ResponseInterface
|
||||
*/
|
||||
private function close(): void
|
||||
{
|
||||
$this->inflate = null;
|
||||
unset($this->multi->openHandles[$this->id], $this->multi->handlesActivity[$this->id]);
|
||||
curl_setopt($this->handle, \CURLOPT_PRIVATE, '_0');
|
||||
|
||||
|
@ -193,7 +193,7 @@ final class NativeResponse implements ResponseInterface
|
||||
private function close(): void
|
||||
{
|
||||
unset($this->multi->openHandles[$this->id], $this->multi->handlesActivity[$this->id]);
|
||||
$this->handle = $this->buffer = $this->inflate = $this->onProgress = null;
|
||||
$this->handle = $this->buffer = $this->onProgress = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -63,6 +63,12 @@ switch ($vars['REQUEST_URI']) {
|
||||
header('Content-Type: application/json', true, 404);
|
||||
break;
|
||||
|
||||
case '/404-gzipped':
|
||||
header('Content-Type: text/plain', true, 404);
|
||||
ob_start('ob_gzhandler');
|
||||
echo 'some text';
|
||||
exit;
|
||||
|
||||
case '/301':
|
||||
if ('Basic Zm9vOmJhcg==' === $vars['HTTP_AUTHORIZATION']) {
|
||||
header('Location: http://127.0.0.1:8057/302', true, 301);
|
||||
|
@ -835,6 +835,18 @@ abstract class HttpClientTestCase extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetEncodedContentAfterDestruct()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
|
||||
try {
|
||||
$client->request('GET', 'http://localhost:8057/404-gzipped');
|
||||
$this->fail(ClientExceptionInterface::class.' expected');
|
||||
} catch (ClientExceptionInterface $e) {
|
||||
$this->assertSame('some text', $e->getResponse()->getContent(false));
|
||||
}
|
||||
}
|
||||
|
||||
public function testProxy()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
|
Reference in New Issue
Block a user