Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BinaryFileResponse - hashing strategy #6101

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

Closed
Dynom opened this issue Nov 23, 2012 · 0 comments
Closed

BinaryFileResponse - hashing strategy #6101

Dynom opened this issue Nov 23, 2012 · 0 comments
Labels
Good first issue Ideal for your first contribution! (some Symfony experience may be required) HttpFoundation

Comments

@Dynom
Copy link

Dynom commented Nov 23, 2012

Currently the hashing system in the new BinaryFileResponse has known limitations. It will be greatly beneficial if these are addressed by offering means to overcome these.

7322696#commitcomment-2193066

An option is to simplify the logic for hashing, by separating the hashing from the setting of the entity tag and from the file-input. This can be done simply by putting sha1_file() in a different method, that can be easily overridden, or by allowing a more OO approach by injecting the hashing strategy. The latter might be a bit more bulky but allows the most flexibility while maintaining clean separation of concerns.

fabpot added a commit that referenced this issue Feb 11, 2013
This PR was submitted for the master branch but it was merged into the 2.2 branch instead (closes #6708).

Commits
-------

90a3e7a [HttpFoundation] moved file hash calculation to own method

Discussion
----------

[HttpFoundation] moved file hash calculation to own method

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Todo: -
Fixes the following tickets: #6101
License of the code: MIT
Documentation PR: -

This commit adds ability to change default hashing implementation by extending BinaryFileResponse.

---------------------------------------------------------------------------

by stloyd at 2013-01-11T16:23:30Z

IMO it's looks a like overkill...

---------------------------------------------------------------------------

by lsmith77 at 2013-01-11T16:39:33Z

hmm yeah .. seems like something that could be done via inheritance ..

---------------------------------------------------------------------------

by Tobion at 2013-01-11T17:44:29Z

I agree, overriting the method is much simpler solution.

---------------------------------------------------------------------------

by jalliot at 2013-01-11T18:16:04Z

Besides the `$autoetag` variable is false by default so you have to explicitly enable this behavior...

---------------------------------------------------------------------------

by povilas at 2013-01-11T18:39:31Z

@lsmith77, @Tobion,  you mean, just move hash calculation to separate protected method, and when you want to change hashing you must extend BinaryFileResponse?
@fabpot fabpot closed this as completed Feb 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good first issue Ideal for your first contribution! (some Symfony experience may be required) HttpFoundation
Projects
None yet
Development

No branches or pull requests

2 participants