You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As such, it may make sense as a bridge package between Diactoros and zend-httphandlerrunner that provides the stream and the associated emitter. We would definitely promote it, and potentially offer to bring it into the zendframework organization if you wished.
HTTP/1.1 provides 'Transfer-encoding: chunked' for sending a stream of data from the server.
Zend Diactoros currently doesn't seem to provide out-of-the-box support for this.
Response
that sets the required headers for you.StreamInterface
that supports dynamic content and is compatible with the requirements ofSapiStreamEmitter
.Possible solution for out-of-the-box support could be:
DynamicStreamInterface
interface that extendsStreamInterface
, for type-hinting in a momentGeneratorStream
class that implementsDynamicStreamInterface
, and itsread()
method gets the required data from a PHP generatorDynamicStreamInterface
, and itsread()
method gets the required data from a PHP callbackStreamResponse
class that requires aDynamicStreamInterface
in the constructor, sets the necessary headers for chunked stream deliveryIt leaves questions around handling
$maxBufferLength
, and where the code goes to write the actual chunked blocks (trait? helper class?).I have to build a solution for this, and I'm happy to contribute it back to Diactoros, if we can agree a design :)
Originally posted by @stuartherbert at zendframework/zend-diactoros#261
The text was updated successfully, but these errors were encountered: