comparison src/core/ngx_output_chain.c @ 48:6cfc63e68377 NGINX_0_1_24

nginx 0.1.24 *) Feature: the ngx_http_ssi_filter_module supports the QUERY_STRING and DOCUMENT_URI variables. *) Bugfix: the ngx_http_autoindex_module may some times return the 404 response for existent directory, if this directory was used in "alias" directive. *) Bugfix: the ngx_http_ssi_filter_module ran incorrectly for large responses. *) Bugfix: the lack of the "Referer" header line was always accounted as valid referrer.
author Igor Sysoev <http://sysoev.ru>
date Fri, 04 Mar 2005 00:00:00 +0300
parents da8c190bdaba
children 72eb30262aac
comparison
equal deleted inserted replaced
47:4ae32548452c 48:6cfc63e68377
18 18
19 19
20 static ngx_inline ngx_int_t 20 static ngx_inline ngx_int_t
21 ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf); 21 ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf);
22 static ngx_int_t ngx_output_chain_add_copy(ngx_pool_t *pool, 22 static ngx_int_t ngx_output_chain_add_copy(ngx_pool_t *pool,
23 ngx_chain_t **chain, ngx_chain_t *in); 23 ngx_chain_t **chain, ngx_chain_t *in);
24 static ngx_int_t ngx_output_chain_copy_buf(ngx_buf_t *dst, ngx_buf_t *src, 24 static ngx_int_t ngx_output_chain_copy_buf(ngx_buf_t *dst, ngx_buf_t *src,
25 ngx_uint_t sendfile); 25 ngx_uint_t sendfile);
26 26
27 27
28 ngx_int_t ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in) 28 ngx_int_t
29 ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
29 { 30 {
30 int rc, last; 31 int rc, last;
31 off_t bsize; 32 off_t bsize;
32 size_t size; 33 size_t size;
33 ngx_chain_t *cl, *out, **last_out; 34 ngx_chain_t *cl, *out, **last_out;
60 if (ngx_output_chain_add_copy(ctx->pool, &ctx->in, in) == NGX_ERROR) { 61 if (ngx_output_chain_add_copy(ctx->pool, &ctx->in, in) == NGX_ERROR) {
61 return NGX_ERROR; 62 return NGX_ERROR;
62 } 63 }
63 } 64 }
64 65
65 last = NGX_NONE;
66 out = NULL; 66 out = NULL;
67 last_out = &out; 67 last_out = &out;
68 last = NGX_NONE;
68 69
69 for ( ;; ) { 70 for ( ;; ) {
70 71
71 while (ctx->in) { 72 while (ctx->in) {
72 73
210 } 211 }
211 } 212 }
212 213
213 214
214 static ngx_inline ngx_int_t 215 static ngx_inline ngx_int_t
215 ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf) 216 ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf)
216 { 217 {
217 ngx_uint_t sendfile; 218 ngx_uint_t sendfile;
218 219
219 if (ngx_buf_special(buf)) { 220 if (ngx_buf_special(buf)) {
220 return 0; 221 return 0;
249 250
250 return 0; 251 return 0;
251 } 252 }
252 253
253 254
254 static ngx_int_t ngx_output_chain_add_copy(ngx_pool_t *pool, 255 static ngx_int_t
255 ngx_chain_t **chain, ngx_chain_t *in) 256 ngx_output_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain,
257 ngx_chain_t *in)
256 { 258 {
257 ngx_chain_t *cl, **ll; 259 ngx_chain_t *cl, **ll;
258 #if (NGX_SENDFILE_LIMIT) 260 #if (NGX_SENDFILE_LIMIT)
259 ngx_buf_t *b, *buf; 261 ngx_buf_t *b, *buf;
260 #endif 262 #endif
314 316
315 return NGX_OK; 317 return NGX_OK;
316 } 318 }
317 319
318 320
319 static ngx_int_t ngx_output_chain_copy_buf(ngx_buf_t *dst, ngx_buf_t *src, 321 static ngx_int_t
320 ngx_uint_t sendfile) 322 ngx_output_chain_copy_buf(ngx_buf_t *dst, ngx_buf_t *src, ngx_uint_t sendfile)
321 { 323 {
322 off_t size; 324 off_t size;
323 ssize_t n; 325 ssize_t n;
324 326
325 size = ngx_buf_size(src); 327 size = ngx_buf_size(src);
406 408
407 return NGX_OK; 409 return NGX_OK;
408 } 410 }
409 411
410 412
411 ngx_int_t ngx_chain_writer(void *data, ngx_chain_t *in) 413 ngx_int_t
414 ngx_chain_writer(void *data, ngx_chain_t *in)
412 { 415 {
413 ngx_chain_writer_ctx_t *ctx = data; 416 ngx_chain_writer_ctx_t *ctx = data;
414 417
415 off_t size; 418 off_t size;
416 ngx_chain_t *cl; 419 ngx_chain_t *cl;
417
418 420
419 for (size = 0; in; in = in->next) { 421 for (size = 0; in; in = in->next) {
420 422
421 #if 1 423 #if 1
422 if (ngx_buf_size(in->buf) == 0 && !ngx_buf_special(in->buf)) { 424 if (ngx_buf_size(in->buf) == 0 && !ngx_buf_special(in->buf)) {
442 "chain writer in: %p", ctx->out); 444 "chain writer in: %p", ctx->out);
443 445
444 for (cl = ctx->out; cl; cl = cl->next) { 446 for (cl = ctx->out; cl; cl = cl->next) {
445 447
446 #if 1 448 #if 1
447
448 if (ngx_buf_size(cl->buf) == 0 && !ngx_buf_special(cl->buf)) { 449 if (ngx_buf_size(cl->buf) == 0 && !ngx_buf_special(cl->buf)) {
449 ngx_debug_point(); 450 ngx_debug_point();
450 } 451 }
451 452
452 #endif 453 #endif