diff src/http/modules/ngx_http_chunked_filter_module.c @ 501:d4ea69372b94 release-0.1.25

nginx-0.1.25-RELEASE import *) Bugfix: nginx did run on Linux parisc. *) Feature: nginx now does not start under FreeBSD if the sysctl kern.ipc.somaxconn value is too big. *) Bugfix: if a request was internally redirected by the ngx_http_index_module module to the ngx_http_proxy_module or ngx_http_fastcgi_module modules, then the index file was not closed after request completion. *) Feature: the "proxy_pass" can be used in location with regular expression. *) Feature: the ngx_http_rewrite_filter_module module supports the condition like "if ($HTTP_USER_AGENT ~ MSIE)". *) Bugfix: nginx started too slow if the large number of addresses and text values were used in the "geo" directive. *) Change: a variable name must be declared as "$name" in the "geo" directive. The previous variant without "$" is still supported, but will be removed soon. *) Feature: the "%{VARIABLE}v" logging parameter. *) Feature: the "set $name value" directive. *) Bugfix: gcc 4.0 compatibility. *) Feature: the --with-openssl-opt=OPTIONS autoconfiguration directive.
author Igor Sysoev <igor@sysoev.ru>
date Sat, 19 Mar 2005 12:38:37 +0000
parents src/http/modules/ngx_http_chunked_filter.c@621229427cba
children 9b8c906f6e63
line wrap: on
line diff
copy from src/http/modules/ngx_http_chunked_filter.c
copy to src/http/modules/ngx_http_chunked_filter_module.c
--- a/src/http/modules/ngx_http_chunked_filter.c
+++ b/src/http/modules/ngx_http_chunked_filter_module.c
@@ -40,7 +40,8 @@ static ngx_http_output_header_filter_pt 
 static ngx_http_output_body_filter_pt    ngx_http_next_body_filter;
 
 
-static ngx_int_t ngx_http_chunked_header_filter(ngx_http_request_t *r)
+static ngx_int_t
+ngx_http_chunked_header_filter(ngx_http_request_t *r)
 {
     if (r->headers_out.status == NGX_HTTP_NOT_MODIFIED) {
         return ngx_http_next_header_filter(r);
@@ -59,8 +60,8 @@ static ngx_int_t ngx_http_chunked_header
 }
 
 
-static ngx_int_t ngx_http_chunked_body_filter(ngx_http_request_t *r,
-                                              ngx_chain_t *in)
+static ngx_int_t
+ngx_http_chunked_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
 {
     u_char       *chunk;
     off_t         size;
@@ -85,7 +86,8 @@ static ngx_int_t ngx_http_chunked_body_f
 
         if (cl->buf->flush || ngx_buf_in_memory(cl->buf) || cl->buf->in_file) {
 
-            if (!(tl = ngx_alloc_chain_link(r->pool))) {
+            tl = ngx_alloc_chain_link(r->pool);
+            if (tl == NULL) {
                 return NGX_ERROR;
             }
 
@@ -102,10 +104,13 @@ static ngx_int_t ngx_http_chunked_body_f
     }
 
     if (size) {
-        if (!(b = ngx_calloc_buf(r->pool))) {
+        b = ngx_calloc_buf(r->pool);
+        if (b == NULL) {
             return NGX_ERROR;
         }
 
+        /* the "0000000000000000" is 64-bit hexadimal string */
+
         chunk = ngx_palloc(r->pool, sizeof("0000000000000000" CRLF) - 1);
         if (chunk == NULL) {
             return NGX_ERROR;
@@ -119,7 +124,8 @@ static ngx_int_t ngx_http_chunked_body_f
     }
 
     if (cl->buf->last_buf) {
-        if (!(b = ngx_calloc_buf(r->pool))) {
+        b = ngx_calloc_buf(r->pool);
+        if (b == NULL) {
             return NGX_ERROR;
         }
 
@@ -144,7 +150,8 @@ static ngx_int_t ngx_http_chunked_body_f
             return ngx_http_next_body_filter(r, out.next);
         }
 
-        if (!(b = ngx_calloc_buf(r->pool))) {
+        b = ngx_calloc_buf(r->pool);
+        if (b == NULL) {
             return NGX_ERROR;
         }
 
@@ -161,7 +168,8 @@ static ngx_int_t ngx_http_chunked_body_f
 }
 
 
-static ngx_int_t ngx_http_chunked_filter_init(ngx_cycle_t *cycle)
+static ngx_int_t
+ngx_http_chunked_filter_init(ngx_cycle_t *cycle)
 {
     ngx_http_next_header_filter = ngx_http_top_header_filter;
     ngx_http_top_header_filter = ngx_http_chunked_header_filter;