diff src/http/ngx_http_special_response.c @ 50:72eb30262aac NGINX_0_1_25

nginx 0.1.25 *) 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 <http://sysoev.ru>
date Sat, 19 Mar 2005 00:00:00 +0300
parents 6cfc63e68377
children 0d75d65c642f
line wrap: on
line diff
--- a/src/http/ngx_http_special_response.c
+++ b/src/http/ngx_http_special_response.c
@@ -17,7 +17,7 @@ static u_char error_tail[] =
 ;
 
 
-static u_char msie_stub[] =
+static u_char ngx_http_msie_stub[] =
 "<!-- The padding to disable MSIE's friendly error page -->" CRLF
 "<!-- The padding to disable MSIE's friendly error page -->" CRLF
 "<!-- The padding to disable MSIE's friendly error page -->" CRLF
@@ -234,9 +234,9 @@ ngx_int_t
 ngx_http_special_response_handler(ngx_http_request_t *r, ngx_int_t error)
 {
     ngx_int_t                  rc;
-    ngx_uint_t                 err, i, msie_padding;
+    ngx_uint_t                 i, err, msie_padding;
     ngx_buf_t                 *b;
-    ngx_chain_t               *out, **ll, *cl;
+    ngx_chain_t               *out, *cl;
     ngx_http_err_page_t       *err_page;
     ngx_http_core_loc_conf_t  *clcf;
 
@@ -327,7 +327,7 @@ ngx_http_special_response_handler(ngx_ht
             && error >= NGX_HTTP_BAD_REQUEST
             && error != NGX_HTTP_REQUEST_URI_TOO_LARGE)
         {
-            r->headers_out.content_length_n += sizeof(msie_stub) - 1;
+            r->headers_out.content_length_n += sizeof(ngx_http_msie_stub) - 1;
             msie_padding = 1;
         }
 
@@ -360,43 +360,64 @@ ngx_http_special_response_handler(ngx_ht
         return NGX_OK;
     }
 
-    out = NULL;
-    ll = NULL;
 
-    if (!(b = ngx_calloc_buf(r->pool))) {
+    b = ngx_calloc_buf(r->pool);
+    if (b == NULL) {
         return NGX_ERROR;
     }
+
     b->memory = 1;
     b->pos = error_pages[err].data;
     b->last = error_pages[err].data + error_pages[err].len;
 
-    ngx_alloc_link_and_set_buf(cl, b, r->pool, NGX_ERROR);
-    ngx_chain_add_link(out, ll, cl);
+    cl = ngx_alloc_chain_link(r->pool);
+    if (cl == NULL) {
+        return NGX_ERROR;
+    }
+
+    cl->buf = b;
+    out = cl;
 
 
-    if (!(b = ngx_calloc_buf(r->pool))) {
+    b = ngx_calloc_buf(r->pool);
+    if (b == NULL) {
         return NGX_ERROR;
     }
+
     b->memory = 1;
     b->pos = error_tail;
     b->last = error_tail + sizeof(error_tail) - 1;
 
-    ngx_alloc_link_and_set_buf(cl, b, r->pool, NGX_ERROR);
-    ngx_chain_add_link(out, ll, cl);
+    cl->next = ngx_alloc_chain_link(r->pool);
+    if (cl->next == NULL) {
+        return NGX_ERROR;
+    }
+
+    cl = cl->next;
+    cl->buf = b;
 
     if (msie_padding) {
-        if (!(b = ngx_calloc_buf(r->pool))) {
+        b = ngx_calloc_buf(r->pool);
+        if (b == NULL) {
             return NGX_ERROR;
         }
+
         b->memory = 1;
-        b->pos = msie_stub;
-        b->last = msie_stub + sizeof(msie_stub) - 1;
+        b->pos = ngx_http_msie_stub;
+        b->last = ngx_http_msie_stub + sizeof(ngx_http_msie_stub) - 1;
 
-        ngx_alloc_link_and_set_buf(cl, b, r->pool, NGX_ERROR);
-        ngx_chain_add_link(out, ll, cl);
+        cl->next = ngx_alloc_chain_link(r->pool);
+        if (cl->next == NULL) {
+            return NGX_ERROR;
+        }
+
+        cl = cl->next;
+        cl->buf = b;
     }
 
     b->last_buf = 1;
 
+    cl->next = NULL;
+
     return ngx_http_output_filter(r, out);
 }