-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: etag middleware corrupted binary stream responses
(see ringo/ringojs#439) to construct the etag md5 digest it copies the response body into an array of byte arrays/byte strings, but `Stream.forEach()` re-uses a single binary buffer [1], so if the streamed response exceeds 8192 bytes and thus be split up into multiple buffers the body created by etag middleware would essentially consist of different byte arrays all containing the same bytes. the fix is to use `Binary.prototype.slice()` to copy the body part - this is expensive and effectively thwarts the use of `response.stream()`, but it's what the etag middleware did before #409 too, and at least it doesn't corrupt binary responses anymore. [1] https://github.com/ringo/ringojs/blob/master/modules/io.js#L48
- Loading branch information
Showing
3 changed files
with
33 additions
and
4 deletions.
There are no files selected for viewing
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.