]> git.kaiwu.me - nginx.git/commitdiff
SPDY: fixed connection leak while waiting for request body.
authorValentin Bartenev <vbart@nginx.com>
Mon, 30 Sep 2013 20:00:57 +0000 (00:00 +0400)
committerValentin Bartenev <vbart@nginx.com>
Mon, 30 Sep 2013 20:00:57 +0000 (00:00 +0400)
If an error occurs in a SPDY connection, the c->error flag is set on every fake
request connection, and its read or write event handler is called, in order to
finalize it.  But while waiting for a request body, it was a no-op since the
read event handler ngx_http_request_handler() calls r->read_event_handler that
had been set to ngx_http_block_reading().

src/http/ngx_http_spdy.c

index e7bebccd5ae8a3afd63cc4bae3e7e5d4a616ec84..a1ac1847931f08d60a9a99a43f26e701de41851c 100644 (file)
@@ -1214,6 +1214,7 @@ ngx_http_spdy_state_data(ngx_http_spdy_connection_t *sc, u_char *pos,
         }
 
         if (rb->post_handler) {
+            r->read_event_handler = ngx_http_block_reading;
             rb->post_handler(r);
         }
     }
@@ -2607,6 +2608,9 @@ ngx_http_spdy_read_request_body(ngx_http_request_t *r,
 
     r->request_body->post_handler = post_handler;
 
+    r->read_event_handler = ngx_http_test_reading;
+    r->write_event_handler = ngx_http_request_empty_handler;
+
     return NGX_AGAIN;
 }