comparison src/http/ngx_http_upstream.c @ 4119:b66712cde67d

Upstream: pipe length and input_filter_init in buffered mode. As long as ngx_event_pipe() has more data read from upstream than specified in p->length it's passed to input filter even if buffer isn't yet full. This allows to process data with known length without relying on connection close to signal data end. By default p->length is set to -1 in upstream module, i.e. end of data is indicated by connection close. To set it from per-protocol handlers upstream input_filter_init() now called in buffered mode (as well as in unbuffered mode).
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 15 Sep 2011 19:00:47 +0000
parents dbddec65fdab
children 42135dd1f0ea
comparison
equal deleted inserted replaced
4118:dbddec65fdab 4119:b66712cde67d
2302 2302
2303 p->read_timeout = u->conf->read_timeout; 2303 p->read_timeout = u->conf->read_timeout;
2304 p->send_timeout = clcf->send_timeout; 2304 p->send_timeout = clcf->send_timeout;
2305 p->send_lowat = clcf->send_lowat; 2305 p->send_lowat = clcf->send_lowat;
2306 2306
2307 p->length = -1;
2308
2309 if (u->input_filter_init
2310 && u->input_filter_init(p->input_ctx) != NGX_OK)
2311 {
2312 ngx_http_upstream_finalize_request(r, u, 0);
2313 return;
2314 }
2315
2307 u->read_event_handler = ngx_http_upstream_process_upstream; 2316 u->read_event_handler = ngx_http_upstream_process_upstream;
2308 r->write_event_handler = ngx_http_upstream_process_downstream; 2317 r->write_event_handler = ngx_http_upstream_process_downstream;
2309 2318
2310 ngx_http_upstream_process_upstream(r, u); 2319 ngx_http_upstream_process_upstream(r, u);
2311 } 2320 }