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

Keep request body in memory also after consuming request body #395

Merged
merged 2 commits into from
Sep 17, 2020

Conversation

clue
Copy link
Member

@clue clue commented Sep 16, 2020

The Server will always buffer the incoming request body (unless the StreamingRequestMiddleware is used). Previously, this buffer would be cleared when the request body has been parsed successfully. This means that the request body was only present for some requests.

This changeset ensures we keep the request body in memory also after consuming the request body. This means consumers can now always access the complete request body as detailed in the documentation. This allows building custom parsers and more advanced processing models without having to mess with the default parsers.

This shouldn't have a significant effect on memory consumption because the default buffer size is limited as per #371.

This also makes us less dependent on the underlying PSR-7 implementation which allows us to possibly change this in the future (#331).

Resolves #386, #387, #390 and others.

@WyriHaximus WyriHaximus merged commit 7b08b2c into reactphp:master Sep 17, 2020
@clue clue deleted the buffer-request branch September 17, 2020 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request body incorrectly parsed
4 participants