-
Notifications
You must be signed in to change notification settings - Fork 98
Limit request size #34
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
Conversation
handler.go
Outdated
| // Limit request size. Ideally this limit should be specific for each field | ||
| // in the JSON request but as simple defensive measure we just limit the | ||
| // entire HTTP body. | ||
| MAX_REQUEST_SIZE := 10 << 10 // FIXME: Agree on a value and extract. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some Worker calls to things which compute snarks send ~20-30MB, so I'd probably set this to 100M
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@magik6k are there any cases where 100MB+ would happen on requests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also fine with this being a configurable option (with a sane default like 100 MiB) for the consumer to adjust as necessary. Not sure what would be the most appropriate way to implement that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added it as a server configuration, will make Lotus consume it as a node options during dependency update.
|
Q: Why do we read it into a buffer instead of decoding it directly from the request reader? |
To be able to tell if the client sent more than the limit and report it back as an explicit error instead of just silently truncating it with the limited reader and report a parsing error. Open to other alternatives on how to implement it, though, see the |
|
Ahh, ignore my question, we were using raw decoder previously. |
No description provided.