changeset 3846:005d5cf5b403

use boolean expression instead of "if"
author Igor Sysoev <igor@sysoev.ru>
date Wed, 15 Dec 2010 14:10:33 +0000
parents 11c68a5ed419
children 1df5620b9cd6
files src/http/ngx_http_core_module.c
diffstat 1 files changed, 2 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -789,11 +789,7 @@ ngx_http_handler(ngx_http_request_t *r)
     if (!r->internal) {
         switch (r->headers_in.connection_type) {
         case 0:
-            if (r->http_version > NGX_HTTP_VERSION_10) {
-                r->keepalive = 1;
-            } else {
-                r->keepalive = 0;
-            }
+            r->keepalive = (r->http_version > NGX_HTTP_VERSION_10);
             break;
 
         case NGX_HTTP_CONNECTION_CLOSE:
@@ -805,13 +801,7 @@ ngx_http_handler(ngx_http_request_t *r)
             break;
         }
 
-        if (r->headers_in.content_length_n > 0) {
-            r->lingering_close = 1;
-
-        } else {
-            r->lingering_close = 0;
-        }
-
+        r->lingering_close = (r->headers_in.content_length_n > 0);
         r->phase_handler = 0;
 
     } else {