Mercurial > hg > nginx
comparison src/event/ngx_event_pipe.c @ 577:4d9ea73a627a release-0.3.10
nginx-0.3.10-RELEASE import
*) Change: the "valid_referers" directive and the "$invalid_referer"
variable were moved to the new ngx_http_referer_module from the
ngx_http_rewrite_module.
*) Change: the "$apache_bytes_sent" variable name was changed to
"$body_bytes_sent".
*) Feature: the "$sent_http_..." variables.
*) Feature: the "if" directive supports the "=" and "!=" operations.
*) Feature: the "proxy_pass" directive supports the HTTPS protocol.
*) Feature: the "proxy_set_body" directive.
*) Feature: the "post_action" directive.
*) Feature: the ngx_http_empty_gif_module.
*) Feature: the "worker_cpu_affinity" directive for Linux.
*) Bugfix: the "rewrite" directive did not unescape URI part in
redirect, now it is unescaped except the %00-%25 and %7F-%FF
characters.
*) Bugfix: nginx could not be built by the icc 9.0 compiler.
*) Bugfix: if the SSI was enabled for zero size static file, then the
chunked response was encoded incorrectly.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 15 Nov 2005 13:30:52 +0000 |
parents | 7fa11e5c6e96 |
children | 326634fb9d47 |
comparison
equal
deleted
inserted
replaced
576:3e0b61c26426 | 577:4d9ea73a627a |
---|---|
18 static ngx_inline void ngx_event_pipe_free_shadow_raw_buf(ngx_chain_t **free, | 18 static ngx_inline void ngx_event_pipe_free_shadow_raw_buf(ngx_chain_t **free, |
19 ngx_buf_t *buf); | 19 ngx_buf_t *buf); |
20 static ngx_int_t ngx_event_pipe_drain_chains(ngx_event_pipe_t *p); | 20 static ngx_int_t ngx_event_pipe_drain_chains(ngx_event_pipe_t *p); |
21 | 21 |
22 | 22 |
23 ngx_int_t ngx_event_pipe(ngx_event_pipe_t *p, int do_write) | 23 ngx_int_t |
24 ngx_event_pipe(ngx_event_pipe_t *p, int do_write) | |
24 { | 25 { |
25 u_int flags; | 26 u_int flags; |
26 ngx_event_t *rev, *wev; | 27 ngx_event_t *rev, *wev; |
27 | 28 |
28 for ( ;; ) { | 29 for ( ;; ) { |
77 | 78 |
78 return NGX_OK; | 79 return NGX_OK; |
79 } | 80 } |
80 | 81 |
81 | 82 |
82 static ngx_int_t ngx_event_pipe_read_upstream(ngx_event_pipe_t *p) | 83 static ngx_int_t |
84 ngx_event_pipe_read_upstream(ngx_event_pipe_t *p) | |
83 { | 85 { |
84 ssize_t n, size; | 86 ssize_t n, size; |
85 ngx_int_t rc; | 87 ngx_int_t rc; |
86 ngx_buf_t *b; | 88 ngx_buf_t *b; |
87 ngx_chain_t *chain, *cl, *ln; | 89 ngx_chain_t *chain, *cl, *ln; |
121 } else { | 123 } else { |
122 | 124 |
123 /* | 125 /* |
124 * kqueue notifies about the end of file or a pending error. | 126 * kqueue notifies about the end of file or a pending error. |
125 * This test allows not to allocate a buf on these conditions | 127 * This test allows not to allocate a buf on these conditions |
126 * and not to call ngx_recv_chain(). | 128 * and not to call c->recv_chain(). |
127 */ | 129 */ |
128 | 130 |
129 if (p->upstream->read->available == 0 | 131 if (p->upstream->read->available == 0 |
130 && p->upstream->read->pending_eof) | 132 && p->upstream->read->pending_eof) |
131 { | 133 { |
219 if (ngx_event_flags & NGX_USE_LEVEL_EVENT | 221 if (ngx_event_flags & NGX_USE_LEVEL_EVENT |
220 && p->upstream->read->active | 222 && p->upstream->read->active |
221 && p->upstream->read->ready) | 223 && p->upstream->read->ready) |
222 { | 224 { |
223 if (ngx_del_event(p->upstream->read, NGX_READ_EVENT, 0) | 225 if (ngx_del_event(p->upstream->read, NGX_READ_EVENT, 0) |
224 == NGX_ERROR) | 226 == NGX_ERROR) |
225 { | 227 { |
226 return NGX_ABORT; | 228 return NGX_ABORT; |
227 } | 229 } |
228 } | 230 } |
229 } | 231 } |
244 | 246 |
245 /* there are no bufs to read in */ | 247 /* there are no bufs to read in */ |
246 | 248 |
247 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0, | 249 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0, |
248 "no pipe bufs to read in"); | 250 "no pipe bufs to read in"); |
249 | 251 |
250 break; | 252 break; |
251 } | 253 } |
252 | 254 |
253 n = ngx_recv_chain(p->upstream, chain); | 255 n = p->upstream->recv_chain(p->upstream, chain); |
254 | 256 |
255 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, | 257 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, |
256 "pipe recv chain: %z", n); | 258 "pipe recv chain: %z", n); |
257 | 259 |
258 if (p->free_raw_bufs) { | 260 if (p->free_raw_bufs) { |
380 p->free_raw_bufs = p->free_raw_bufs->next; | 382 p->free_raw_bufs = p->free_raw_bufs->next; |
381 | 383 |
382 if (p->free_bufs) { | 384 if (p->free_bufs) { |
383 for (cl = p->free_raw_bufs; cl; cl = cl->next) { | 385 for (cl = p->free_raw_bufs; cl; cl = cl->next) { |
384 if (cl->buf->shadow == NULL) { | 386 if (cl->buf->shadow == NULL) { |
385 ngx_pfree(p->pool, cl->buf->start); | 387 ngx_pfree(p->pool, cl->buf->start); |
386 } | 388 } |
387 } | 389 } |
388 } | 390 } |
389 } | 391 } |
390 | 392 |
396 | 398 |
397 return NGX_OK; | 399 return NGX_OK; |
398 } | 400 } |
399 | 401 |
400 | 402 |
401 static ngx_int_t ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p) | 403 static ngx_int_t |
404 ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p) | |
402 { | 405 { |
403 size_t bsize; | 406 size_t bsize; |
404 ngx_uint_t flush; | 407 ngx_uint_t flush; |
405 ngx_chain_t *out, **ll, *cl; | 408 ngx_chain_t *out, **ll, *cl; |
406 | 409 |
576 | 579 |
577 return NGX_OK; | 580 return NGX_OK; |
578 } | 581 } |
579 | 582 |
580 | 583 |
581 static ngx_int_t ngx_event_pipe_write_chain_to_temp_file(ngx_event_pipe_t *p) | 584 static ngx_int_t |
585 ngx_event_pipe_write_chain_to_temp_file(ngx_event_pipe_t *p) | |
582 { | 586 { |
583 ssize_t size, bsize; | 587 ssize_t size, bsize; |
584 ngx_buf_t *b; | 588 ngx_buf_t *b; |
585 ngx_chain_t *cl, *tl, *next, *out, **ll, **last_free, fl; | 589 ngx_chain_t *cl, *tl, *next, *out, **ll, **last_free, fl; |
586 | 590 |
702 } | 706 } |
703 | 707 |
704 | 708 |
705 /* the copy input filter */ | 709 /* the copy input filter */ |
706 | 710 |
707 ngx_int_t ngx_event_pipe_copy_input_filter(ngx_event_pipe_t *p, ngx_buf_t *buf) | 711 ngx_int_t |
712 ngx_event_pipe_copy_input_filter(ngx_event_pipe_t *p, ngx_buf_t *buf) | |
708 { | 713 { |
709 ngx_buf_t *b; | 714 ngx_buf_t *b; |
710 ngx_chain_t *cl; | 715 ngx_chain_t *cl; |
711 | 716 |
712 if (buf->pos == buf->last) { | 717 if (buf->pos == buf->last) { |
752 | 757 |
753 return NGX_OK; | 758 return NGX_OK; |
754 } | 759 } |
755 | 760 |
756 | 761 |
757 static ngx_inline void ngx_event_pipe_remove_shadow_links(ngx_buf_t *buf) | 762 static ngx_inline void |
763 ngx_event_pipe_remove_shadow_links(ngx_buf_t *buf) | |
758 { | 764 { |
759 ngx_buf_t *b, *next; | 765 ngx_buf_t *b, *next; |
760 | 766 |
761 b = buf->shadow; | 767 b = buf->shadow; |
762 | 768 |
782 | 788 |
783 buf->shadow = NULL; | 789 buf->shadow = NULL; |
784 } | 790 } |
785 | 791 |
786 | 792 |
787 static ngx_inline void ngx_event_pipe_free_shadow_raw_buf(ngx_chain_t **free, | 793 static ngx_inline void |
788 ngx_buf_t *buf) | 794 ngx_event_pipe_free_shadow_raw_buf(ngx_chain_t **free, ngx_buf_t *buf) |
789 { | 795 { |
790 ngx_buf_t *s; | 796 ngx_buf_t *s; |
791 ngx_chain_t *cl, **ll; | 797 ngx_chain_t *cl, **ll; |
792 | 798 |
793 if (buf->shadow == NULL) { | 799 if (buf->shadow == NULL) { |
811 ll = &cl->next; | 817 ll = &cl->next; |
812 } | 818 } |
813 } | 819 } |
814 | 820 |
815 | 821 |
816 ngx_int_t ngx_event_pipe_add_free_buf(ngx_event_pipe_t *p, ngx_buf_t *b) | 822 ngx_int_t |
823 ngx_event_pipe_add_free_buf(ngx_event_pipe_t *p, ngx_buf_t *b) | |
817 { | 824 { |
818 ngx_chain_t *cl; | 825 ngx_chain_t *cl; |
819 | 826 |
820 cl = ngx_alloc_chain_link(p->pool); | 827 cl = ngx_alloc_chain_link(p->pool); |
821 if (cl == NULL) { | 828 if (cl == NULL) { |
852 | 859 |
853 return NGX_OK; | 860 return NGX_OK; |
854 } | 861 } |
855 | 862 |
856 | 863 |
857 static ngx_int_t ngx_event_pipe_drain_chains(ngx_event_pipe_t *p) | 864 static ngx_int_t |
865 ngx_event_pipe_drain_chains(ngx_event_pipe_t *p) | |
858 { | 866 { |
859 ngx_chain_t *cl, *tl; | 867 ngx_chain_t *cl, *tl; |
860 | 868 |
861 for ( ;; ) { | 869 for ( ;; ) { |
862 if (p->busy) { | 870 if (p->busy) { |