Can only upload one file with PHP; two results in 'Connection Interrupted'

Igor Sysoev is at rambler-co.ru
Thu Aug 2 20:12:19 MSD 2007


On Thu, Aug 02, 2007 at 04:09:02PM +0000, Rob wrote:

> Igor Sysoev <is at ...> writes:
> 
> > It seems like nginx bug.
> > Set "keepalive_timepout  0" for upload location as quick workaround.
> 
> That fixed it. Do you know what the bug is? Will it be fixed soon so that we can
> use keepalive in the future?

Try attached patch. It can be use against 0.5.30.


-- 
Igor Sysoev
http://sysoev.ru/en/
-------------- next part --------------
Index: src/http/ngx_http_request.c
===================================================================
--- src/http/ngx_http_request.c	(revision 686)
+++ src/http/ngx_http_request.c	(working copy)
@@ -1649,6 +1649,10 @@
         return;
     }
 
+    if (r->discard_body) {
+        return;
+    }
+
     if (r->connection->buffered) {
         (void) ngx_http_set_write_handler(r);
         return;
Index: src/http/ngx_http_request_body.c
===================================================================
--- src/http/ngx_http_request_body.c	(revision 686)
+++ src/http/ngx_http_request_body.c	(working copy)
@@ -442,12 +442,12 @@
         ngx_del_timer(rev);
     }
 
-    r->discard_body = 1;
-
     if (r->headers_in.content_length_n <= 0) {
         return NGX_OK;
     }
 
+    r->discard_body = 1;
+
     size = r->header_in->last - r->header_in->pos;
 
     if (size) {
@@ -502,6 +502,12 @@
                    "http read discarded body");
 
     if (r->headers_in.content_length_n == 0) {
+
+        if (r->done) {
+            r->discard_body = 0;
+            ngx_http_finalize_request(r, 0);
+        }
+
         return NGX_OK;
     }
 


More information about the nginx mailing list