summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2014-07-01 20:52:08 +0400
committerValentin Bartenev <vbart@nginx.com>2014-07-01 20:52:08 +0400
commit3c2b5e88abbe6ff7e65b95708894208dd2828288 (patch)
tree7a18ef313f1cf60ec3125f243ef7cb27b0e955a5
parent9f8785ae5e5d99d6476af1a8efda321c1b92733e (diff)
downloadnginx-3c2b5e88abbe6ff7e65b95708894208dd2828288.tar.gz
nginx-3c2b5e88abbe6ff7e65b95708894208dd2828288.tar.bz2
Upstream: fixed handling of write event after sending request.
The ngx_http_upstream_dummy_handler() must be set regardless of the read event state. This prevents possible additional call of ngx_http_upstream_send_request_handler().
-rw-r--r--src/http/ngx_http_upstream.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index 42b8ba80e..20722ac3f 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -1674,13 +1674,6 @@ ngx_http_upstream_send_request(ngx_http_request_t *r, ngx_http_upstream_t *u)
c->tcp_nopush = NGX_TCP_NOPUSH_UNSET;
}
- ngx_add_timer(c->read, u->conf->read_timeout);
-
- if (c->read->ready) {
- ngx_http_upstream_process_header(r, u);
- return;
- }
-
u->write_event_handler = ngx_http_upstream_dummy_handler;
if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
@@ -1688,6 +1681,13 @@ ngx_http_upstream_send_request(ngx_http_request_t *r, ngx_http_upstream_t *u)
NGX_HTTP_INTERNAL_SERVER_ERROR);
return;
}
+
+ ngx_add_timer(c->read, u->conf->read_timeout);
+
+ if (c->read->ready) {
+ ngx_http_upstream_process_header(r, u);
+ return;
+ }
}