nginx-0.0.3-2004-03-23-09:01:52 import
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index e3c8598..f3f47f8 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -537,6 +537,25 @@
         r->connection->tcp_nopush = -1;
     }
 
+
+    ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+                   "http cl: " SIZE_T_FMT " max: " SIZE_T_FMT,
+                   r->headers_in.content_length_n,
+                   clcf->client_max_body_size);
+
+    if (r->headers_in.content_length_n != -1
+        && clcf->client_max_body_size
+        && clcf->client_max_body_size < (size_t) r->headers_in.content_length_n)
+    {
+        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+                      "client intented to send too large body: "
+                      SIZE_T_FMT " bytes",
+                      r->headers_in.content_length_n);
+
+        return NGX_HTTP_REQUEST_ENTITY_TOO_LARGE;
+    }
+
+
     if (auto_redirect) {
         if (!(r->headers_out.location =
                    ngx_http_add_header(&r->headers_out, ngx_http_headers_out)))