Repository navigation
fix(urlencoded): emit fieldsLimit when the limit is hit inside a chunk - #242
Merged
Merged
Conversation
The fields limit was only reported at the start of the next write(), so a body that arrived in one chunk dropped the extra fields without ever emitting fieldsLimit. Emit it where the limit is reached when bytes remain in the chunk. Signed-off-by: Ismail Tarim <ismailtarim7@gmail.com>
Contributor
Author
|
@mcollina gentle ping on this one. It's a small follow-up in lib/types/urlencoded.js, next to the 3.2.6 size-limit fix: |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
limits: { fields: 1 }, the bodya=1&b=2&c=3gives onefieldevent foraand thenfinish;fieldsLimitnever fires. If the same body arrives asa=1&andb=2&c=3, it does, because the limit is only checked again at the start of the nextwrite(). Small form bodies often come in as a single chunk, so the event is missing in the common case, although the README says it is emitted when the limit is reached.fieldsLimitis now emitted where the limit is reached, as long as the chunk still has bytes after that point. A body that ends exactly at the limit (a=1&) still emits nothing, as it does today when it is split.The urlencoded test table now also counts
fieldsLimitevents, with new cases for a body split after the limit, one that ends at it, and a later write after the event.Checklist
npm run test && npm run benchmark --if-presentand the Code of conduct