Closed Nek- closed 1 year ago
I found an issue in the CompressionMiddleware in the case of streaming a response with no content length.
The following line is filling the $bodyBuffer variable:
$bodyBuffer
https://github.com/amphp/http-server/blob/850f1b22ad0f3459c6ef6e89e897c8abf2b18b4c/src/Middleware/CompressionMiddleware.php#L141
While it's also done some lines after... Without cleaning the original var.
https://github.com/amphp/http-server/blob/850f1b22ad0f3459c6ef6e89e897c8abf2b18b4c/src/Middleware/CompressionMiddleware.php#L195-L197
I don't understand why it's done this way so I'm not sure I can provide a fix (something tells me it's not just stupid but has a purpose that I don't understand).
Does adding $promise = $body->read() on line 144 fix the issue?
$promise = $body->read()
It seems to work properly with this change, yes!
I found an issue in the CompressionMiddleware in the case of streaming a response with no content length.
The following line is filling the
$bodyBuffer
variable:https://github.com/amphp/http-server/blob/850f1b22ad0f3459c6ef6e89e897c8abf2b18b4c/src/Middleware/CompressionMiddleware.php#L141
While it's also done some lines after... Without cleaning the original var.
https://github.com/amphp/http-server/blob/850f1b22ad0f3459c6ef6e89e897c8abf2b18b4c/src/Middleware/CompressionMiddleware.php#L195-L197
I don't understand why it's done this way so I'm not sure I can provide a fix (something tells me it's not just stupid but has a purpose that I don't understand).