-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
It is not safe to read all stream body to memory without a max size limit. #1765
Comments
Users using body streaming on the server side should use |
If you want to add a read data size limit to the Body function, can you abandon the Body function and only support BodyStream? BodyStream can satisfy the caller's control of the read data size. |
@byte0o That would be a backward incompatible change, right? |
@gab Yes, you can first mark the Body function as deprecated |
@erikdubbelboer |
@dojutsu-user maybe you can have a look at changing it so that |
@erikdubbelboer We'll have to inject the Server.Logger instance in the request, right? |
Yeah but keep it private, we don't want to expose that. |
fasthttp/http.go
Line 427 in 57b9352
I think it would be safe to stop reading the request body into memory and return an error when it exceeds the maximum request body size. Otherwise, it may lead to an out-of-memory (OOM) error when the request body is too large.
The text was updated successfully, but these errors were encountered: