Skip to content

Fix encoding stream size #61

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

Merged
merged 1 commit into from
Dec 22, 2016

Conversation

ajgarlag
Copy link
Contributor

@ajgarlag ajgarlag commented Oct 20, 2016

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Related tickets fixes #60
License MIT

What's in this PR?

This PR includes the tests required to expose the problem described in #60 about the invalid getSize returned value by FilteredStream subclasses, and should include a fix.

Why?

#60 Invalid value returned by FilteredStream::getSize

Checklist

  • Updated CHANGELOG.md to describe BC breaks / deprecations | new feature | bugfix

To Do

  • Discuss and find a solution to fix the tests
  • Squash commits

@ajgarlag ajgarlag changed the title Test encoding stream size Fix encoding stream size Oct 20, 2016
@ajgarlag
Copy link
Contributor Author

A quick fix could be to implement a getSize method in FilteredStream to always return null (allowed by PSR-7 when the size is unknown) and rewrite the tests to expect that null value.

@joelwurtz
Copy link
Member

AFAIK, result size on the compression cannot be determined, but they may be headers for the decompression (not sure).

So 👍 for the null value as i don't see a way to do this unless we read up the whole stream ^^ which will make it non readable as we cannot seek a filtered stream (don't remember where is see this but using \php_user_filter make a stream not seekable)

@ajgarlag ajgarlag force-pushed the fix-encoding-stream-size branch 2 times, most recently from ae2fc2d to 07d7dd2 Compare October 20, 2016 15:44
@dbu
Copy link
Contributor

dbu commented Oct 24, 2016

that looks at least not wrong to me. i am 👍 to merge this. for future reference, can we do better than this for some of the stream types?

@joelwurtz
Copy link
Member

LGTM,

Could you rebase with the last PR merged (to remove conflict in the changelog), then it's fine for me

@ajgarlag ajgarlag force-pushed the fix-encoding-stream-size branch from 07d7dd2 to 71e1e0f Compare October 24, 2016 15:39
@sagikazarmark
Copy link
Member

Sorry for the late response. Thanks.

@sagikazarmark sagikazarmark merged commit f28c46e into php-http:master Dec 22, 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.

Invalid value returned by GzipEncodeStream::getSize
4 participants