Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #2 SimpleStreamResponseSender::sendStream if content-length was provided #40

Open
wants to merge 1 commit into
base: backup-4.0.x-at-2022-02-24
Choose a base branch
from

Conversation

marc-mabe
Copy link
Contributor

@marc-mabe marc-mabe commented Jan 25, 2020

Q A
Documentation no
Bugfix yes
BC Break yes
New Feature no
RFC no
QA no

Description

see #2 and zendframework/zend-mvc#315

@Xerkus Xerkus self-assigned this Jan 26, 2020
@Xerkus Xerkus added BC Break Bug Something isn't working Won't Fix This will not be worked on labels Jan 26, 2020
@Xerkus
Copy link
Member

Xerkus commented Jan 26, 2020

This emitter is dangerously brittle. Result would be drastically different if say some listener read from the stream and/or did a rewind. Or if $request->getBody() was used.
Ideally this emitter should rewind stream if seekable and then output stream content. That won't match Laminas\Http\Response\Stream::readStream() behavior used to populate body on $request->getBody() call.

This change of behavior would not be backwards compatible and since existing behavior was around for years I am cautious of accepting this change.

I am going to label this bug as won't fix and ask you to provide feature request instead with new stream response sender.

@marc-mabe
Copy link
Contributor Author

Hi @Xerkus,

I do agree this is a breaking change but the problem that I'm facing is that currently it's simply not possible to respond a content range without copying this content range (using Range/Content-Range headers).

For my use-case of fetching big video files from S3 this is a no-go as either I have to copy the full range into memory or on disk ... in both cases I loose performance and get the risk of OOM/Disk-Space errors.

Ideally the user should should define the stream to be send - including the start position (e.g. by seeking to the exact position) and optionally defining the length but the MVC framework should no make any objections of what should be send.

@geerteltink geerteltink changed the base branch from master to 3.2.x September 12, 2020 09:04
@geerteltink geerteltink added this to the 3.2.0 milestone Sep 12, 2020
@geerteltink geerteltink changed the base branch from 3.2.x to 4.0.x September 12, 2020 09:04
@geerteltink geerteltink modified the milestones: 3.2.0, 4.0.0 Sep 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BC Break Bug Something isn't working Won't Fix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants