Maxim Dounin
April 05, 2018 10:00AM
details: http://hg.nginx.org/nginx/rev/08f114ed5449
branches:
changeset: 7260:08f114ed5449
user: Maxim Dounin <mdounin@mdounin.ru>
date: Thu Apr 05 16:56:12 2018 +0300
description:
Upstream: fixed u->conf->preserve_output (ticket #1519).

Previously, ngx_http_upstream_process_header() might be called after
we've finished reading response headers and switched to a different read
event handler, leading to errors with gRPC proxying. Additionally,
the u->conf->read_timeout timer might be re-armed during reading response
headers (while this is expected to be a single timeout on reading
the whole response header).

diffstat:

src/http/ngx_http_upstream.c | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)

diffs (37 lines):

diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -2013,8 +2013,6 @@ ngx_http_upstream_send_request(ngx_http_

/* rc == NGX_OK */

- u->request_body_sent = 1;
-
if (c->write->timer_set) {
ngx_del_timer(c->write);
}
@@ -2041,11 +2039,19 @@ ngx_http_upstream_send_request(ngx_http_
return;
}

- ngx_add_timer(c->read, u->conf->read_timeout);
-
- if (c->read->ready) {
- ngx_http_upstream_process_header(r, u);
- return;
+ if (!u->request_body_sent) {
+ u->request_body_sent = 1;
+
+ if (u->header_sent) {
+ return;
+ }
+
+ ngx_add_timer(c->read, u->conf->read_timeout);
+
+ if (c->read->ready) {
+ ngx_http_upstream_process_header(r, u);
+ return;
+ }
}
}

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

[nginx] Upstream: fixed u->conf->preserve_output (ticket #1519).

Maxim Dounin 479 April 05, 2018 10:00AM



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

Online Users

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