This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 152
Fix incompatibilities between Unseekable streams and SapiStreamEmitter #200
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If a stream does not support seek, we have to rely on __toString() to access the stream's contents. If a stream cannot be rewound, it likely can't be incrementally read either. Refs zendframework#199
While it would be preferrable to seek around the stream, some streams cannot be looked at. In these cases the best effort we can have is to get the entire stream and slice out the requested byte range. Refs zendframework#199
Looks like your PHPCS checks are failing. Should I fix those up? |
@@ -72,10 +76,17 @@ private function emitBody(ResponseInterface $response, $maxBufferLength) | |||
*/ | |||
private function emitBodyRange(array $range, ResponseInterface $response, $maxBufferLength) | |||
{ | |||
list($unit, $first, $last, $lenght) = $range; | |||
list($unit, $first, $last, $length) = $range; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change already at #186
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I didn't see that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries; I merged in order, and since they were the exact same change, it presented no conflict during merge. 😄
@markstory I created PR #201 for the cs fix |
weierophinney
added a commit
that referenced
this pull request
Sep 7, 2016
Fix incompatibilities between Unseekable streams and SapiStreamEmitter
weierophinney
added a commit
that referenced
this pull request
Sep 7, 2016
Thanks for this, @markstory! |
Thanks for the quick merge @weierophinney 💃 |
weierophinney
added a commit
that referenced
this pull request
Sep 7, 2016
Order of operations was critical here; always check to see if the body is seekable before attempting to rewind it.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make
SapiStreamEmitter
work with streams that don't support seek operations. This allowsCallbackStream
responses to be combined withSapiStreamEmitter
.Refs #199