summaryrefslogtreecommitdiff
path: root/src/event/ngx_event_pipe.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2011-09-20 11:21:32 +0000
committerJonathan Kolb <jon@b0g.us>2011-09-20 11:21:32 +0000
commit73e4a20a129d2afb1c5a1e1bb0a5d6966d9f5e5e (patch)
tree2b3effcc3781c00b66e25b5fc5cdeb97f4af962a /src/event/ngx_event_pipe.c
parentf4ca46af8aa347d4fd13c1db55a9a4e79bfacc92 (diff)
downloadnginx-73e4a20a129d2afb1c5a1e1bb0a5d6966d9f5e5e.tar.gz
Changes with nginx 1.1.4 20 Sep 2011v1.1.4
*) Feature: the ngx_http_upstream_keepalive module. *) Feature: the "proxy_http_version" directive. *) Feature: the "fastcgi_keep_conn" directive. *) Feature: the "worker_aio_requests" directive. *) Bugfix: if nginx was built --with-file-aio it could not be run on Linux kernel which did not support AIO. *) Bugfix: in Linux AIO error processing. Thanks to Hagai Avrahami. *) Bugfix: reduced memory consumption for long-lived requests. *) Bugfix: the module ngx_http_mp4_module did not support 64-bit MP4 "co64" atom.
Diffstat (limited to 'src/event/ngx_event_pipe.c')
-rw-r--r--src/event/ngx_event_pipe.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/event/ngx_event_pipe.c b/src/event/ngx_event_pipe.c
index 53d738f0a..4f45bb872 100644
--- a/src/event/ngx_event_pipe.c
+++ b/src/event/ngx_event_pipe.c
@@ -392,8 +392,32 @@ ngx_event_pipe_read_upstream(ngx_event_pipe_t *p)
cl->buf->file_last - cl->buf->file_pos);
}
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0,
+ "pipe length: %O", p->length);
+
#endif
+ if (p->free_raw_bufs && p->length != -1) {
+ cl = p->free_raw_bufs;
+
+ if (cl->buf->last - cl->buf->pos >= p->length) {
+
+ /* STUB */ cl->buf->num = p->num++;
+
+ if (p->input_filter(p, cl->buf) == NGX_ERROR) {
+ return NGX_ABORT;
+ }
+
+ p->free_raw_bufs = cl->next;
+ ngx_free_chain(p->pool, cl);
+ }
+ }
+
+ if (p->length == 0) {
+ p->upstream_done = 1;
+ p->read = 1;
+ }
+
if ((p->upstream_eof || p->upstream_error) && p->free_raw_bufs) {
/* STUB */ p->free_raw_bufs->buf->num = p->num++;
@@ -633,13 +657,13 @@ ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p)
rc = p->output_filter(p->output_ctx, out);
+ ngx_chain_update_chains(p->pool, &p->free, &p->busy, &out, p->tag);
+
if (rc == NGX_ERROR) {
p->downstream_error = 1;
return ngx_event_pipe_drain_chains(p);
}
- ngx_chain_update_chains(&p->free, &p->busy, &out, p->tag);
-
for (cl = p->free; cl; cl = cl->next) {
if (cl->buf->temp_file) {
@@ -848,6 +872,12 @@ ngx_event_pipe_copy_input_filter(ngx_event_pipe_t *p, ngx_buf_t *buf)
}
p->last_in = &cl->next;
+ if (p->length == -1) {
+ return NGX_OK;
+ }
+
+ p->length -= b->last - b->pos;
+
return NGX_OK;
}