From df8ae756b2c77eb168b01f1e3939ed3d3ad09358 Mon Sep 17 00:00:00 2001 From: yangboyd Date: Fri, 16 Nov 2018 20:19:56 +0800 Subject: [PATCH] resolve conflicts with lua nginx module about request body --- ngx_http_upload_module.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ngx_http_upload_module.c b/ngx_http_upload_module.c index 888a4f9..6fe9a50 100644 --- a/ngx_http_upload_module.c +++ b/ngx_http_upload_module.c @@ -3112,9 +3112,22 @@ ngx_http_read_upload_client_request_body(ngx_http_request_t *r) { r->main->count++; #endif - if (r->request_body || r->discard_body) { + //if (r->request_body || r->discard_body) { + if (r->discard_body) { return NGX_OK; } + //BOYD lua-nginx ngx.req.read_body() may already have request body + if (r->request_body) + { + if (ngx_http_process_request_body(r, r->request_body->bufs) != NGX_OK) { + upload_shutdown_ctx(u); + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + upload_shutdown_ctx(u); + + return ngx_http_upload_body_handler(r); + } rb = ngx_pcalloc(r->pool, sizeof(ngx_http_request_body_t)); if (rb == NULL) {