Skip to content

Fix issue with rewound response bodies #1

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

Conversation

weierophinney
Copy link
Contributor

When middleware returns an HtmlResponse, the body stream is typically rewound, with the pointer at position 0. Unfortunately, this means that any write() operations will overwrite!

This patch does a check to see if the response is at eof(), and, if not and the response is seekable, sets the pointer to the end of the stream prior to writing.

When middleware returns an `HtmlResponse`, the body stream is typically
rewound, with the pointer at position 0. Unfortunately, this means that
any `write()` operations will *overwrite*!

This patch does a check to see if the response is at `eof()`, and, if
not and the response is seekable, sets the pointer to the end of the
stream prior to writing.
snapshotpl added a commit that referenced this pull request Jan 7, 2016
@snapshotpl snapshotpl merged commit 8fd4be3 into php-middleware:master Jan 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants