diff src/http/modules/ngx_http_fastcgi_handler.c @ 32:da8c190bdaba NGINX_0_1_16

nginx 0.1.16 *) Bugfix: if the response were transferred by chunks, then on the HEAD request the final chunk was issued. *) Bugfix: the "Connection: keep-alive" header were issued, even if the keepalive_timeout directive forbade the keep-alive use. *) Bugfix: the errors in the ngx_http_fastcgi_module caused the segmentation faults. *) Bugfix: the compressed response encrypted by SSL may not transferred complete. *) Bugfix: the TCP-specific TCP_NODELAY, TCP_NOPSUH, and TCP_CORK options, are not used for the unix domain sockets. *) Feature: the rewrite directive supports the arguments rewriting. *) Bugfix: the response code 400 was returned for the POST request with the "Content-Length: 0" header; bug appeared in 0.1.14.
author Igor Sysoev <http://sysoev.ru>
date Tue, 25 Jan 2005 00:00:00 +0300
parents e1ada20fc595
children aab2ea7c0458
line wrap: on
line diff
--- a/src/http/modules/ngx_http_fastcgi_handler.c
+++ b/src/http/modules/ngx_http_fastcgi_handler.c
@@ -1385,7 +1385,7 @@ static ngx_int_t ngx_http_fastcgi_input_
                                                ngx_buf_t *buf)
 {
     ngx_int_t                rc;
-    ngx_buf_t               *b;
+    ngx_buf_t               *b, **prev;
     ngx_str_t                line;
     ngx_chain_t             *cl;
     ngx_http_request_t      *r;
@@ -1399,6 +1399,7 @@ static ngx_int_t ngx_http_fastcgi_input_
     f = ngx_http_get_module_ctx(r, ngx_http_fastcgi_module);
 
     b = NULL;
+    prev = &buf->shadow;
 
     f->pos = buf->pos;
     f->last = buf->last;
@@ -1510,11 +1511,14 @@ static ngx_int_t ngx_http_fastcgi_input_
         ngx_memzero(b, sizeof(ngx_buf_t));
 
         b->pos = f->pos;
-        b->shadow = buf;
+        b->start = buf->start;
+        b->end = buf->end;
         b->tag = p->tag;
         b->temporary = 1;
         b->recycled = 1;
-        buf->shadow = b;
+
+        *prev = b;
+        prev = &b->shadow;
 
         if (!(cl = ngx_alloc_chain_link(p->pool))) {
             return NGX_ERROR;
@@ -1523,6 +1527,8 @@ static ngx_int_t ngx_http_fastcgi_input_
         cl->buf = b;
         cl->next = NULL;
 
+        /* STUB */ b->num = buf->num;
+
         ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, "input buf #%d", b->num);
 
         ngx_chain_add_link(p->in, p->last_in, cl);
@@ -1563,7 +1569,16 @@ static ngx_int_t ngx_http_fastcgi_input_
     }
 
     if (b) {
+        b->shadow = buf;
         b->last_shadow = 1;
+
+        return NGX_OK;
+    }
+
+    /* there is no data record in the buf, add it to free chain */
+
+    if (ngx_event_pipe_add_free_buf(p, buf) != NGX_OK) {
+        return NGX_ERROR;
     }
 
     return NGX_OK;