-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(http): add SizeLimitHandler to enforce request body size limit #6658
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
base: develop
Are you sure you want to change the base?
Changes from all commits
50496d5
736f2ed
b2ade66
c41d30e
321e26a
e6b11a3
674e547
3048750
5e35c4c
aa34bfc
c64d3b2
5e3eed0
de76e5f
5ebac52
6f0a0f0
64ad6df
7df020e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -471,8 +471,30 @@ public static void applyConfigParams( | |
| ? config.getLong(ConfigKey.NODE_RPC_MAX_CONNECTION_AGE_IN_MILLIS) | ||
| : Long.MAX_VALUE; | ||
|
|
||
| PARAMETER.maxMessageSize = config.hasPath(ConfigKey.NODE_RPC_MAX_MESSAGE_SIZE) | ||
| ? config.getInt(ConfigKey.NODE_RPC_MAX_MESSAGE_SIZE) : GrpcUtil.DEFAULT_MAX_MESSAGE_SIZE; | ||
| long rpcMaxMessageSize = config.hasPath(ConfigKey.NODE_RPC_MAX_MESSAGE_SIZE) | ||
|
bladehan1 marked this conversation as resolved.
|
||
| ? config.getMemorySize(ConfigKey.NODE_RPC_MAX_MESSAGE_SIZE).toBytes() | ||
| : GrpcUtil.DEFAULT_MAX_MESSAGE_SIZE; | ||
| if (rpcMaxMessageSize < 0 || rpcMaxMessageSize > Integer.MAX_VALUE) { | ||
| throw new TronError("node.rpc.maxMessageSize must be non-negative and <= " | ||
| + Integer.MAX_VALUE + ", got: " + rpcMaxMessageSize, PARAMETER_INIT); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don’t think we should change this to |
||
| PARAMETER.maxMessageSize = (int) rpcMaxMessageSize; | ||
|
|
||
| long defaultMaxMessageSize = GrpcUtil.DEFAULT_MAX_MESSAGE_SIZE; | ||
| PARAMETER.httpMaxMessageSize = config.hasPath(ConfigKey.NODE_HTTP_MAX_MESSAGE_SIZE) | ||
| ? config.getMemorySize(ConfigKey.NODE_HTTP_MAX_MESSAGE_SIZE).toBytes() | ||
| : defaultMaxMessageSize; | ||
| if (PARAMETER.httpMaxMessageSize < 0) { | ||
| throw new TronError("node.http.maxMessageSize must be non-negative, got: " | ||
| + PARAMETER.httpMaxMessageSize, PARAMETER_INIT); | ||
| } | ||
| PARAMETER.jsonRpcMaxMessageSize = config.hasPath(ConfigKey.NODE_JSONRPC_MAX_MESSAGE_SIZE) | ||
| ? config.getMemorySize(ConfigKey.NODE_JSONRPC_MAX_MESSAGE_SIZE).toBytes() | ||
| : defaultMaxMessageSize; | ||
| if (PARAMETER.jsonRpcMaxMessageSize < 0) { | ||
| throw new TronError("node.jsonrpc.maxMessageSize must be non-negative, got: " | ||
| + PARAMETER.jsonRpcMaxMessageSize, PARAMETER_INIT); | ||
| } | ||
|
|
||
| PARAMETER.maxHeaderListSize = config.hasPath(ConfigKey.NODE_RPC_MAX_HEADER_LIST_SIZE) | ||
| ? config.getInt(ConfigKey.NODE_RPC_MAX_HEADER_LIST_SIZE) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.