comparison src/event/ngx_event_pipe.c @ 28:7ca9bdc82b3f NGINX_0_1_14

nginx 0.1.14 *) Feature: the autoconfiguration directives: --http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and --http-fastcgi-temp-path=PATH *) Change: the directory name for the temporary files with the client request body is specified by directive client_body_temp_path, by default it is <prefix>/client_body_temp. *) Feature: the ngx_http_fastcgi_module and the directives: fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params, fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout, fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers, fastcgi_busy_buffers_size, fastcgi_temp_path, fastcgi_max_temp_file_size, fastcgi_temp_file_write_size, fastcgi_next_upstream, and fastcgi_x_powered_by. *) Bugfix: the "[alert] zero size buf" error; bug appeared in 0.1.3. *) Change: the URI must be specified after the host name in the proxy_pass directive. *) Change: the %3F symbol in the URI was considered as the argument string start. *) Feature: the unix domain sockets support in the ngx_http_proxy_module. *) Feature: the ssl_engine and ssl_ciphers directives. Thanks to Sergey Skvortsov for SSL-accelerator.
author Igor Sysoev <http://sysoev.ru>
date Tue, 18 Jan 2005 00:00:00 +0300
parents 8b6db3bda591
children da8c190bdaba
comparison
equal deleted inserted replaced
27:66901c2556fd 28:7ca9bdc82b3f
377 } 377 }
378 378
379 379
380 ngx_int_t ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p) 380 ngx_int_t ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p)
381 { 381 {
382 off_t bsize; 382 size_t bsize;
383 ngx_uint_t flush; 383 ngx_uint_t flush;
384 ngx_buf_t *b; 384 ngx_buf_t *b;
385 ngx_chain_t *out, **ll, *cl, *tl; 385 ngx_chain_t *out, **ll, *cl, *tl;
386 386
387 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, 387 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0,
431 431
432 if (!p->downstream->write->ready) { 432 if (!p->downstream->write->ready) {
433 break; 433 break;
434 } 434 }
435 435
436 /* bsize is the size of the busy bufs */ 436 /* bsize is the size of the busy recycled bufs */
437 437
438 bsize = 0; 438 bsize = 0;
439 439
440 for (cl = p->busy; cl; cl = cl->next) { 440 for (cl = p->busy; cl; cl = cl->next) {
441 bsize += cl->buf->end - cl->buf->start; 441 if (cl->buf->recycled) {
442 bsize += cl->buf->end - cl->buf->start;
443 }
442 } 444 }
443 445
444 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, 446 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0,
445 "pipe write busy: %O", bsize); 447 "pipe write busy: %uz", bsize);
446 448
447 out = NULL; 449 out = NULL;
448 ll = NULL; 450 ll = NULL;
449 flush = 0; 451 flush = 0;
450 452
451 for ( ;; ) { 453 for ( ;; ) {
452 if (p->out) { 454 if (p->out) {
453 cl = p->out; 455 cl = p->out;
454 456
455 if (bsize + ngx_buf_size(cl->buf) > p->busy_size) { 457 if (cl->buf->recycled
458 && bsize + cl->buf->last - cl->buf->pos > p->busy_size)
459 {
456 flush = 1; 460 flush = 1;
457 break; 461 break;
458 } 462 }
459 463
460 p->out = p->out->next; 464 p->out = p->out->next;
461 ngx_event_pipe_free_shadow_raw_buf(&p->free_raw_bufs, 465
462 cl->buf); 466 ngx_event_pipe_free_shadow_raw_buf(&p->free_raw_bufs, cl->buf);
463 467
464 } else if (!p->cachable && p->in) { 468 } else if (!p->cachable && p->in) {
465 cl = p->in; 469 cl = p->in;
466 470
467 if (bsize + ngx_buf_size(cl->buf) > p->busy_size) { 471 if (cl->buf->recycled
472 && bsize + cl->buf->last - cl->buf->pos > p->busy_size)
473 {
468 flush = 1; 474 flush = 1;
469 break; 475 break;
470 } 476 }
471 477
472 p->in = p->in->next; 478 p->in = p->in->next;
473 479
474 } else { 480 } else {
475 break; 481 break;
476 } 482 }
477 483
478 bsize += ngx_buf_size(cl->buf); 484 if (cl->buf->recycled) {
485 bsize += cl->buf->last - cl->buf->pos;
486 }
487
479 cl->next = NULL; 488 cl->next = NULL;
480 ngx_chain_add_link(out, ll, cl); 489 ngx_chain_add_link(out, ll, cl);
481 } 490 }
482 491
483 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, p->log, 0, 492 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, p->log, 0,
616 p->temp_file->offset += b->last - b->pos; 625 p->temp_file->offset += b->last - b->pos;
617 b->file_last = p->temp_file->offset; 626 b->file_last = p->temp_file->offset;
618 627
619 b->in_file = 1; 628 b->in_file = 1;
620 b->temp_file = 1; 629 b->temp_file = 1;
621 b->temporary = 0;
622 b->recycled = 0;
623 630
624 ngx_chain_add_link(p->out, p->last_out, cl); 631 ngx_chain_add_link(p->out, p->last_out, cl);
625 632
626 if (b->last_shadow) { 633 if (b->last_shadow) {
627 b->shadow->pos = b->shadow->start; 634 b->shadow->pos = b->shadow->start;
666 b->recycled = 1; 673 b->recycled = 1;
667 buf->shadow = b; 674 buf->shadow = b;
668 675
669 ngx_alloc_link_and_set_buf(cl, b, p->pool, NGX_ERROR); 676 ngx_alloc_link_and_set_buf(cl, b, p->pool, NGX_ERROR);
670 677
671 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, "buf #%d", b->num); 678 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, "input buf #%d", b->num);
672 679
673 ngx_chain_add_link(p->in, p->last_in, cl); 680 ngx_chain_add_link(p->in, p->last_in, cl);
674 681
675 return NGX_OK; 682 return NGX_OK;
676 } 683 }
779 while (cl) { 786 while (cl) {
780 if (cl->buf->last_shadow) { 787 if (cl->buf->last_shadow) {
781 b = cl->buf->shadow; 788 b = cl->buf->shadow;
782 b->pos = b->last = b->start; 789 b->pos = b->last = b->start;
783 b->shadow = NULL; 790 b->shadow = NULL;
784 ngx_alloc_link_and_set_buf(tl, b, p->pool, NGX_ABORT); 791
792 if (!(tl = ngx_alloc_chain_link(p->pool))) {
793 return NGX_ABORT;
794 }
795
796 tl->buf = b;
797 tl->next = NULL;
798
785 ngx_event_pipe_add_free_buf(&p->free_raw_bufs, tl); 799 ngx_event_pipe_add_free_buf(&p->free_raw_bufs, tl);
786 800
787 cl->buf->last_shadow = 0; 801 cl->buf->last_shadow = 0;
788 } 802 }
789 803