Skip to content
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

Fix header parsing for values that span more than one call to _on_header_value #277

Merged
merged 4 commits into from
Jun 1, 2020

Conversation

wch
Copy link
Collaborator

@wch wch commented Jun 1, 2020

This fixes #275.

cc @aronatkins

@wch wch requested a review from jcheng5 June 1, 2020 16:08
@wch wch force-pushed the wch-fix-header-parse branch 2 times, most recently from cf6b794 to 3ac139b Compare June 1, 2020 18:01
Copy link

@aronatkins aronatkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do fields need the same "append" treatment? It's possible to see multiple calls for both field names and values according to the table at https://github.com/nodejs/http-parser/blob/5b76466c6b9063e2c5982423962a16f7319c81f8/README.md#callbacks

@wch
Copy link
Collaborator Author

wch commented Jun 1, 2020

The fields already had the same append treatment -- the std::copy with the std::back_inserter appends incoming data to _lastHeaderField.

std::copy(pAt, pAt + length, std::back_inserter(_lastHeaderField));

(_lastHeaderField is now cleared when _last_header_state transitions to FIELD.)

I've also added a unit test for this.

@wch wch merged commit adebb3e into master Jun 1, 2020
@wch wch deleted the wch-fix-header-parse branch June 1, 2020 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Large request headers can be truncated
2 participants