]> git.kaiwu.me - nginx.git/commitdiff
Request body: moved request body writing to save filter.
authorMaxim Dounin <mdounin@mdounin.ru>
Mon, 23 Mar 2015 18:09:19 +0000 (21:09 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Mon, 23 Mar 2015 18:09:19 +0000 (21:09 +0300)
src/http/ngx_http_request_body.c

index 18a58d87682e27712b425f406330b54abc586a8e..d46a54c4a1571d4ac1db8046185c7420f64e2266 100644 (file)
@@ -277,20 +277,6 @@ ngx_http_do_read_client_request_body(ngx_http_request_t *r)
                     return rc;
                 }
 
-                /* write to file */
-
-                if (ngx_http_write_request_body(r) != NGX_OK) {
-                    return NGX_HTTP_INTERNAL_SERVER_ERROR;
-                }
-
-                /* update chains */
-
-                rc = ngx_http_request_body_filter(r, NULL);
-
-                if (rc != NGX_OK) {
-                    return rc;
-                }
-
                 if (rb->busy != NULL) {
                     return NGX_HTTP_INTERNAL_SERVER_ERROR;
                 }
@@ -1100,5 +1086,13 @@ ngx_http_request_body_save_filter(ngx_http_request_t *r, ngx_chain_t *in)
         return NGX_HTTP_INTERNAL_SERVER_ERROR;
     }
 
+    if (rb->rest > 0
+        && rb->buf && rb->buf->last == rb->buf->end)
+    {
+        if (ngx_http_write_request_body(r) != NGX_OK) {
+            return NGX_HTTP_INTERNAL_SERVER_ERROR;
+        }
+    }
+
     return NGX_OK;
 }