Welcome! Log In Create A New Profile

Advanced

[nginx] Upstream: fixed file buffers reinit in ngx_http_upstream...

Roman Arutyunyan
September 18, 2014 08:42AM
details: http://hg.nginx.org/nginx/rev/106a8bfa4f42
branches:
changeset: 5848:106a8bfa4f42
user: Roman Arutyunyan <arut@nginx.com>
date: Thu Sep 18 16:37:16 2014 +0400
description:
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:

src/http/ngx_http_upstream.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)

diffs (30 lines):

diff -r 52b4984d2b3c -r 106a8bfa4f42 src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c Thu Sep 18 16:37:14 2014 +0400
+++ b/src/http/ngx_http_upstream.c Thu Sep 18 16:37:16 2014 +0400
@@ -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_reques

/* 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 */

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Upstream: fixed file buffers reinit in ngx_http_upstream...

Roman Arutyunyan 501 September 18, 2014 08:42AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 169
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready