-
Notifications
You must be signed in to change notification settings - Fork 241
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
How to limit max size of the request body? #452
Comments
I think we can add an additional setting, e.g.
This is not the best option when handling larger requests, but it might be super useful to cover and protect those use cases when I know in advance that my server is working with small (or relatively small) payloads, e.g. RPC server or forms w/o file uploading functionality etc. This might be done by introducing Netty's |
This would be very nice to have. One of my projects is in a fairly early state of development, but this will be a necessary feature at some point; it's designed to be a standalone application, but exposed to a potentially-hostile network environment. Thank you for your work so far. It is appreciated very much. |
ring-clojure/ring#297 |
In my opinion, this is the easiest and more solid approach. |
Which is a typical safety requirement, something like
client_max_body_size
directive for Nginx.Netty's
HttpObjectAggregator
provides this functionality out of the box. The problem with introducing the same kind of settings for our handlers is that the error most probably will be detected after the user's handler was invoked (when reading:body
stream). Closing input stream from Aleph side would probably lead to unexpected behavior. Maybe we can provide some kind of a helper to "read body but not more than X bytes" that will throw an exception when the body is too large (it also would be nice to have the same helper to work correctly both withInputStream
and manifold's stream for raw handlers)?Another interesting question here: if I return
413 Entity Too Large
response from the handler, how can I force Aleph to close the connection after the response is sent? Regarding RFCs the client have to monitor server response even while transfering request body and have to stop sending it in case of the response arrived earlier. In practice, this is usually not handled well.. so mostly probably I would like to close the connection to make sure that if a client misbehaves - that is its problem, not mine.The text was updated successfully, but these errors were encountered: