comparison src/event/ngx_event_pipe.c @ 452:23fb87bddda1 release-0.1.1

nginx-0.1.1-RELEASE import *) Feature: the gzip_types directive. *) Feature: the tcp_nodelay directive. *) Feature: the send_lowat directive is working not only on OSes that support kqueue NOTE_LOWAT, but also on OSes that support SO_SNDLOWAT. *) Feature: the setproctitle() emulation for Linux and Solaris. *) Bugfix: the "Location" header rewrite bug fixed while the proxying. *) Bugfix: the ngx_http_chunked_module module may get caught in an endless loop. *) Bugfix: the /dev/poll module bugs fixed. *) Bugfix: the responses were corrupted when the temporary files were used while the proxying. *) Bugfix: the unescaped requests were passed to the backend. *) Bugfix: while the build configuration on Linux 2.4 the --with-poll_module parameter was required.
author Igor Sysoev <igor@sysoev.ru>
date Mon, 11 Oct 2004 15:07:03 +0000
parents 42d11f017717
children ded1284520cc
comparison
equal deleted inserted replaced
451:f40362e47689 452:23fb87bddda1
62 } 62 }
63 } 63 }
64 64
65 if (p->downstream->fd != -1) { 65 if (p->downstream->fd != -1) {
66 wev = p->downstream->write; 66 wev = p->downstream->write;
67 wev->available = p->send_lowat; 67 if (ngx_handle_write_event(wev, p->send_lowat) == NGX_ERROR) {
68 if (ngx_handle_write_event(wev, NGX_LOWAT_EVENT) == NGX_ERROR) {
69 return NGX_ABORT; 68 return NGX_ABORT;
70 } 69 }
71 70
72 if (wev->active) { 71 if (wev->active) {
73 ngx_add_timer(wev, p->send_timeout); 72 ngx_add_timer(wev, p->send_timeout);
300 299
301 if (p->in || p->busy || p->free_raw_bufs) { 300 if (p->in || p->busy || p->free_raw_bufs) {
302 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0, "pipe buf"); 301 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0, "pipe buf");
303 } 302 }
304 303
304 for (cl = p->busy; cl; cl = cl->next) {
305 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0,
306 "pipe buf busy " PTR_FMT ", pos " PTR_FMT ", size: %d",
307 cl->buf->start, cl->buf->pos,
308 cl->buf->last - cl->buf->pos);
309 }
310
311 for (cl = p->out; cl; cl = cl->next) {
312 if (cl->buf->in_file && cl->buf->temporary) {
313 ngx_log_debug5(NGX_LOG_DEBUG_EVENT, p->log, 0,
314 "pipe buf out shadow "
315 PTR_FMT ", pos " PTR_FMT ", size: %d "
316 "file: " OFF_T_FMT ", size: %d",
317 cl->buf->start, cl->buf->pos,
318 cl->buf->last - cl->buf->pos,
319 cl->buf->file_pos,
320 cl->buf->file_last - cl->buf->file_pos);
321
322 } else if (cl->buf->in_file) {
323 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, p->log, 0,
324 "pipe buf out file " OFF_T_FMT ", size: %d",
325 cl->buf->file_pos,
326 cl->buf->file_last - cl->buf->file_pos);
327 } else {
328 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0,
329 "pipe buf out " PTR_FMT ", pos " PTR_FMT
330 ", size: %d",
331 cl->buf->start, cl->buf->pos,
332 cl->buf->last - cl->buf->pos);
333 }
334 }
335
305 for (cl = p->in; cl; cl = cl->next) { 336 for (cl = p->in; cl; cl = cl->next) {
306 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0, 337 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0,
307 "pipe buf in " PTR_FMT ", pos " PTR_FMT ", size: %d", 338 "pipe buf in " PTR_FMT ", pos " PTR_FMT ", size: %d",
308 cl->buf->start, cl->buf->pos, 339 cl->buf->start, cl->buf->pos,
309 cl->buf->last - cl->buf->pos); 340 cl->buf->last - cl->buf->pos);
310 } 341 }
311 342
312 for (cl = p->busy; cl; cl = cl->next) {
313 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0,
314 "pipe buf busy " PTR_FMT ", pos " PTR_FMT ", size: %d",
315 cl->buf->start, cl->buf->pos,
316 cl->buf->last - cl->buf->pos);
317 }
318
319 for (cl = p->free_raw_bufs; cl; cl = cl->next) { 343 for (cl = p->free_raw_bufs; cl; cl = cl->next) {
320 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0, 344 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0,
321 "pipe buf free " PTR_FMT ", last " PTR_FMT ", size: %d", 345 "pipe buf free " PTR_FMT ", last " PTR_FMT ", size: %d",
322 cl->buf->start, cl->buf->last, 346 cl->buf->start, cl->buf->last,
323 cl->buf->end - cl->buf->last); 347 cl->buf->end - cl->buf->last);
335 359
336 p->free_raw_bufs = p->free_raw_bufs->next; 360 p->free_raw_bufs = p->free_raw_bufs->next;
337 361
338 if (p->free_bufs) { 362 if (p->free_bufs) {
339 for (cl = p->free_raw_bufs; cl; cl = cl->next) { 363 for (cl = p->free_raw_bufs; cl; cl = cl->next) {
340 ngx_pfree(p->pool, cl->buf->start); 364 if (cl->buf->shadow == NULL) {
365 ngx_pfree(p->pool, cl->buf->start);
366 }
341 } 367 }
342 } 368 }
343 } 369 }
344 370
345 if (p->cachable && p->in) { 371 if (p->cachable && p->in) {
595 b->temp_file = 1; 621 b->temp_file = 1;
596 622
597 ngx_chain_add_link(p->out, p->last_out, cl); 623 ngx_chain_add_link(p->out, p->last_out, cl);
598 624
599 if (b->last_shadow) { 625 if (b->last_shadow) {
600 b->shadow->last = b->shadow->pos = b->shadow->start; 626 b->shadow->pos = b->shadow->start;
627 b->shadow->last = b->shadow->start;
628
601 ngx_alloc_link_and_set_buf(tl, b->shadow, p->pool, NGX_ABORT); 629 ngx_alloc_link_and_set_buf(tl, b->shadow, p->pool, NGX_ABORT);
630
602 *last_free = tl; 631 *last_free = tl;
603 last_free = &tl->next; 632 last_free = &tl->next;
604 } 633 }
605 } 634 }
606 635
648 677
649 ngx_inline static void ngx_event_pipe_remove_shadow_links(ngx_buf_t *buf) 678 ngx_inline static void ngx_event_pipe_remove_shadow_links(ngx_buf_t *buf)
650 { 679 {
651 ngx_buf_t *b, *next; 680 ngx_buf_t *b, *next;
652 681
653 if (buf->shadow == NULL) { 682 b = buf->shadow;
683
684 if (b == NULL) {
654 return; 685 return;
655 } 686 }
656
657 b = buf->shadow;
658 687
659 while (!b->last_shadow) { 688 while (!b->last_shadow) {
660 next = b->shadow; 689 next = b->shadow;
661 690
662 b->in_file = 0; 691 b->temporary = 0;
663 b->temp_file = 0; 692 b->recycled = 0;
664 b->flush = 0;
665 b->zerocopy_busy = 0;
666 693
667 b->shadow = NULL; 694 b->shadow = NULL;
668 b = next; 695 b = next;
669 } 696 }
670 697
671 b->in_file = 0; 698 b->temporary = 0;
672 b->temp_file = 0; 699 b->recycled = 0;
673 b->flush = 0;
674 b->zerocopy_busy = 0;
675 b->last_shadow = 0; 700 b->last_shadow = 0;
676 701
677 b->shadow = NULL; 702 b->shadow = NULL;
678 703
679 buf->shadow = NULL; 704 buf->shadow = NULL;