diff options
author | Valentin Bartenev <vbart@nginx.com> | 2013-10-01 00:04:00 +0400 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2013-10-01 00:04:00 +0400 |
commit | 92b82c80af9db61d78a1d7836ffbd719451a55aa (patch) | |
tree | 5ee1181bf06a861e963a1589300ac757c3aa7121 /src | |
parent | 6ba03097dbc592646303dacdf169b1162a119af7 (diff) | |
download | nginx-92b82c80af9db61d78a1d7836ffbd719451a55aa.tar.gz nginx-92b82c80af9db61d78a1d7836ffbd719451a55aa.zip |
SPDY: fixed connection leak while waiting for request headers.
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 request headers, it was a no-op since the
read event handler had been set to ngx_http_empty_handler().
Diffstat (limited to 'src')
-rw-r--r-- | src/http/ngx_http_spdy.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/http/ngx_http_spdy.c b/src/http/ngx_http_spdy.c index a1ac18479..6802981af 100644 --- a/src/http/ngx_http_spdy.c +++ b/src/http/ngx_http_spdy.c @@ -145,6 +145,8 @@ static ngx_int_t ngx_http_spdy_construct_request_line(ngx_http_request_t *r); static void ngx_http_spdy_run_request(ngx_http_request_t *r); static ngx_int_t ngx_http_spdy_init_request_body(ngx_http_request_t *r); +static void ngx_http_spdy_close_stream_handler(ngx_event_t *ev); + static void ngx_http_spdy_handle_connection_handler(ngx_event_t *rev); static void ngx_http_spdy_keepalive_handler(ngx_event_t *rev); static void ngx_http_spdy_finalize_connection(ngx_http_spdy_connection_t *sc, @@ -1825,7 +1827,7 @@ ngx_http_spdy_create_stream(ngx_http_spdy_connection_t *sc, ngx_uint_t id, rev->data = fc; rev->ready = 1; - rev->handler = ngx_http_empty_handler; + rev->handler = ngx_http_spdy_close_stream_handler; rev->log = log; ngx_memcpy(wev, rev, sizeof(ngx_event_t)); @@ -2615,6 +2617,22 @@ ngx_http_spdy_read_request_body(ngx_http_request_t *r, } +static void +ngx_http_spdy_close_stream_handler(ngx_event_t *ev) +{ + ngx_connection_t *fc; + ngx_http_request_t *r; + + fc = ev->data; + r = fc->data; + + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "spdy close stream handler"); + + ngx_http_spdy_close_stream(r->spdy_stream, 0); +} + + void ngx_http_spdy_close_stream(ngx_http_spdy_stream_t *stream, ngx_int_t rc) { |