diff options
author | Valentin Bartenev <vbart@nginx.com> | 2013-03-07 17:41:40 +0000 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2013-03-07 17:41:40 +0000 |
commit | 3e5aaee82878a3ddb0caa5af6375ea4c25e7bb13 (patch) | |
tree | 9b069f9858d0cce7752442d634fd56d0639e0815 /src/http/ngx_http_request.c | |
parent | a46a3ab68dfe8cb0432c7062fa6019c995ebbc6a (diff) | |
download | nginx-3e5aaee82878a3ddb0caa5af6375ea4c25e7bb13.tar.gz nginx-3e5aaee82878a3ddb0caa5af6375ea4c25e7bb13.zip |
Use "client_header_timeout" for all requests in a connection.
Previously, only the first request in a connection used timeout
value from the "client_header_timeout" directive while reading
header. All subsequent requests used "keepalive_timeout" for
that.
It happened because timeout of the read event was set to the
value of "keepalive_timeout" in ngx_http_set_keepalive(), but
was not removed when the next request arrived.
Diffstat (limited to 'src/http/ngx_http_request.c')
-rw-r--r-- | src/http/ngx_http_request.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index 3db2a4398..68cb34562 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -2736,8 +2736,6 @@ ngx_http_set_keepalive(ngx_http_request_t *r) c->data = hc; - ngx_add_timer(rev, clcf->keepalive_timeout); - if (ngx_handle_read_event(rev, 0) != NGX_OK) { ngx_http_close_connection(c); return; @@ -2753,6 +2751,10 @@ ngx_http_set_keepalive(ngx_http_request_t *r) hc->pipeline = 1; c->log->action = "reading client pipelined request line"; + if (rev->timer_set) { + ngx_del_timer(rev); + } + rev->handler = ngx_http_init_request; ngx_post_event(rev, &ngx_posted_events); return; @@ -2872,6 +2874,8 @@ ngx_http_set_keepalive(ngx_http_request_t *r) c->idle = 1; ngx_reusable_connection(c, 1); + ngx_add_timer(rev, clcf->keepalive_timeout); + if (rev->ready) { ngx_post_event(rev, &ngx_posted_events); } @@ -2993,6 +2997,8 @@ ngx_http_keepalive_handler(ngx_event_t *rev) c->idle = 0; ngx_reusable_connection(c, 0); + ngx_del_timer(rev); + ngx_http_init_request(rev); } |