[PROPOSAL PATCH] use a return code for ngx_http_terminate_request()

crespin nginx-forum at nginx.us
Fri Jun 27 13:07:27 UTC 2014


Hello,

Reading ngx_http_request.c source code, I notice some call to
ngx_http_terminate_request() is called sometimes with 0 instead of a return
code.

0 is a correct valid for a return code ... it's NGX_OK.

Is the patch valid ?

It's based on nginx-1.7.2 version.

Thanks for your reply. 

yves

Subject: [PATCH] use a return code for ngx_http_terminate_request()

---
 1.0/source/nginx-1.7.2/src/http/ngx_http_request.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/1.0/source/nginx-1.7.2/src/http/ngx_http_request.c
b/1.0/source/nginx-1.7.2/src/http/ngx_http_request.c
index 4bf9d1f..8ddfc60 100644
--- a/1.0/source/nginx-1.7.2/src/http/ngx_http_request.c
+++ b/1.0/source/nginx-1.7.2/src/http/ngx_http_request.c
@@ -2329,7 +2329,7 @@ ngx_http_finalize_request(ngx_http_request_t *r,
ngx_int_t rc)
         if (r->buffered || r->postponed) {

             if (ngx_http_set_write_handler(r) != NGX_OK) {
-                ngx_http_terminate_request(r, 0);
+                ngx_http_terminate_request(r, NGX_ERROR);
             }
     
             return;
@@ -2381,7 +2381,7 @@ ngx_http_finalize_request(ngx_http_request_t *r,
ngx_int_t rc)

         if (ngx_http_post_request(pr, NULL) != NGX_OK) {
             r->main->count++;
-            ngx_http_terminate_request(r, 0);
+            ngx_http_terminate_request(r, NGX_ERROR);
             return;
         }

@@ -2395,7 +2395,7 @@ ngx_http_finalize_request(ngx_http_request_t *r,
ngx_int_t rc)
     if (r->buffered || c->buffered || r->postponed || r->blocked) {
 
         if (ngx_http_set_write_handler(r) != NGX_OK) {
-            ngx_http_terminate_request(r, 0);
+            ngx_http_terminate_request(r, NGX_ERROR);
         }
     
         return;
-- 
1.7.10.4

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,251227,251227#msg-251227



More information about the nginx mailing list