Skip to content

Never store ETags computed on partial data#28

Merged
kanongil merged 1 commit intohapijs:masterfrom
kanongil:partial-etag-fix
Jul 6, 2015
Merged

Never store ETags computed on partial data#28
kanongil merged 1 commit intohapijs:masterfrom
kanongil:partial-etag-fix

Conversation

@kanongil
Copy link
Copy Markdown
Contributor

@kanongil kanongil commented Jul 5, 2015

This fixes #27 by checking that all bytes have been processed before caching the ETag.

I have included two tests that would fail on the old code.

/cc @hueniverse for review.

@kanongil kanongil added the bug Bug or defect label Jul 5, 2015
@kanongil kanongil added this to the 2.1.6 milestone Jul 5, 2015
@hueniverse
Copy link
Copy Markdown
Contributor

Looks good. Is there a way to not even listen to responses when the status code indicates not to produce an etag?

@kanongil
Copy link
Copy Markdown
Contributor Author

kanongil commented Jul 6, 2015

I initially moved the actual generation logic to the marshal handler, which is never called on 304s.
However, I could not come up with a case that would not trigger the processed === size conditional. I could had kept this solution by removing this conditional. However, to keep it working, I would have to rely on undocumented internal hapi processing logic to not change, and I believe the coupling is to loose for that. It has already broken test logic in the 8.6.0 to 8.6.1 update.

@hueniverse
Copy link
Copy Markdown
Contributor

Makes sense.

kanongil added a commit that referenced this pull request Jul 6, 2015
Never store ETags computed on partial data
@kanongil kanongil merged commit d86ddc9 into hapijs:master Jul 6, 2015
@lock
Copy link
Copy Markdown

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Bug or defect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ETag generation can miss data

2 participants