comparison src/core/ngx_output_chain.c @ 372:6639b93e81b2 NGINX_0_6_30

nginx 0.6.30 *) Change: now if an "include" directive pattern does not match any file, then nginx does not issue an error. *) Feature: now the time in directives may be specified without spaces, for example, "1h50m". *) Bugfix: memory leaks if the "ssl_verify_client" directive was on. Thanks to Chavelle Vincent. *) Bugfix: the "sub_filter" directive might set text to change into output. *) Bugfix: the "error_page" directive did not take into account arguments in redirected URI. *) Bugfix: now nginx always opens files in binary mode under Cygwin. *) Bugfix: nginx could not be built on OpenBSD; bug appeared in 0.6.15.
author Igor Sysoev <http://sysoev.ru>
date Tue, 29 Apr 2008 00:00:00 +0400
parents 94e16de3c33f
children 0b6053502c55
comparison
equal deleted inserted replaced
371:b6a2a305fdad 372:6639b93e81b2
431 ngx_int_t 431 ngx_int_t
432 ngx_chain_writer(void *data, ngx_chain_t *in) 432 ngx_chain_writer(void *data, ngx_chain_t *in)
433 { 433 {
434 ngx_chain_writer_ctx_t *ctx = data; 434 ngx_chain_writer_ctx_t *ctx = data;
435 435
436 off_t size; 436 off_t size;
437 ngx_chain_t *cl; 437 ngx_chain_t *cl;
438 ngx_connection_t *c;
439
440 c = ctx->connection;
438 441
439 for (size = 0; in; in = in->next) { 442 for (size = 0; in; in = in->next) {
440 443
441 #if 1 444 #if 1
442 if (ngx_buf_size(in->buf) == 0 && !ngx_buf_special(in->buf)) { 445 if (ngx_buf_size(in->buf) == 0 && !ngx_buf_special(in->buf)) {
444 } 447 }
445 #endif 448 #endif
446 449
447 size += ngx_buf_size(in->buf); 450 size += ngx_buf_size(in->buf);
448 451
449 ngx_log_debug2(NGX_LOG_DEBUG_CORE, ctx->connection->log, 0, 452 ngx_log_debug2(NGX_LOG_DEBUG_CORE, c->log, 0,
450 "chain writer buf fl:%d s:%uO", 453 "chain writer buf fl:%d s:%uO",
451 in->buf->flush, ngx_buf_size(in->buf)); 454 in->buf->flush, ngx_buf_size(in->buf));
452 455
453 cl = ngx_alloc_chain_link(ctx->pool); 456 cl = ngx_alloc_chain_link(ctx->pool);
454 if (cl == NULL) { 457 if (cl == NULL) {
459 cl->next = NULL; 462 cl->next = NULL;
460 *ctx->last = cl; 463 *ctx->last = cl;
461 ctx->last = &cl->next; 464 ctx->last = &cl->next;
462 } 465 }
463 466
464 ngx_log_debug1(NGX_LOG_DEBUG_CORE, ctx->connection->log, 0, 467 ngx_log_debug1(NGX_LOG_DEBUG_CORE, c->log, 0,
465 "chain writer in: %p", ctx->out); 468 "chain writer in: %p", ctx->out);
466 469
467 for (cl = ctx->out; cl; cl = cl->next) { 470 for (cl = ctx->out; cl; cl = cl->next) {
468 471
469 #if 1 472 #if 1
474 #endif 477 #endif
475 478
476 size += ngx_buf_size(cl->buf); 479 size += ngx_buf_size(cl->buf);
477 } 480 }
478 481
479 if (size == 0 && !ctx->connection->buffered) { 482 if (size == 0 && !c->buffered) {
480 return NGX_OK; 483 return NGX_OK;
481 } 484 }
482 485
483 ctx->out = ctx->connection->send_chain(ctx->connection, ctx->out, 486 ctx->out = c->send_chain(c, ctx->out, ctx->limit);
484 ctx->limit); 487
485 488 ngx_log_debug1(NGX_LOG_DEBUG_CORE, c->log, 0,
486 ngx_log_debug1(NGX_LOG_DEBUG_CORE, ctx->connection->log, 0,
487 "chain writer out: %p", ctx->out); 489 "chain writer out: %p", ctx->out);
488 490
489 if (ctx->out == NGX_CHAIN_ERROR) { 491 if (ctx->out == NGX_CHAIN_ERROR) {
490 return NGX_ERROR; 492 return NGX_ERROR;
491 } 493 }
492 494
493 if (ctx->out == NULL) { 495 if (ctx->out == NULL) {
494 ctx->last = &ctx->out; 496 ctx->last = &ctx->out;
495 497
496 if (!ctx->connection->buffered) { 498 if (!c->buffered) {
497 return NGX_OK; 499 return NGX_OK;
498 } 500 }
499 } 501 }
500 502
501 return NGX_AGAIN; 503 return NGX_AGAIN;