From b0db67d4d4a66690ebf5a35ba4adcd2c92e453e2 Mon Sep 17 00:00:00 2001 From: "roberto@natty32" Date: Tue, 5 Apr 2011 16:51:40 +0200 Subject: [PATCH] refactored post limit management --- plugins/python/wsgi_handlers.c | 8 -------- protocol.c | 7 +++++++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/plugins/python/wsgi_handlers.c b/plugins/python/wsgi_handlers.c index 8dae5f29cc..7f3501fb64 100644 --- a/plugins/python/wsgi_handlers.c +++ b/plugins/python/wsgi_handlers.c @@ -266,14 +266,6 @@ int uwsgi_request_wsgi(struct wsgi_request *wsgi_req) { } - if (uwsgi.limit_post) { - if (wsgi_req->post_cl > uwsgi.limit_post) { - uwsgi_log("Invalid (too big) CONTENT_LENGTH. skip.\n"); - return -1; - } - } - - if (!up.ignore_script_name) { if (!wsgi_req->script_name) diff --git a/protocol.c b/protocol.c index 9b891df6f1..7ee7894f74 100644 --- a/protocol.c +++ b/protocol.c @@ -675,6 +675,13 @@ int uwsgi_parse_vars(struct wsgi_request *wsgi_req) { } else if (!uwsgi_strncmp("CONTENT_LENGTH", 14, wsgi_req->hvec[wsgi_req->var_cnt].iov_base, wsgi_req->hvec[wsgi_req->var_cnt].iov_len)) { wsgi_req->post_cl = get_content_length(ptrbuf, strsize); + if (uwsgi.limit_post) { + if (wsgi_req->post_cl > uwsgi.limit_post) { + uwsgi_log("Invalid (too big) CONTENT_LENGTH. skip.\n"); + return -1; + } + } + } if (wsgi_req->var_cnt < uwsgi.vec_size - (4 + 1)) {