changeset 5745:9d3a9c45fc43

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().
author Valentin Bartenev <vbart@nginx.com>
date Tue, 01 Jul 2014 20:52:08 +0400
parents 42114bf12da0
children 35990c69b3ac
files src/http/ngx_http_upstream.c
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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_
         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_
                                            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;
+    }
 }