mirror of
https://github.com/jorisvink/kore
synced 2025-03-09 12:39:01 -04:00
JSONRPC Removed upload size limit check
A true application dependant limit check would require stream parsing. As the limit enforcement was done, it added nothing of value compared to HTTP request limit check, which is in Kore already.
This commit is contained in:
parent
3366ec6573
commit
8c78b28be3
@ -52,7 +52,7 @@ v1(struct http_request *http_req)
|
||||
}
|
||||
|
||||
/* Read JSON-RPC request. */
|
||||
if ((ret = jsonrpc_request_read(http_req, 1000 * 64, &req)) != 0)
|
||||
if ((ret = jsonrpc_request_read(http_req, &req)) != 0)
|
||||
return jsonrpc_error(&req, ret, NULL);
|
||||
|
||||
/* Echo command takes and gives back params. */
|
||||
|
@ -74,8 +74,7 @@ enum jsonrpc_error_code
|
||||
};
|
||||
|
||||
void jsonrpc_log(struct jsonrpc_request *, int, const char *, ...);
|
||||
int jsonrpc_request_read(struct http_request *, ssize_t,
|
||||
struct jsonrpc_request *);
|
||||
int jsonrpc_request_read(struct http_request *, struct jsonrpc_request *);
|
||||
int jsonrpc_error(struct jsonrpc_request *, int, const char *);
|
||||
int jsonrpc_result(struct jsonrpc_request *,
|
||||
int (*)(struct jsonrpc_request *, void *), void *);
|
||||
|
@ -14,6 +14,7 @@
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <yajl/yajl_tree.h>
|
||||
@ -101,8 +102,7 @@ jsonrpc_log(struct jsonrpc_request *req, int lvl, const char *fmt, ...)
|
||||
}
|
||||
|
||||
static int
|
||||
read_json_body(struct http_request *http_req, ssize_t body_max_len,
|
||||
struct jsonrpc_request *req)
|
||||
read_json_body(struct http_request *http_req, struct jsonrpc_request *req)
|
||||
{
|
||||
char *body_string;
|
||||
u_int32_t body_start = req->buf.offset;
|
||||
@ -129,11 +129,6 @@ read_json_body(struct http_request *http_req, ssize_t body_max_len,
|
||||
}
|
||||
body_len += chunk_len;
|
||||
|
||||
if (body_len > body_max_len) {
|
||||
jsonrpc_log(req, LOG_ERR,
|
||||
"Request overreached configured body size limit");
|
||||
return (JSONRPC_LIMIT_REACHED);
|
||||
}
|
||||
kore_buf_append(&req->buf, chunk_buffer, chunk_len);
|
||||
}
|
||||
|
||||
@ -223,15 +218,14 @@ parse_json_body(struct jsonrpc_request *req)
|
||||
}
|
||||
|
||||
int
|
||||
jsonrpc_request_read(struct http_request *http_req, ssize_t max_body_len,
|
||||
struct jsonrpc_request *req)
|
||||
jsonrpc_request_read(struct http_request *http_req, struct jsonrpc_request *req)
|
||||
{
|
||||
int ret;
|
||||
|
||||
init_request(req);
|
||||
req->http = http_req;
|
||||
|
||||
if ((ret = read_json_body(http_req, max_body_len, req)) != 0)
|
||||
if ((ret = read_json_body(http_req, req)) != 0)
|
||||
return (ret);
|
||||
|
||||
return parse_json_body(req);
|
||||
|
Loading…
x
Reference in New Issue
Block a user