You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The text was updated successfully, but these errors were encountered:
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?
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.
The text was updated successfully, but these errors were encountered: