411 Length Required error

Igor Sysoev is at rambler-co.ru
Tue Dec 2 12:24:56 MSK 2008


On Mon, Dec 01, 2008 at 05:08:50PM -0800, Mark Moseley wrote:

> On Mon, Dec 1, 2008 at 6:38 AM, Igor Sysoev <is at rambler-co.ru> wrote:
> 
> > It seems that Apache allowed always such requests (POSTs without
> > Content-Length). I'm not sure should I add this ?
> 
> I can vouch that we've been bitten by that before with AJAX, during
> switchovers from straight Apache to nginx reverse proxying for Apache.
> We've got a much bigger switchover in the works and I've though about
> removing NGX_HTTP_POST from src/http/ngx_http_request.c (line 1414 in
> 0.7.22, so it'd just apply to PUT). Having a switch to turn off the No
> Content Length check for POSTs would be most excellent.

I thought about the same, here is patch.


-- 
Igor Sysoev
http://sysoev.ru/en/
-------------- next part --------------
Index: src/http/ngx_http_request.c
===================================================================
--- src/http/ngx_http_request.c	(revision 1681)
+++ src/http/ngx_http_request.c	(working copy)
@@ -1411,9 +1411,7 @@
         }
     }
 
-    if (r->method & (NGX_HTTP_POST|NGX_HTTP_PUT)
-        && r->headers_in.content_length_n == -1)
-    {
+    if (r->method & NGX_HTTP_PUT && r->headers_in.content_length_n == -1) {
         ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
                   "client sent %V method without \"Content-Length\" header",
                   &r->method_name);


More information about the nginx mailing list