Welcome! Log In Create A New Profile

Advanced

[nginx] Event pipe: fixed writing cache header to a temp file.

Maxim Dounin
July 25, 2013 08:00AM
details: http://hg.nginx.org/nginx/rev/355779f81491
branches:
changeset: 5290:355779f81491
user: Maxim Dounin <mdounin@mdounin.ru>
date: Thu Jul 25 14:55:09 2013 +0400
description:
Event pipe: fixed writing cache header to a temp file.

With previous code the p->temp_file->offset wasn't adjusted if a temp
file was written by the code in ngx_event_pipe_write_to_downstream()
after an EOF, resulting in cache not being used with empty scgi and uwsgi
responses with Content-Length set to 0.

Fix it to call ngx_event_pipe_write_chain_to_temp_file() there instead
of calling ngx_write_chain_to_temp_file() directly.

diffstat:

src/event/ngx_event_pipe.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)

diffs (29 lines):

diff --git a/src/event/ngx_event_pipe.c b/src/event/ngx_event_pipe.c
--- a/src/event/ngx_event_pipe.c
+++ b/src/event/ngx_event_pipe.c
@@ -454,7 +454,7 @@ ngx_event_pipe_write_to_downstream(ngx_e
size_t bsize;
ngx_int_t rc;
ngx_uint_t flush, flushed, prev_last_shadow;
- ngx_chain_t *out, **ll, *cl, file;
+ ngx_chain_t *out, **ll, *cl;
ngx_connection_t *downstream;

downstream = p->downstream;
@@ -514,13 +514,10 @@ ngx_event_pipe_write_to_downstream(ngx_e
}

if (p->cacheable && p->buf_to_file) {
+ ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0,
+ "pipe write chain");

- file.buf = p->buf_to_file;
- file.next = NULL;
-
- if (ngx_write_chain_to_temp_file(p->temp_file, &file)
- == NGX_ERROR)
- {
+ if (ngx_event_pipe_write_chain_to_temp_file(p) == NGX_ABORT) {
return NGX_ABORT;
}
}

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

[nginx] Event pipe: fixed writing cache header to a temp file.

Maxim Dounin 689 July 25, 2013 08:00AM



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

Online Users

Guests: 270
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