diff options
author | Roman Arutyunyan <arut@nginx.com> | 2014-09-18 16:37:16 +0400 |
---|---|---|
committer | Roman Arutyunyan <arut@nginx.com> | 2014-09-18 16:37:16 +0400 |
commit | ba1676f267b669edd49f71143001ebc7749e9d4a (patch) | |
tree | fd32388d04d70857d4d2251e6e7693ba69f0e38d /src | |
parent | 66876d0b098fee3e3a0cbdf039a11050814f55e0 (diff) | |
download | nginx-ba1676f267b669edd49f71143001ebc7749e9d4a.tar.gz nginx-ba1676f267b669edd49f71143001ebc7749e9d4a.zip |
Upstream: fixed file buffers reinit in ngx_http_upstream_reinit().
Previously, a file buffer start position was reset to the file start.
Now it's reset to the previous file buffer end. This fixes
reinitialization of requests having multiple successive parts of a
single file. Such requests are generated by fastcgi module.
Diffstat (limited to 'src')
-rw-r--r-- | src/http/ngx_http_upstream.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index 000c6de69..d547ca74e 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -1570,6 +1570,7 @@ done: static ngx_int_t ngx_http_upstream_reinit(ngx_http_request_t *r, ngx_http_upstream_t *u) { + off_t file_pos; ngx_chain_t *cl; if (u->reinit_request(r) != NGX_OK) { @@ -1591,9 +1592,17 @@ ngx_http_upstream_reinit(ngx_http_request_t *r, ngx_http_upstream_t *u) /* reinit the request chain */ + file_pos = 0; + for (cl = u->request_bufs; cl; cl = cl->next) { cl->buf->pos = cl->buf->start; - cl->buf->file_pos = 0; + + /* there is at most one file */ + + if (cl->buf->in_file) { + cl->buf->file_pos = file_pos; + file_pos = cl->buf->file_last; + } } /* reinit the subrequest's ngx_output_chain() context */ |