comparison src/core/ngx_output_chain.c @ 146:36af50a5582d NGINX_0_3_20

nginx 0.3.20 *) Bugfix: in SSI handling. *) Bugfix: the ngx_http_memcached_module did not support the keys in the "/usr?args" form.
author Igor Sysoev <http://sysoev.ru>
date Wed, 11 Jan 2006 00:00:00 +0300
parents df17fbafec8f
children f3ec44f4a53b
comparison
equal deleted inserted replaced
145:85a84f8da62b 146:36af50a5582d
26 26
27 27
28 ngx_int_t 28 ngx_int_t
29 ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in) 29 ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
30 { 30 {
31 int rc, last;
32 off_t bsize; 31 off_t bsize;
33 size_t size; 32 size_t size;
33 ngx_int_t rc, last;
34 ngx_uint_t recycled;
34 ngx_chain_t *cl, *out, **last_out; 35 ngx_chain_t *cl, *out, **last_out;
35 36
36 if (ctx->in == NULL && ctx->busy == NULL) { 37 if (ctx->in == NULL && ctx->busy == NULL) {
37 38
38 /* 39 /*
129 break; 130 break;
130 131
131 } else { 132 } else {
132 133
133 size = ctx->bufs.size; 134 size = ctx->bufs.size;
135 recycled = 1;
134 136
135 if (ctx->in->buf->last_in_chain) { 137 if (ctx->in->buf->last_in_chain) {
136 138
137 if (bsize < (off_t) ctx->bufs.size) { 139 if (bsize < (off_t) ctx->bufs.size) {
138 140
140 * allocate small temp buf for the small last buf 142 * allocate small temp buf for the small last buf
141 * or its small last part 143 * or its small last part
142 */ 144 */
143 145
144 size = (size_t) bsize; 146 size = (size_t) bsize;
147 recycled = 0;
145 148
146 } else if (ctx->bufs.num == 1 149 } else if (ctx->bufs.num == 1
147 && (bsize < (off_t) (ctx->bufs.size 150 && (bsize < (off_t) (ctx->bufs.size
148 + (ctx->bufs.size >> 2)))) 151 + (ctx->bufs.size >> 2))))
149 { 152 {
152 * to the last buf if the last buf size is lesser 155 * to the last buf if the last buf size is lesser
153 * than 1.25 of bufs.size and a temp buf is single 156 * than 1.25 of bufs.size and a temp buf is single
154 */ 157 */
155 158
156 size = (size_t) bsize; 159 size = (size_t) bsize;
160 recycled = 0;
157 } 161 }
158 } 162 }
159 163
160 ctx->buf = ngx_create_temp_buf(ctx->pool, size); 164 ctx->buf = ngx_create_temp_buf(ctx->pool, size);
161 if (ctx->buf == NULL) { 165 if (ctx->buf == NULL) {
162 return NGX_ERROR; 166 return NGX_ERROR;
163 } 167 }
164 168
165 ctx->buf->tag = ctx->tag; 169 ctx->buf->tag = ctx->tag;
166 ctx->buf->recycled = 1; 170 ctx->buf->recycled = recycled;
167 ctx->allocated++; 171 ctx->allocated++;
168 } 172 }
169 } 173 }
170 174
171 rc = ngx_output_chain_copy_buf(ctx->buf, ctx->in->buf, 175 rc = ngx_output_chain_copy_buf(ctx->buf, ctx->in->buf,