mirror of
https://github.com/nginx/nginx.git
synced 2025-06-10 19:42:39 +08:00
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.
This commit is contained in:
parent
66876d0b09
commit
ba1676f267
@ -1570,6 +1570,7 @@ done:
|
|||||||
static ngx_int_t
|
static ngx_int_t
|
||||||
ngx_http_upstream_reinit(ngx_http_request_t *r, ngx_http_upstream_t *u)
|
ngx_http_upstream_reinit(ngx_http_request_t *r, ngx_http_upstream_t *u)
|
||||||
{
|
{
|
||||||
|
off_t file_pos;
|
||||||
ngx_chain_t *cl;
|
ngx_chain_t *cl;
|
||||||
|
|
||||||
if (u->reinit_request(r) != NGX_OK) {
|
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 */
|
/* reinit the request chain */
|
||||||
|
|
||||||
|
file_pos = 0;
|
||||||
|
|
||||||
for (cl = u->request_bufs; cl; cl = cl->next) {
|
for (cl = u->request_bufs; cl; cl = cl->next) {
|
||||||
cl->buf->pos = cl->buf->start;
|
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 */
|
/* reinit the subrequest's ngx_output_chain() context */
|
||||||
|
Loading…
Reference in New Issue
Block a user